1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 08:22:33 +02:00

Apply clang format

This commit is contained in:
Elias Steurer 2021-07-25 15:30:37 +02:00
parent d76cfd9ff4
commit 6cb31ffa3f
57 changed files with 12310 additions and 12998 deletions

View File

@ -47,8 +47,8 @@
#include <QUrl>
#include <QtGlobal>
#include <QtQml>
#include <QtWebEngine>
#include <QtSvg>
#include <QtWebEngine>
#include "src/create.h"
#include "src/globalvariables.h"

View File

@ -17,7 +17,6 @@ ScreenPlayWallpaper::~ScreenPlayWallpaper()
{
m_connection->close();
qInfo() << "Remove wallpaper " << m_appID;
}
/*!

View File

@ -50,10 +50,9 @@ ScreenPlayWidget::ScreenPlayWidget(
QVariant::fromValue(m_type).toString(),
QString::number(m_position.x()),
QString::number(m_position.y()),
};
};
}
bool ScreenPlayWidget::start()
{
m_process.setArguments(m_appArgumentsList);

View File

@ -18,7 +18,7 @@ ScreenPlay::SDKConnection::SDKConnection(QLocalSocket* socket, QObject* parent)
{
m_socket = socket;
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
connect(m_socket, &QLocalSocket::errorOccurred, this, [](QLocalSocket::LocalSocketError socketError){
connect(m_socket, &QLocalSocket::errorOccurred, this, [](QLocalSocket::LocalSocketError socketError) {
qInfo() << "Localsocket error:" << socketError;
});
}

View File

@ -201,7 +201,7 @@ public slots:
QFile defaultPListFile(":/assets/macos/" + plistFileName);
defaultPListFile.open(QIODevice::ReadOnly);
QString settingsPlistContent = defaultPListFile.readAll();
if(!settingsPlistContent.contains("{{SCREENPLAY_PATH}}")){
if (!settingsPlistContent.contains("{{SCREENPLAY_PATH}}")) {
qCritical() << "Unable to load plist settings template from qrc to set autostart!";
}
@ -211,12 +211,12 @@ public slots:
workingDir.cdUp();
const QString screenPlayPath = QUrl::fromUserInput(workingDir.path() + "/ScreenPlay.app/Contents/MacOS/ScreenPlay").toLocalFile();
settingsPlistContent.replace("{{SCREENPLAY_PATH}}", screenPlayPath);
settingsPlistContent.replace("{{SCREENPLAY_AUTOSTART}}", autostart ? "true":"false");
settingsPlistContent.replace("{{SCREENPLAY_AUTOSTART}}", autostart ? "true" : "false");
const QString homePath = QDir::homePath();
QFile settingsPlist(homePath + "/Library/LaunchAgents/" + plistFileName);
if (settingsPlist.exists()) {
if(!settingsPlist.remove()){
if (!settingsPlist.remove()) {
qCritical() << "Unable to remove: " << settingsPlist;
}
}

View File

@ -38,7 +38,7 @@ int main(int argc, char* argv[])
#elif defined(Q_OS_LINUX)
LinuxWindow window({ 0 }, "test", "appid", "1", "fill", false);
#elif defined(Q_OS_OSX)
MacWindow window({ 0 }, "test", "appID=test", "1", "fill","videoWallpaper", true, true);
MacWindow window({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", true, true);
#endif
return app.exec();
}

View File

@ -357,31 +357,31 @@ private:
private:
bool m_checkWallpaperVisible { false };
bool m_visualsPaused { false };
bool m_loops { true };
bool m_isPlaying { true };
bool m_muted { false };
bool m_canFade { false };
bool m_debugMode { false };
float m_volume { 1.0f };
float m_playbackRate { 1.0f };
float m_currentTime { 0.0f };
QString m_contentBasePath;
QString m_projectPath;
QString m_projectSourceFile;
QString m_appID;
ScreenPlay::InstalledType::InstalledType m_type = ScreenPlay::InstalledType::InstalledType::Unknown;
QString m_OSVersion;
QString m_fillMode;
int m_width { 0 };
int m_height { 0 };
ScreenPlay::InstalledType::InstalledType m_type = ScreenPlay::InstalledType::InstalledType::Unknown;
QVector<int> m_activeScreensList;
QFileSystemWatcher m_fileSystemWatcher;
QTimer m_liveReloadLimiter;
QSysInfo m_sysinfo;
bool m_debugMode = false;
std::unique_ptr<ScreenPlaySDK> m_sdk;
QString m_contentBasePath;
QString m_projectPath;
QString m_projectSourceFile;
QUrl m_projectSourceFileAbsolute;
};

View File

@ -37,6 +37,7 @@
#include <QApplication>
#include <QDebug>
#include <QFile>
#include <QFileSystemWatcher>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonParseError>
@ -50,7 +51,6 @@
#include <QWindow>
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickWindow>
#include <QFileSystemWatcher>
#ifdef Q_OS_WIN
#include <QFileSystemWatcher>

View File

@ -19,49 +19,45 @@
// This interface lets you detect installed apps for the local Steam client, useful for debugging tools
// to offer lists of apps to debug via Steam.
//-----------------------------------------------------------------------------
class ISteamAppList
{
class ISteamAppList {
public:
virtual uint32 GetNumInstalledApps() = 0;
virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0;
virtual uint32 GetInstalledApps(AppId_t* pvecAppID, uint32 unMaxAppIDs) = 0;
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 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
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
};
#define STEAMAPPLIST_INTERFACE_VERSION "STEAMAPPLIST_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamAppList *SteamAppList();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamAppList *, SteamAppList, STEAMAPPLIST_INTERFACE_VERSION );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//---------------------------------------------------------------------------------
// Purpose: Sent when a new app is installed
//---------------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
STEAM_CALLBACK_BEGIN(SteamAppInstalled_t, k_iSteamAppListCallbacks + 1)
STEAM_CALLBACK_MEMBER(0, AppId_t, m_nAppID) // ID of the app that installs
STEAM_CALLBACK_END(1)
//---------------------------------------------------------------------------------
// Purpose: Sent when an app is uninstalled
//---------------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
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 )
#pragma pack(pop)
#endif // ISTEAMAPPLIST_H

View File

@ -14,28 +14,26 @@
const int k_cubAppProofOfPurchaseKeyMax = 240; // max supported length of a legacy cd key
//-----------------------------------------------------------------------------
// Purpose: interface to app data
//-----------------------------------------------------------------------------
class ISteamApps
{
class ISteamApps {
public:
virtual bool BIsSubscribed() = 0;
virtual bool BIsLowViolence() = 0;
virtual bool BIsCybercafe() = 0;
virtual bool BIsVACBanned() = 0;
virtual const char *GetCurrentGameLanguage() = 0;
virtual const char *GetAvailableGameLanguages() = 0;
virtual const char* GetCurrentGameLanguage() = 0;
virtual const char* GetAvailableGameLanguages() = 0;
// only use this member if you need to check ownership of another game related to yours, a demo for example
virtual bool BIsSubscribedApp( AppId_t appID ) = 0;
virtual bool BIsSubscribedApp(AppId_t appID) = 0;
// Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed
virtual bool BIsDlcInstalled( AppId_t appID ) = 0;
virtual bool BIsDlcInstalled(AppId_t appID) = 0;
// returns the Unix time of the purchase of the app
virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0;
virtual uint32 GetEarliestPurchaseUnixTime(AppId_t nAppID) = 0;
// Checks if the user is subscribed to the current app through a free weekend
// This function will return false for users who have a retail or other type of license
@ -46,26 +44,26 @@ public:
virtual int GetDLCCount() = 0;
// Returns metadata for DLC by index, of range [0, GetDLCCount()]
virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0;
virtual bool BGetDLCDataByIndex(int iDLC, AppId_t* pAppID, bool* pbAvailable, char* pchName, int cchNameBufferSize) = 0;
// Install/Uninstall control for optional DLC
virtual void InstallDLC( AppId_t nAppID ) = 0;
virtual void UninstallDLC( AppId_t nAppID ) = 0;
virtual void InstallDLC(AppId_t nAppID) = 0;
virtual void UninstallDLC(AppId_t nAppID) = 0;
// Request legacy cd-key for yourself or owned DLC. If you are interested in this
// data then make sure you provide us with a list of valid keys to be distributed
// to users when they purchase the game, before the game ships.
// You'll receive an AppProofOfPurchaseKeyResponse_t callback when
// the key is available (which may be immediately).
virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0;
virtual void RequestAppProofOfPurchaseKey(AppId_t nAppID) = 0;
virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch
virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing
virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order
virtual bool GetCurrentBetaName(char* pchName, int cchNameBufferSize) = 0; // returns current beta branch name, 'public' is the default branch
virtual bool MarkContentCorrupt(bool bMissingFilesOnly) = 0; // signal Steam that game files seems corrupt or missing
virtual uint32 GetInstalledDepots(AppId_t appID, DepotId_t* pvecDepots, uint32 cMaxDepots) = 0; // return installed depots in mount order
// returns current app install folder for AppID, returns folder name length
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 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)
// 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
@ -76,10 +74,10 @@ public:
// 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;
virtual const char* GetLaunchQueryParam(const char* pchKey) = 0;
// get download progress for optional DLC
virtual bool GetDlcDownloadProgress( AppId_t nAppID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
virtual bool GetDlcDownloadProgress(AppId_t nAppID, uint64* punBytesDownloaded, uint64* punBytesTotal) = 0;
// return the buildid of this app, may change at any time based on backend updates to the game
virtual int GetAppBuildId() = 0;
@ -90,8 +88,8 @@ public:
// member is k_uAppIdInvalid (zero).
virtual void RequestAllProofOfPurchaseKeys() = 0;
STEAM_CALL_RESULT( FileDetailsResult_t )
virtual SteamAPICall_t GetFileDetails( const char* pszFileName ) = 0;
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
@ -101,48 +99,45 @@ public:
// 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;
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;
// check if game is a timed trial with limited playtime
virtual bool BIsTimedTrial( uint32* punSecondsAllowed, uint32* punSecondsPlayed ) = 0;
virtual bool BIsTimedTrial(uint32* punSecondsAllowed, uint32* punSecondsPlayed) = 0;
};
#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION008"
// Global interface accessor
inline ISteamApps *SteamApps();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamApps *, SteamApps, STEAMAPPS_INTERFACE_VERSION );
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 );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#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
//-----------------------------------------------------------------------------
struct DlcInstalled_t
{
struct DlcInstalled_t {
enum { k_iCallback = k_iSteamAppsCallbacks + 5 };
AppId_t m_nAppID; // AppID of the DLC
};
//-----------------------------------------------------------------------------
// Purpose: possible results when registering an activation code
//-----------------------------------------------------------------------------
enum ERegisterActivationCodeResult
{
enum ERegisterActivationCodeResult {
k_ERegisterActivationCodeResultOK = 0,
k_ERegisterActivationCodeResultFail = 1,
k_ERegisterActivationCodeResultAlreadyRegistered = 2,
@ -150,36 +145,30 @@ enum ERegisterActivationCodeResult
k_ERegisterActivationCodeAlreadyOwned = 4,
};
//-----------------------------------------------------------------------------
// Purpose: response to RegisterActivationCode()
//-----------------------------------------------------------------------------
struct RegisterActivationCodeResponse_t
{
struct RegisterActivationCodeResponse_t {
enum { k_iCallback = k_iSteamAppsCallbacks + 8 };
ERegisterActivationCodeResult m_eResult;
uint32 m_unPackageRegistered; // package that was registered. Only set on success
};
//---------------------------------------------------------------------------------
// 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 and GetLaunchCommandLine
//---------------------------------------------------------------------------------
struct NewUrlLaunchParameters_t
{
struct NewUrlLaunchParameters_t {
enum { k_iCallback = k_iSteamAppsCallbacks + 14 };
};
//-----------------------------------------------------------------------------
// Purpose: response to RequestAppProofOfPurchaseKey/RequestAllProofOfPurchaseKeys
// for supporting third-party CD keys, or other proof-of-purchase systems.
//-----------------------------------------------------------------------------
struct AppProofOfPurchaseKeyResponse_t
{
struct AppProofOfPurchaseKeyResponse_t {
enum { k_iCallback = k_iSteamAppsCallbacks + 21 };
EResult m_eResult;
uint32 m_nAppID;
@ -187,12 +176,10 @@ struct AppProofOfPurchaseKeyResponse_t
char m_rgchKey[k_cubAppProofOfPurchaseKeyMax];
};
//-----------------------------------------------------------------------------
// Purpose: response to GetFileDetails
//-----------------------------------------------------------------------------
struct FileDetailsResult_t
{
struct FileDetailsResult_t {
enum { k_iCallback = k_iSteamAppsCallbacks + 23 };
EResult m_eResult;
uint64 m_ulFileSize; // original file size in bytes
@ -200,12 +187,10 @@ struct FileDetailsResult_t
uint32 m_unFlags; //
};
//-----------------------------------------------------------------------------
// Purpose: called for games in Timed Trial mode
//-----------------------------------------------------------------------------
struct TimedTrialStatus_t
{
struct TimedTrialStatus_t {
enum { k_iCallback = k_iSteamAppsCallbacks + 30 };
AppId_t m_unAppID; // appID
bool m_bIsOffline; // if true, time allowed / played refers to offline time, not total time
@ -213,5 +198,5 @@ struct TimedTrialStatus_t
uint32 m_unSecondsPlayed; // how many seconds the app was already played
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMAPPS_H

View File

@ -16,13 +16,11 @@
// steamid are located. the sizes of the appid and steamid are implicit in
// (each version of) the interface - currently uin32 appid and uint64 steamid
//-----------------------------------------------------------------------------
class ISteamAppTicket
{
class ISteamAppTicket {
public:
virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature ) = 0;
virtual uint32 GetAppOwnershipTicketData(uint32 nAppID, void* pvBuffer, uint32 cbBufferLength, uint32* piAppId, uint32* piSteamId, uint32* piSignature, uint32* pcbSignature) = 0;
};
#define STEAMAPPTICKET_INTERFACE_VERSION "STEAMAPPTICKET_INTERFACE_VERSION001"
#endif // ISTEAMAPPTICKET_H

View File

@ -24,8 +24,7 @@
// or if you want to implement a multiplexed gameserver where a single process
// is handling multiple games at once with independent gameserver SteamIDs.
//-----------------------------------------------------------------------------
class ISteamClient
{
class ISteamClient {
public:
// Creates a communication pipe to the Steam client.
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
@ -33,69 +32,69 @@ public:
// Releases a previously created communications pipe
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0;
virtual bool BReleaseSteamPipe(HSteamPipe hSteamPipe) = 0;
// connects to an existing global user, failing if none exists
// used by the game to coordinate with the steamUI
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0;
virtual HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe) = 0;
// used by game servers, create a steam user that won't be shared with anyone else
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) = 0;
virtual HSteamUser CreateLocalUser(HSteamPipe* phSteamPipe, EAccountType eAccountType) = 0;
// removes an allocated user
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0;
virtual void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser) = 0;
// retrieves the ISteamUser interface associated with the handle
virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamUser* GetISteamUser(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// retrieves the ISteamGameServer interface associated with the handle
virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamGameServer* GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// set the local IP and Port to bind to
// this must be set before CreateLocalUser()
virtual void SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPort ) = 0;
virtual void SetLocalIPBinding(const SteamIPAddress_t& unIP, uint16 usPort) = 0;
// returns the ISteamFriends interface
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamFriends* GetISteamFriends(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns the ISteamUtils interface
virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamUtils* GetISteamUtils(HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns the ISteamMatchmaking interface
virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamMatchmaking* GetISteamMatchmaking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns the ISteamMatchmakingServers interface
virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamMatchmakingServers* GetISteamMatchmakingServers(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns the a generic interface
virtual void *GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual void* GetISteamGenericInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns the ISteamUserStats interface
virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamUserStats* GetISteamUserStats(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns the ISteamGameServerStats interface
virtual ISteamGameServerStats *GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamGameServerStats* GetISteamGameServerStats(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns apps interface
virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamApps* GetISteamApps(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// networking
virtual ISteamNetworking *GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamNetworking* GetISteamNetworking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// remote storage
virtual ISteamRemoteStorage *GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamRemoteStorage* GetISteamRemoteStorage(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// user screenshots
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamScreenshots* GetISteamScreenshots(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// game search
virtual ISteamGameSearch *GetISteamGameSearch( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
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; )
STEAM_PRIVATE_API(virtual void RunFrame() = 0;)
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
@ -107,72 +106,71 @@ public:
// 'int' is the severity; 0 for msg, 1 for warning
// 'const char *' is the text of the message
// callbacks will occur directly after the API function is called that generated the warning or message.
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
virtual void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) = 0;
// Trigger global shutdown for the DLL
virtual bool BShutdownIfAllPipesClosed() = 0;
// Expose HTTP interface
virtual ISteamHTTP *GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamHTTP* GetISteamHTTP(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// 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 ; )
STEAM_PRIVATE_API(virtual void* DEPRECATED_GetISteamUnifiedMessages(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;)
// Exposes the ISteamController interface - deprecated in favor of Steam Input
virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamController* GetISteamController(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// Exposes the ISteamUGC interface
virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamUGC* GetISteamUGC(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// returns app list interface, only available on specially registered apps
virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamAppList* GetISteamAppList(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// Music Player
virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamMusic* GetISteamMusic(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// Music Player Remote
virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
virtual ISteamMusicRemote* GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// html page display
virtual ISteamHTMLSurface *GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
virtual ISteamHTMLSurface* GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// Helper functions for internal Steam usage
STEAM_PRIVATE_API( virtual void DEPRECATED_Set_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void DEPRECATED_Remove_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess( SteamAPI_CheckCallbackRegistered_t func ) = 0; )
STEAM_PRIVATE_API(virtual void DEPRECATED_Set_SteamAPI_CPostAPIResultInProcess(void (*)()) = 0;)
STEAM_PRIVATE_API(virtual void DEPRECATED_Remove_SteamAPI_CPostAPIResultInProcess(void (*)()) = 0;)
STEAM_PRIVATE_API(virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess(SteamAPI_CheckCallbackRegistered_t func) = 0;)
// inventory
virtual ISteamInventory *GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamInventory* GetISteamInventory(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// Video
virtual ISteamVideo *GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamVideo* GetISteamVideo(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// Parental controls
virtual ISteamParentalSettings *GetISteamParentalSettings( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
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;
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;
virtual ISteamParties* GetISteamParties(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
// Steam Remote Play interface
virtual ISteamRemotePlay *GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
STEAM_PRIVATE_API( virtual void DestroyAllInterfaces() = 0; )
virtual ISteamRemotePlay* GetISteamRemotePlay(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* pchVersion) = 0;
STEAM_PRIVATE_API(virtual void DestroyAllInterfaces() = 0;)
};
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient020"
#ifndef STEAM_API_EXPORTS
// Global ISteamClient interface accessor
inline ISteamClient *SteamClient();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamClient *, SteamClient, SteamInternal_CreateInterface( STEAMCLIENT_INTERFACE_VERSION ), "global", STEAMCLIENT_INTERFACE_VERSION );
inline ISteamClient* SteamClient();
STEAM_DEFINE_INTERFACE_ACCESSOR(ISteamClient*, SteamClient, SteamInternal_CreateInterface(STEAMCLIENT_INTERFACE_VERSION), "global", STEAMCLIENT_INTERFACE_VERSION);
// 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(); }
inline ISteamClient* SteamGameServerClient() { return SteamClient(); }
#endif

View File

@ -16,8 +16,8 @@
#pragma once
#endif
#include "steam_api_common.h"
#include "isteaminput.h"
#include "steam_api_common.h"
#define STEAM_CONTROLLER_MAX_COUNT 16
@ -36,8 +36,7 @@
#define STEAM_CONTROLLER_MAX_ANALOG_ACTION_DATA 1.0f
#ifndef ISTEAMINPUT_H
enum ESteamControllerPad
{
enum ESteamControllerPad {
k_ESteamControllerPad_Left,
k_ESteamControllerPad_Right
};
@ -47,8 +46,7 @@ enum ESteamControllerPad
// 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
{
enum EControllerActionOrigin {
// Steam Controller
k_EControllerActionOrigin_None,
k_EControllerActionOrigin_A,
@ -367,14 +365,12 @@ enum EControllerActionOrigin
k_EControllerActionOrigin_PS5_Gyro_Yaw,
k_EControllerActionOrigin_PS5_Gyro_Roll,
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.
};
#ifndef ISTEAMINPUT_H
enum EXboxOrigin
{
enum EXboxOrigin {
k_EXboxOrigin_A,
k_EXboxOrigin_B,
k_EXboxOrigin_X,
@ -405,8 +401,7 @@ enum EXboxOrigin
k_EXboxOrigin_DPad_East,
};
enum ESteamInputType
{
enum ESteamInputType {
k_ESteamInputType_Unknown,
k_ESteamInputType_SteamController,
k_ESteamInputType_XBox360Controller,
@ -426,8 +421,7 @@ enum ESteamInputType
};
#endif
enum ESteamControllerLEDFlag
{
enum ESteamControllerLEDFlag {
k_ESteamControllerLEDFlag_SetColor,
k_ESteamControllerLEDFlag_RestoreUserDefault
};
@ -436,22 +430,20 @@ enum ESteamControllerLEDFlag
// This handle will consistently identify a controller, even if it is disconnected and re-connected
typedef uint64 ControllerHandle_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 ControllerActionSetHandle_t;
typedef uint64 ControllerDigitalActionHandle_t;
typedef uint64 ControllerAnalogActionHandle_t;
#pragma pack( push, 1 )
#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
{
struct ControllerAnalogActionData_t {
// Type of data coming from this action, this will match what got specified in the action set
EControllerSourceMode eMode;
@ -462,8 +454,7 @@ struct ControllerAnalogActionData_t
bool bActive;
};
struct ControllerDigitalActionData_t
{
struct ControllerDigitalActionData_t {
// The current state of this action; will be true if currently pressed
bool bState;
@ -471,8 +462,7 @@ struct ControllerDigitalActionData_t
bool bActive;
};
struct ControllerMotionData_t
{
struct ControllerMotionData_t {
// Sensor-fused absolute rotation; will drift in heading
float rotQuatX;
float rotQuatY;
@ -490,16 +480,13 @@ struct ControllerMotionData_t
float rotVelZ;
};
#endif
#pragma pack( pop )
#pragma pack(pop)
//-----------------------------------------------------------------------------
// Purpose: Steam Input API
//-----------------------------------------------------------------------------
class ISteamController
{
class ISteamController {
public:
// Init and Shutdown must be called when starting/ending use of this interface
virtual bool Init() = 0;
virtual bool Shutdown() = 0;
@ -513,83 +500,83 @@ public:
// Enumerate currently connected controllers
// handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles
// Returns the number of handles written to handlesOut
virtual int GetConnectedControllers( STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_COUNT, Receives list of connected controllers ) ControllerHandle_t *handlesOut ) = 0;
virtual int GetConnectedControllers(STEAM_OUT_ARRAY_COUNT(STEAM_CONTROLLER_MAX_COUNT, Receives list of connected controllers) ControllerHandle_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 ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0;
virtual ControllerActionSetHandle_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( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) = 0;
virtual ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) = 0;
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 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;
// Enumerate currently active layers
// handlesOut should point to a STEAM_CONTROLLER_MAX_ACTIVE_LAYERS sized array of ControllerActionSetHandle_t handles.
// Returns the number of handles written to handlesOut
virtual int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ACTIVE_LAYERS, Receives list of active layers ) ControllerActionSetHandle_t *handlesOut ) = 0;
virtual int GetActiveActionSetLayers(ControllerHandle_t controllerHandle, STEAM_OUT_ARRAY_COUNT(STEAM_CONTROLLER_MAX_ACTIVE_LAYERS, Receives list of active layers) 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;
virtual ControllerDigitalActionHandle_t GetDigitalActionHandle(const char* pszActionName) = 0;
// Returns the current state of the supplied digital game action
virtual ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) = 0;
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. 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, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ORIGINS, Receives list of aciton origins ) EControllerActionOrigin *originsOut ) = 0;
virtual int GetDigitalActionOrigins(ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, STEAM_OUT_ARRAY_COUNT(STEAM_CONTROLLER_MAX_ORIGINS, Receives list of aciton origins) 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.
virtual ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) = 0;
virtual ControllerAnalogActionHandle_t GetAnalogActionHandle(const char* pszActionName) = 0;
// Returns the current state of these supplied analog game action
virtual ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) = 0;
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. 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, STEAM_OUT_ARRAY_COUNT( STEAM_CONTROLLER_MAX_ORIGINS, Receives list of action origins ) EControllerActionOrigin *originsOut ) = 0;
virtual int GetAnalogActionOrigins(ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, STEAM_OUT_ARRAY_COUNT(STEAM_CONTROLLER_MAX_ORIGINS, Receives list of action origins) 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;
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 const char* GetStringForActionOrigin(EControllerActionOrigin eOrigin) = 0;
virtual void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) = 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;
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;
virtual void TriggerHapticPulse(ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec) = 0;
// Trigger a pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times.
// 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;
virtual void TriggerRepeatedHapticPulse(ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags) = 0;
// Trigger a vibration event on supported controllers.
virtual void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) = 0;
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;
virtual void SetLEDColor(ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags) = 0;
//-----------------------------------------------------------------------------
// Utility functions availible without using the rest of Steam Input API
@ -597,40 +584,40 @@ public:
// 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;
virtual bool ShowBindingPanel(ControllerHandle_t controllerHandle) = 0;
// Returns the input type for a particular handle - unlike EControllerActionOrigin which update with Steam and may return unrecognized values
// ESteamInputType will remain static and only return valid values from your SDK version
virtual ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle ) = 0;
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;
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;
virtual int GetGamepadIndexForController(ControllerHandle_t ulControllerHandle) = 0;
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin.
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
virtual const char* GetStringForXboxOrigin(EXboxOrigin eOrigin) = 0;
// Get a local path to art for on-screen glyph for a particular Xbox controller origin.
virtual const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) = 0;
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;
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;
virtual EControllerActionOrigin TranslateActionOrigin(ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin) = 0;
// Get the binding revision for a given device. Returns false if the handle was not valid or if a mapping is not yet loaded for the device
virtual bool GetControllerBindingRevision( ControllerHandle_t controllerHandle, int *pMajor, int *pMinor ) = 0;
virtual bool GetControllerBindingRevision(ControllerHandle_t controllerHandle, int* pMajor, int* pMinor) = 0;
};
#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController008"
// Global interface accessor
inline ISteamController *SteamController();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamController *, SteamController, STEAMCONTROLLER_INTERFACE_VERSION );
inline ISteamController* SteamController();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamController*, SteamController, STEAMCONTROLLER_INTERFACE_VERSION);
#endif // ISTEAMCONTROLLER_H

View File

@ -15,8 +15,7 @@
//-----------------------------------------------------------------------------
// Purpose: set of relationships to other users
//-----------------------------------------------------------------------------
enum EFriendRelationship
{
enum EFriendRelationship {
k_EFriendRelationshipNone = 0,
k_EFriendRelationshipBlocked = 1, // this doesn't get stored; the user has just done an Ignore on an friendship invite
k_EFriendRelationshipRequestRecipient = 2,
@ -44,12 +43,10 @@ const FriendsGroupID_t k_FriendsGroupID_Invalid = -1;
const int k_cEnumerateFollowersMax = 50;
//-----------------------------------------------------------------------------
// Purpose: list of states a friend can be in
//-----------------------------------------------------------------------------
enum EPersonaState
{
enum EPersonaState {
k_EPersonaStateOffline = 0, // friend is not currently logged on
k_EPersonaStateOnline = 1, // friend is logged on
k_EPersonaStateBusy = 2, // user is on, but busy
@ -61,12 +58,10 @@ enum EPersonaState
k_EPersonaStateMax,
};
//-----------------------------------------------------------------------------
// Purpose: flags for enumerating friends list, or quickly checking a the relationship between users
//-----------------------------------------------------------------------------
enum EFriendFlags
{
enum EFriendFlags {
k_EFriendFlagNone = 0x00,
k_EFriendFlagBlocked = 0x01,
k_EFriendFlagFriendshipRequested = 0x02,
@ -84,30 +79,27 @@ enum EFriendFlags
k_EFriendFlagAll = 0xFFFF,
};
// friend game played information
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct FriendGameInfo_t
{
struct FriendGameInfo_t {
CGameID m_gameID;
uint32 m_unGameIP;
uint16 m_usGamePort;
uint16 m_usQueryPort;
CSteamID m_steamIDLobby;
};
#pragma pack( pop )
#pragma pack(pop)
// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16.
// The UTF-8 version has to be very generous to accomodate characters that get large when encoded
// in UTF-8.
enum
{
enum {
k_cchPersonaNameMax = 128,
k_cwchPersonaNameMax = 32,
};
@ -115,8 +107,7 @@ enum
//-----------------------------------------------------------------------------
// Purpose: user restriction flags
//-----------------------------------------------------------------------------
enum EUserRestriction
{
enum EUserRestriction {
k_nUserRestrictionNone = 0, // no known chat/content restriction
k_nUserRestrictionUnknown = 1, // we don't know yet (user offline)
k_nUserRestrictionAnyChat = 2, // user is not allowed to (or can't) send/recv any chat
@ -136,19 +127,16 @@ enum { k_cchMaxRichPresenceKeyLength = 64 };
enum { k_cchMaxRichPresenceValueLength = 256 };
// These values are passed as parameters to the store
enum EOverlayToStoreFlag
{
enum EOverlayToStoreFlag {
k_EOverlayToStoreFlag_None = 0,
k_EOverlayToStoreFlag_AddToCart = 1,
k_EOverlayToStoreFlag_AddToCartAndShow = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Tells Steam where to place the browser window inside the overlay
//-----------------------------------------------------------------------------
enum EActivateGameOverlayToWebPageMode
{
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.
@ -157,20 +145,18 @@ enum EActivateGameOverlayToWebPageMode
// 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
//-----------------------------------------------------------------------------
class ISteamFriends
{
class ISteamFriends {
public:
// returns the local players name - guaranteed to not be NULL.
// this is the same name as on the users community profile page
// this is stored in UTF-8 format
// like all the other interface functions that return a char *, it's important that this pointer is not saved
// off; it will eventually be free'd or re-allocated
virtual const char *GetPersonaName() = 0;
virtual const char* GetPersonaName() = 0;
// Sets the player name, stores it on the server and publishes the changes to all friends who are online.
// Changes take place locally immediately, and a PersonaStateChange_t is posted, presuming success.
@ -179,8 +165,8 @@ 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.
STEAM_CALL_RESULT( SetPersonaNameResponse_t )
virtual SteamAPICall_t SetPersonaName( const char *pchPersonaName ) = 0;
STEAM_CALL_RESULT(SetPersonaNameResponse_t)
virtual SteamAPICall_t SetPersonaName(const char* pchPersonaName) = 0;
// gets the status of the current user
virtual EPersonaState GetPersonaState() = 0;
@ -188,83 +174,83 @@ public:
// friend iteration
// takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria
// then GetFriendByIndex() can then be used to return the id's of each of those users
virtual int GetFriendCount( int iFriendFlags ) = 0;
virtual int GetFriendCount(int iFriendFlags) = 0;
// returns the steamID of a user
// iFriend is a index of range [0, GetFriendCount())
// iFriendsFlags must be the same value as used in GetFriendCount()
// the returned CSteamID can then be used by all the functions below to access details about the user
virtual CSteamID GetFriendByIndex( int iFriend, int iFriendFlags ) = 0;
virtual CSteamID GetFriendByIndex(int iFriend, int iFriendFlags) = 0;
// returns a relationship to a user
virtual EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend ) = 0;
virtual EFriendRelationship GetFriendRelationship(CSteamID steamIDFriend) = 0;
// returns the current status of the specified user
// this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user
virtual EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) = 0;
virtual EPersonaState GetFriendPersonaState(CSteamID steamIDFriend) = 0;
// returns the name another user - guaranteed to not be NULL.
// same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
// note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
//
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;
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, STEAM_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;
virtual const char* GetFriendPersonaNameHistory(CSteamID steamIDFriend, int iPersonaName) = 0;
// friends steam level
virtual int GetFriendSteamLevel( CSteamID steamIDFriend ) = 0;
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;
virtual const char* GetPlayerNickname(CSteamID steamIDPlayer) = 0;
// friend grouping (tag) apis
// returns the number of friends groups
virtual int GetFriendsGroupCount() = 0;
// returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid)
virtual FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG ) = 0;
virtual FriendsGroupID_t GetFriendsGroupIDByIndex(int iFG) = 0;
// returns the name for the given friends group (NULL in the case of invalid friends group IDs)
virtual const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID ) = 0;
virtual const char* GetFriendsGroupName(FriendsGroupID_t friendsGroupID) = 0;
// returns the number of members in a given friends group
virtual int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID ) = 0;
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, STEAM_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
virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0;
virtual bool HasFriend(CSteamID steamIDFriend, int iFriendFlags) = 0;
// clan (group) iteration and access functions
virtual int GetClanCount() = 0;
virtual CSteamID GetClanByIndex( int iClan ) = 0;
virtual const char *GetClanName( CSteamID steamIDClan ) = 0;
virtual const char *GetClanTag( CSteamID steamIDClan ) = 0;
virtual CSteamID GetClanByIndex(int iClan) = 0;
virtual const char* GetClanName(CSteamID steamIDClan) = 0;
virtual const char* GetClanTag(CSteamID steamIDClan) = 0;
// 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;
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
STEAM_CALL_RESULT( DownloadClanActivityCountsResult_t )
virtual SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest ) = 0;
STEAM_CALL_RESULT(DownloadClanActivityCountsResult_t)
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
// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
// steamIDSource can be the steamID of a group, game server, lobby or chat room
virtual int GetFriendCountFromSource( CSteamID steamIDSource ) = 0;
virtual CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend ) = 0;
virtual int GetFriendCountFromSource(CSteamID steamIDSource) = 0;
virtual CSteamID GetFriendFromSourceByIndex(CSteamID steamIDSource, int iFriend) = 0;
// returns true if the local user can see that steamIDUser is a member or in steamIDSource
virtual bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource ) = 0;
virtual bool IsUserInSource(CSteamID steamIDUser, CSteamID steamIDSource) = 0;
// User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI)
virtual void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) = 0;
virtual void SetInGameVoiceSpeaking(CSteamID steamIDUser, bool bSpeaking) = 0;
// activates the game overlay, with an optional dialog to open
// valid options include "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements",
// "chatroomgroup/nnnn"
virtual void ActivateGameOverlay( const char *pchDialog ) = 0;
virtual void ActivateGameOverlay(const char* pchDialog) = 0;
// activates game overlay to a specific place
// valid options are
@ -277,38 +263,38 @@ public:
// "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend
// "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite
// "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite
virtual void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID ) = 0;
virtual void ActivateGameOverlayToUser(const char* pchDialog, CSteamID steamID) = 0;
// 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, EActivateGameOverlayToWebPageMode eMode = k_EActivateGameOverlayToWebPageMode_Default ) = 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;
virtual void ActivateGameOverlayToStore(AppId_t nAppID, EOverlayToStoreFlag eFlag) = 0;
// Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is
// in game
virtual void SetPlayedWith( CSteamID steamIDUserPlayedWith ) = 0;
virtual void SetPlayedWith(CSteamID steamIDUserPlayedWith) = 0;
// activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby.
virtual void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby ) = 0;
virtual void ActivateGameOverlayInviteDialog(CSteamID steamIDLobby) = 0;
// gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
virtual int GetSmallFriendAvatar( CSteamID steamIDFriend ) = 0;
virtual int GetSmallFriendAvatar(CSteamID steamIDFriend) = 0;
// gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
virtual int GetMediumFriendAvatar( CSteamID steamIDFriend ) = 0;
virtual int GetMediumFriendAvatar(CSteamID steamIDFriend) = 0;
// gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
// returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again
virtual int GetLargeFriendAvatar( CSteamID steamIDFriend ) = 0;
virtual int GetLargeFriendAvatar(CSteamID steamIDFriend) = 0;
// requests information about a user - persona name & avatar
// if bRequireNameOnly is set, then the avatar of a user isn't downloaded
// - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them
// if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved
// if returns false, it means that we already have all the details about that user, and functions can be called immediately
virtual bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) = 0;
virtual bool RequestUserInformation(CSteamID steamIDUser, bool bRequireNameOnly) = 0;
// requests information about a clan officer list
// when complete, data is returned in ClanOfficerListResponse_t call result
@ -316,17 +302,17 @@ 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
STEAM_CALL_RESULT( ClanOfficerListResponse_t )
virtual SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) = 0;
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
// returns the steamID of the clan owner
virtual CSteamID GetClanOwner( CSteamID steamIDClan ) = 0;
virtual CSteamID GetClanOwner(CSteamID steamIDClan) = 0;
// returns the number of officers in a clan (including the owner)
virtual int GetClanOfficerCount( CSteamID steamIDClan ) = 0;
virtual int GetClanOfficerCount(CSteamID steamIDClan) = 0;
// returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)
virtual CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer ) = 0;
virtual CSteamID GetClanOfficerByIndex(CSteamID steamIDClan, int iOfficer) = 0;
// if current user is chat restricted, he can't send or receive any text/voice chat messages.
// the user can't see custom avatars. But the user can be online and send/recv game invites.
// a chat restricted user can't add friends or join any groups.
@ -348,61 +334,61 @@ public:
// SetRichPresence() to a NULL or an empty string deletes the key
// You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount()
// and GetFriendRichPresenceKeyByIndex() (typically only used for debugging)
virtual bool SetRichPresence( const char *pchKey, const char *pchValue ) = 0;
virtual bool SetRichPresence(const char* pchKey, const char* pchValue) = 0;
virtual void ClearRichPresence() = 0;
virtual const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey ) = 0;
virtual int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend ) = 0;
virtual const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey ) = 0;
virtual const char* GetFriendRichPresence(CSteamID steamIDFriend, const char* pchKey) = 0;
virtual int GetFriendRichPresenceKeyCount(CSteamID steamIDFriend) = 0;
virtual const char* GetFriendRichPresenceKeyByIndex(CSteamID steamIDFriend, int iKey) = 0;
// Requests rich presence for a specific user.
virtual void RequestFriendRichPresence( CSteamID steamIDFriend ) = 0;
virtual void RequestFriendRichPresence(CSteamID steamIDFriend) = 0;
// Rich invite support.
// If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string.
// (Or you can configure your game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.)
virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0;
virtual bool InviteUserToGame(CSteamID steamIDFriend, const char* pchConnectString) = 0;
// recently-played-with friends iteration
// this iterates the entire list of users recently played with, across games
// GetFriendCoplayTime() returns as a unix time
virtual int GetCoplayFriendCount() = 0;
virtual CSteamID GetCoplayFriend( int iCoplayFriend ) = 0;
virtual int GetFriendCoplayTime( CSteamID steamIDFriend ) = 0;
virtual AppId_t GetFriendCoplayGame( CSteamID steamIDFriend ) = 0;
virtual CSteamID GetCoplayFriend(int iCoplayFriend) = 0;
virtual int GetFriendCoplayTime(CSteamID steamIDFriend) = 0;
virtual AppId_t GetFriendCoplayGame(CSteamID steamIDFriend) = 0;
// chat interface for games
// 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
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, STEAM_OUT_STRUCT() CSteamID *psteamidChatter ) = 0;
virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0;
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, STEAM_OUT_STRUCT() CSteamID* psteamidChatter) = 0;
virtual bool IsClanChatAdmin(CSteamID steamIDClanChat, CSteamID steamIDUser) = 0;
// interact with the Steam (game overlay / desktop)
virtual bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat ) = 0;
virtual bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0;
virtual bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0;
virtual bool IsClanChatWindowOpenInSteam(CSteamID steamIDClanChat) = 0;
virtual bool OpenClanChatWindowInSteam(CSteamID steamIDClanChat) = 0;
virtual bool CloseClanChatWindowInSteam(CSteamID steamIDClanChat) = 0;
// peer-to-peer chat interception
// this is so you can show P2P chats inline in the game
virtual bool SetListenForFriendsMessages( bool bInterceptEnabled ) = 0;
virtual bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend ) = 0;
virtual int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
virtual bool SetListenForFriendsMessages(bool bInterceptEnabled) = 0;
virtual bool ReplyToFriendMessage(CSteamID steamIDFriend, const char* pchMsgToSend) = 0;
virtual int GetFriendMessage(CSteamID steamIDFriend, int iMessageID, void* pvData, int cubData, EChatEntryType* peChatEntryType) = 0;
// following apis
STEAM_CALL_RESULT( FriendsGetFollowerCount_t )
virtual SteamAPICall_t GetFollowerCount( CSteamID steamID ) = 0;
STEAM_CALL_RESULT( FriendsIsFollowing_t )
virtual SteamAPICall_t IsFollowing( CSteamID steamID ) = 0;
STEAM_CALL_RESULT( FriendsEnumerateFollowingList_t )
virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0;
STEAM_CALL_RESULT(FriendsGetFollowerCount_t)
virtual SteamAPICall_t GetFollowerCount(CSteamID steamID) = 0;
STEAM_CALL_RESULT(FriendsIsFollowing_t)
virtual SteamAPICall_t IsFollowing(CSteamID steamID) = 0;
STEAM_CALL_RESULT(FriendsEnumerateFollowingList_t)
virtual SteamAPICall_t EnumerateFollowingList(uint32 unStartIndex) = 0;
virtual bool IsClanPublic( CSteamID steamIDClan ) = 0;
virtual bool IsClanOfficialGameGroup( CSteamID steamIDClan ) = 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
@ -413,28 +399,28 @@ public:
virtual int GetNumChatsWithUnreadPriorityMessages() = 0;
// activates game overlay to open the remote play together invite dialog. Invitations will be sent for remote play together
virtual void ActivateGameOverlayRemotePlayTogetherInviteDialog( CSteamID steamIDLobby ) = 0;
virtual void ActivateGameOverlayRemotePlayTogetherInviteDialog(CSteamID steamIDLobby) = 0;
// Call this before calling ActivateGameOverlayToWebPage() to have the Steam Overlay Browser block navigations
// to your specified protocol (scheme) uris and instead dispatch a OverlayBrowserProtocolNavigation_t callback to your game.
// ActivateGameOverlayToWebPage() must have been called with k_EActivateGameOverlayToWebPageMode_Modal
virtual bool RegisterProtocolInOverlayBrowser( const char *pchProtocol ) = 0;
virtual bool RegisterProtocolInOverlayBrowser(const char* pchProtocol) = 0;
// Activates the game overlay to open an invite dialog that will send the provided Rich Presence connect string to selected friends
virtual void ActivateGameOverlayInviteDialogConnectString( const char *pchConnectString ) = 0;
virtual void ActivateGameOverlayInviteDialogConnectString(const char* pchConnectString) = 0;
};
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends017"
// Global interface accessor
inline ISteamFriends *SteamFriends();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamFriends *, SteamFriends, STEAMFRIENDS_INTERFACE_VERSION );
inline ISteamFriends* SteamFriends();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamFriends*, SteamFriends, STEAMFRIENDS_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -442,19 +428,16 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamFriends *, SteamFriends, STEAMFRIEND
//-----------------------------------------------------------------------------
// Purpose: called when a friends' status changes
//-----------------------------------------------------------------------------
struct PersonaStateChange_t
{
struct PersonaStateChange_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 4 };
uint64 m_ulSteamID; // steamID of the friend who changed
int m_nChangeFlags; // what's changed
};
// used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user
// these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend
enum EPersonaChange
{
enum EPersonaChange {
k_EPersonaChangeName = 0x0001,
k_EPersonaChangeStatus = 0x0002,
k_EPersonaChangeComeOnline = 0x0004,
@ -462,7 +445,7 @@ enum EPersonaChange
k_EPersonaChangeGamePlayed = 0x0010,
k_EPersonaChangeGameServer = 0x0020,
k_EPersonaChangeAvatar = 0x0040,
k_EPersonaChangeJoinedSource= 0x0080,
k_EPersonaChangeJoinedSource = 0x0080,
k_EPersonaChangeLeftSource = 0x0100,
k_EPersonaChangeRelationshipChanged = 0x0200,
k_EPersonaChangeNameFirstSet = 0x0400,
@ -472,36 +455,30 @@ enum EPersonaChange
k_EPersonaChangeRichPresence = 0x4000,
};
//-----------------------------------------------------------------------------
// Purpose: posted when game overlay activates or deactivates
// the game can use this to be pause or resume single player games
//-----------------------------------------------------------------------------
struct GameOverlayActivated_t
{
struct GameOverlayActivated_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 31 };
uint8 m_bActive; // true if it's just been activated, false otherwise
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a different game server from their friends list
// game client should attempt to connect to specified server when this is received
//-----------------------------------------------------------------------------
struct GameServerChangeRequested_t
{
struct GameServerChangeRequested_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 32 };
char m_rgchServer[64]; // server address ("127.0.0.1:27015", "tf2.valvesoftware.com")
char m_rgchPassword[64]; // server password, if any
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a lobby from their friends list
// game client should attempt to connect to specified lobby when this is received
//-----------------------------------------------------------------------------
struct GameLobbyJoinRequested_t
{
struct GameLobbyJoinRequested_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 33 };
CSteamID m_steamIDLobby;
@ -513,13 +490,11 @@ struct GameLobbyJoinRequested_t
CSteamID m_steamIDFriend;
};
//-----------------------------------------------------------------------------
// Purpose: called when an avatar is loaded in from a previous GetLargeFriendAvatar() call
// if the image wasn't already available
//-----------------------------------------------------------------------------
struct AvatarImageLoaded_t
{
struct AvatarImageLoaded_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 34 };
CSteamID m_steamID; // steamid the avatar has been loaded for
int m_iImage; // the image index of the now loaded image
@ -527,70 +502,58 @@ struct AvatarImageLoaded_t
int m_iTall; // height of the loaded image
};
//-----------------------------------------------------------------------------
// Purpose: marks the return of a request officer list call
//-----------------------------------------------------------------------------
struct ClanOfficerListResponse_t
{
struct ClanOfficerListResponse_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 35 };
CSteamID m_steamIDClan;
int m_cOfficers;
uint8 m_bSuccess;
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating updated data about friends rich presence information
//-----------------------------------------------------------------------------
struct FriendRichPresenceUpdate_t
{
struct FriendRichPresenceUpdate_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 36 };
CSteamID m_steamIDFriend; // friend who's rich presence has changed
AppId_t m_nAppID; // the appID of the game (should always be the current game)
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a game from their friends list
// rich presence will have been set with the "connect" key which is set here
//-----------------------------------------------------------------------------
struct GameRichPresenceJoinRequested_t
{
struct GameRichPresenceJoinRequested_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 37 };
CSteamID m_steamIDFriend; // the friend they did the join via (will be invalid if not directly via a friend)
char m_rgchConnect[k_cchMaxRichPresenceValueLength];
};
//-----------------------------------------------------------------------------
// Purpose: a chat message has been received for a clan chat the game has joined
//-----------------------------------------------------------------------------
struct GameConnectedClanChatMsg_t
{
struct GameConnectedClanChatMsg_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 38 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
int m_iMessageID;
};
//-----------------------------------------------------------------------------
// Purpose: a user has joined a clan chat
//-----------------------------------------------------------------------------
struct GameConnectedChatJoin_t
{
struct GameConnectedChatJoin_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 39 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
};
//-----------------------------------------------------------------------------
// Purpose: a user has left the chat we're in
//-----------------------------------------------------------------------------
struct GameConnectedChatLeave_t
{
struct GameConnectedChatLeave_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 40 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
@ -598,22 +561,18 @@ struct GameConnectedChatLeave_t
bool m_bDropped; // true if Steam connection dropped
};
//-----------------------------------------------------------------------------
// Purpose: a DownloadClanActivityCounts() call has finished
//-----------------------------------------------------------------------------
struct DownloadClanActivityCountsResult_t
{
struct DownloadClanActivityCountsResult_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 41 };
bool m_bSuccess;
};
//-----------------------------------------------------------------------------
// Purpose: a JoinClanChatRoom() call has finished
//-----------------------------------------------------------------------------
struct JoinClanChatRoomCompletionResult_t
{
struct JoinClanChatRoomCompletionResult_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 42 };
CSteamID m_steamIDClanChat;
EChatRoomEnterResponse m_eChatRoomEnterResponse;
@ -622,37 +581,30 @@ struct JoinClanChatRoomCompletionResult_t
//-----------------------------------------------------------------------------
// Purpose: a chat message has been received from a user
//-----------------------------------------------------------------------------
struct GameConnectedFriendChatMsg_t
{
struct GameConnectedFriendChatMsg_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 43 };
CSteamID m_steamIDUser;
int m_iMessageID;
};
struct FriendsGetFollowerCount_t
{
struct FriendsGetFollowerCount_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 44 };
EResult m_eResult;
CSteamID m_steamID;
int m_nCount;
};
struct FriendsIsFollowing_t
{
struct FriendsIsFollowing_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 45 };
EResult m_eResult;
CSteamID m_steamID;
bool m_bIsFollowing;
};
struct FriendsEnumerateFollowingList_t
{
struct FriendsEnumerateFollowingList_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 46 };
EResult m_eResult;
CSteamID m_rgSteamID[ k_cEnumerateFollowersMax ];
CSteamID m_rgSteamID[k_cEnumerateFollowersMax];
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
};
@ -660,8 +612,7 @@ struct FriendsEnumerateFollowingList_t
//-----------------------------------------------------------------------------
// Purpose: reports the result of an attempt to change the user's persona name
//-----------------------------------------------------------------------------
struct SetPersonaNameResponse_t
{
struct SetPersonaNameResponse_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 47 };
bool m_bSuccess; // true if name change succeeded completely.
@ -672,22 +623,18 @@ struct SetPersonaNameResponse_t
//-----------------------------------------------------------------------------
// Purpose: Invoked when the status of unread messages changes
//-----------------------------------------------------------------------------
struct UnreadChatMessagesChanged_t
{
struct UnreadChatMessagesChanged_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 48 };
};
//-----------------------------------------------------------------------------
// Purpose: Dispatched when an overlay browser instance is navigated to a protocol/scheme registered by RegisterProtocolInOverlayBrowser()
//-----------------------------------------------------------------------------
struct OverlayBrowserProtocolNavigation_t
{
struct OverlayBrowserProtocolNavigation_t {
enum { k_iCallback = k_iSteamFriendsCallbacks + 49 };
char rgchURI[ 1024 ];
char rgchURI[1024];
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMFRIENDS_H

View File

@ -12,10 +12,8 @@
#include "steam_api_common.h"
// list of possible return values from the ISteamGameCoordinator API
enum EGCResults
{
enum EGCResults {
k_EGCResultOK = 0,
k_EGCResultNoMessage = 1, // There is no message in the queue
k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message
@ -23,52 +21,46 @@ enum EGCResults
k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage
};
//-----------------------------------------------------------------------------
// Purpose: Functions for sending and receiving messages from the Game Coordinator
// for this application
//-----------------------------------------------------------------------------
class ISteamGameCoordinator
{
class ISteamGameCoordinator {
public:
// sends a message to the Game Coordinator
virtual EGCResults SendMessage( uint32 unMsgType, const void *pubData, uint32 cubData ) = 0;
virtual EGCResults SendMessage(uint32 unMsgType, const void* pubData, uint32 cubData) = 0;
// returns true if there is a message waiting from the game coordinator
virtual bool IsMessageAvailable( uint32 *pcubMsgSize ) = 0;
virtual bool IsMessageAvailable(uint32* pcubMsgSize) = 0;
// fills the provided buffer with the first message in the queue and returns k_EGCResultOK or
// returns k_EGCResultNoMessage if there is no message waiting. pcubMsgSize is filled with the message size.
// If the provided buffer is not large enough to fit the entire message, k_EGCResultBufferTooSmall is returned
// and the message remains at the head of the queue.
virtual EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
virtual EGCResults RetrieveMessage(uint32* punMsgType, void* pubDest, uint32 cubDest, uint32* pcubMsgSize) = 0;
};
#define STEAMGAMECOORDINATOR_INTERFACE_VERSION "SteamGameCoordinator001"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#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
struct GCMessageAvailable_t
{
struct GCMessageAvailable_t {
enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 1 };
uint32 m_nMessageSize;
};
// callback notification - A message failed to make it to the GC. It may be down temporarily
struct GCMessageFailed_t
{
struct GCMessageFailed_t {
enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 2 };
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMGAMECOORDINATOR

View File

@ -15,38 +15,36 @@
//-----------------------------------------------------------------------------
// Purpose: Functions for authenticating users via Steam to play on a game server
//-----------------------------------------------------------------------------
class ISteamGameServer
{
class ISteamGameServer {
public:
//
// Basic server data. These properties, if set, must be set before before calling LogOn. They
// may not be changed after logged in.
//
//
// Basic server data. These properties, if set, must be set before before calling LogOn. They
// may not be changed after logged in.
//
/// This is called by SteamGameServer_Init, and you will usually not need to call it directly
STEAM_PRIVATE_API( virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; )
STEAM_PRIVATE_API(virtual bool InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char* pchVersionString) = 0;)
/// Game product identifier. This is currently used by the master server for version checking purposes.
/// It's a required field, but will eventually will go away, and the AppID will be used for this purpose.
virtual void SetProduct( const char *pszProduct ) = 0;
virtual void SetProduct(const char* pszProduct) = 0;
/// Description of the game. This is a required field and is displayed in the steam server browser....for now.
/// This is a required field, but it will go away eventually, as the data should be determined from the AppID.
virtual void SetGameDescription( const char *pszGameDescription ) = 0;
virtual void SetGameDescription(const char* pszGameDescription) = 0;
/// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning
/// this application is the original game, not a mod.
///
/// @see k_cbMaxGameServerGameDir
virtual void SetModDir( const char *pszModDir ) = 0;
virtual void SetModDir(const char* pszModDir) = 0;
/// Is this is a dedicated server? The default value is false.
virtual void SetDedicatedServer( bool bDedicated ) = 0;
virtual void SetDedicatedServer(bool bDedicated) = 0;
//
// Login
//
//
// Login
//
/// Begin process to login to a persistent game server account
///
@ -54,7 +52,7 @@ public:
/// @see SteamServersConnected_t
/// @see SteamServerConnectFailure_t
/// @see SteamServersDisconnected_t
virtual void LogOn( const char *pszToken ) = 0;
virtual void LogOn(const char* pszToken) = 0;
/// Login to a generic, anonymous account.
///
@ -74,49 +72,49 @@ public:
/// Only returns true once per request.
virtual bool WasRestartRequested() = 0;
//
// Server state. These properties may be changed at any time.
//
//
// Server state. These properties may be changed at any time.
//
/// Max player count that will be reported to server browser and client queries
virtual void SetMaxPlayerCount( int cPlayersMax ) = 0;
virtual void SetMaxPlayerCount(int cPlayersMax) = 0;
/// Number of bots. Default value is zero
virtual void SetBotPlayerCount( int cBotplayers ) = 0;
virtual void SetBotPlayerCount(int cBotplayers) = 0;
/// Set the name of server as it will appear in the server browser
///
/// @see k_cbMaxGameServerName
virtual void SetServerName( const char *pszServerName ) = 0;
virtual void SetServerName(const char* pszServerName) = 0;
/// Set name of map to report in the server browser
///
/// @see k_cbMaxGameServerName
virtual void SetMapName( const char *pszMapName ) = 0;
virtual void SetMapName(const char* pszMapName) = 0;
/// Let people know if your server will require a password
virtual void SetPasswordProtected( bool bPasswordProtected ) = 0;
virtual void SetPasswordProtected(bool bPasswordProtected) = 0;
/// Spectator server. The default value is zero, meaning the service
/// is not used.
virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0;
virtual void SetSpectatorPort(uint16 unSpectatorPort) = 0;
/// Name of the spectator server. (Only used if spectator port is nonzero.)
///
/// @see k_cbMaxGameServerMapName
virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0;
virtual void SetSpectatorServerName(const char* pszSpectatorServerName) = 0;
/// Call this to clear the whole list of key/values that are sent in rules queries.
virtual void ClearAllKeyValues() = 0;
/// Call this to add/update a key/value pair.
virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0;
virtual void SetKeyValue(const char* pKey, const char* pValue) = 0;
/// Sets a string defining the "gametags" for this server, this is optional, but if it is set
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
///
/// @see k_cbMaxGameServerTags
virtual void SetGameTags( const char *pchGameTags ) = 0;
virtual void SetGameTags(const char* pchGameTags) = 0;
/// Sets a string defining the "gamedata" for this server, this is optional, but if it is set
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
@ -124,14 +122,14 @@ public:
/// acknowledged)
///
/// @see k_cbMaxGameServerGameData
virtual void SetGameData( const char *pchGameData ) = 0;
virtual void SetGameData(const char* pchGameData) = 0;
/// Region identifier. This is an optional field, the default value is empty, meaning the "world" region
virtual void SetRegion( const char *pszRegion ) = 0;
virtual void SetRegion(const char* pszRegion) = 0;
//
// Player list management / authentication
//
//
// Player list management / authentication
//
// Handles receiving a new connection from a Steam user. This call will ask the Steam
// servers to validate the users identity, app ownership, and VAC status. If the Steam servers
@ -142,7 +140,7 @@ public:
// Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL
// If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication
// for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)
virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0;
virtual bool SendUserConnectAndAuthenticate(uint32 unIPClient, const void* pvAuthBlob, uint32 cubAuthBlobSize, CSteamID* pSteamIDUser) = 0;
// Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.
//
@ -153,45 +151,44 @@ public:
// Should be called whenever a user leaves our game server, this lets Steam internally
// track which users are currently on which servers for the purposes of preventing a single
// account being logged into multiple servers, showing who is currently on a server, etc.
virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0;
virtual void SendUserDisconnect(CSteamID steamIDUser) = 0;
// Update the data to be displayed in the server browser and matchmaking interfaces for a user
// currently connected to the server. For regular users you must call this after you receive a
// GSUserValidationSuccess callback.
//
// Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)
virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0;
virtual bool BUpdateUserData(CSteamID steamIDUser, const char* pchPlayerName, uint32 uScore) = 0;
// New auth system APIs - do not mix with the old auth system APIs.
// ----------------------------------------------------------------
// Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).
// pcbTicket retrieves the length of the actual ticket.
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
virtual HAuthTicket GetAuthSessionTicket(void* pTicket, int cbMaxTicket, uint32* pcbTicket) = 0;
// Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
virtual EBeginAuthSessionResult BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, CSteamID steamID) = 0;
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
virtual void EndAuthSession( CSteamID steamID ) = 0;
virtual void EndAuthSession(CSteamID steamID) = 0;
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
virtual void CancelAuthTicket(HAuthTicket hAuthTicket) = 0;
// After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function
// to determine if the user owns downloadable content specified by the provided AppID.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
virtual EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID) = 0;
// Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t
// returns false if we're not connected to the steam servers and thus cannot ask
virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0;
virtual bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) = 0;
// 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;
STEAM_CALL_RESULT( GSReputation_t )
virtual void GetGameplayStats() = 0;
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
@ -199,12 +196,12 @@ public:
// connect to
virtual SteamIPAddress_t GetPublicIP() = 0;
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages
// back and forth. This prevents us from requiring server ops to open up yet another port
// in their firewalls.
//
// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages
// back and forth. This prevents us from requiring server ops to open up yet another port
// in their firewalls.
//
// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001
// These are used when you've elected to multiplex the game server's UDP socket
// rather than having the master server updater use its own sockets.
@ -214,78 +211,71 @@ public:
// Call this when a packet that starts with 0xFFFFFFFF comes in. That means
// it's for us.
virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0;
virtual bool HandleIncomingPacket(const void* pData, int cbData, uint32 srcIP, uint16 srcPort) = 0;
// AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.
// This gets a packet that the master server updater needs to send out on UDP.
// It returns the length of the packet it wants to send, or 0 if there are no more packets to send.
// Call this each frame until it returns 0.
virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0;
virtual int GetNextOutgoingPacket(void* pOut, int cbMaxOut, uint32* pNetAdr, uint16* pPort) = 0;
//
// Control heartbeats / advertisement with master server
//
//
// Control heartbeats / advertisement with master server
//
// Call this as often as you like to tell the master server updater whether or not
// you want it to be active (default: off).
virtual void EnableHeartbeats( bool bActive ) = 0;
virtual void EnableHeartbeats(bool bActive) = 0;
// You usually don't need to modify this.
// Pass -1 to use the default value for iHeartbeatInterval.
// Some mods change this.
virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0;
virtual void SetHeartbeatInterval(int iHeartbeatInterval) = 0;
// Force a heartbeat to steam at the next opportunity
virtual void ForceHeartbeat() = 0;
// associate this game server with this clan for the purposes of computing player compat
STEAM_CALL_RESULT( AssociateWithClanResult_t )
virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0;
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
STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0;
STEAM_CALL_RESULT(ComputeNewPlayerCompatibilityResult_t)
virtual SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) = 0;
};
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer013"
// Global accessor
inline ISteamGameServer *SteamGameServer();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamGameServer *, SteamGameServer, STEAMGAMESERVER_INTERFACE_VERSION );
inline ISteamGameServer* SteamGameServer();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(ISteamGameServer*, SteamGameServer, STEAMGAMESERVER_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// client has been approved to connect to this game server
struct GSClientApprove_t
{
struct GSClientApprove_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 1 };
CSteamID m_SteamID; // SteamID of approved player
CSteamID m_OwnerSteamID; // SteamID of original owner for game license
};
// client has been denied to connection to this game server
struct GSClientDeny_t
{
struct GSClientDeny_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 2 };
CSteamID m_SteamID;
EDenyReason m_eDenyReason;
char m_rgchOptionalText[128];
};
// request the game server should kick the user
struct GSClientKick_t
{
struct GSClientKick_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 3 };
CSteamID m_SteamID;
EDenyReason m_eDenyReason;
@ -294,10 +284,8 @@ struct GSClientKick_t
// NOTE: callback values 4 and 5 are skipped because they are used for old deprecated callbacks,
// do not reuse them here.
// client achievement info
struct GSClientAchievementStatus_t
{
struct GSClientAchievementStatus_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 6 };
uint64 m_SteamID;
char m_pchAchievement[128];
@ -306,15 +294,13 @@ struct GSClientAchievementStatus_t
// received when the game server requests to be displayed as secure (VAC protected)
// m_bSecure is true if the game server should display itself as secure to users, false otherwise
struct GSPolicyResponse_t
{
struct GSPolicyResponse_t {
enum { k_iCallback = k_iSteamUserCallbacks + 15 };
uint8 m_bSecure;
};
// GS gameplay stats info
struct GSGameplayStats_t
{
struct GSGameplayStats_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 7 };
EResult m_eResult; // Result of the call
int32 m_nRank; // Overall rank of the server (0-based)
@ -323,8 +309,7 @@ struct GSGameplayStats_t
};
// send as a reply to RequestUserGroupStatus()
struct GSClientGroupStatus_t
{
struct GSClientGroupStatus_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 8 };
CSteamID m_SteamIDUser;
CSteamID m_SteamIDGroup;
@ -333,8 +318,7 @@ struct GSClientGroupStatus_t
};
// Sent as a reply to GetServerReputation()
struct GSReputation_t
{
struct GSReputation_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 9 };
EResult m_eResult; // Result of the call;
uint32 m_unReputationScore; // The reputation score for the game server
@ -353,15 +337,13 @@ struct GSReputation_t
};
// Sent as a reply to AssociateWithClan()
struct AssociateWithClanResult_t
{
struct AssociateWithClanResult_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 10 };
EResult m_eResult; // Result of the call;
};
// Sent as a reply to ComputeNewPlayerCompatibility()
struct ComputeNewPlayerCompatibilityResult_t
{
struct ComputeNewPlayerCompatibilityResult_t {
enum { k_iCallback = k_iSteamGameServerCallbacks + 11 };
EResult m_eResult; // Result of the call;
int m_cPlayersThatDontLikeCandidate;
@ -370,7 +352,6 @@ struct ComputeNewPlayerCompatibilityResult_t
CSteamID m_SteamIDCandidate;
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMGAMESERVER_H

View File

@ -15,41 +15,40 @@
//-----------------------------------------------------------------------------
// Purpose: Functions for authenticating users via Steam to play on a game server
//-----------------------------------------------------------------------------
class ISteamGameServerStats
{
class ISteamGameServerStats {
public:
// downloads stats for the user
// returns a GSStatsReceived_t callback when completed
// 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
STEAM_CALL_RESULT( GSStatsReceived_t )
virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0;
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()
STEAM_FLAT_NAME( GetUserStatInt32 )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0;
STEAM_FLAT_NAME(GetUserStatInt32)
virtual bool GetUserStat(CSteamID steamIDUser, const char* pchName, int32* pData) = 0;
STEAM_FLAT_NAME( GetUserStatFloat )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0;
STEAM_FLAT_NAME(GetUserStatFloat)
virtual bool GetUserStat(CSteamID steamIDUser, const char* pchName, float* pData) = 0;
virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0;
virtual bool GetUserAchievement(CSteamID steamIDUser, const char* pchName, bool* pbAchieved) = 0;
// Set / update stats and achievements.
// Note: These updates will work only on stats game servers are allowed to edit and only for
// game servers that have been declared as officially controlled by the game creators.
// Set the IP range of your official servers on the Steamworks page
STEAM_FLAT_NAME( SetUserStatInt32 )
virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, int32 nData ) = 0;
STEAM_FLAT_NAME(SetUserStatInt32)
virtual bool SetUserStat(CSteamID steamIDUser, const char* pchName, int32 nData) = 0;
STEAM_FLAT_NAME( SetUserStatFloat )
virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, float fData ) = 0;
STEAM_FLAT_NAME(SetUserStatFloat)
virtual bool SetUserStat(CSteamID steamIDUser, const char* pchName, float fData) = 0;
virtual bool UpdateUserAvgRateStat( CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength ) = 0;
virtual bool UpdateUserAvgRateStat(CSteamID steamIDUser, const char* pchName, float flCountThisSession, double dSessionLength) = 0;
virtual bool SetUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0;
virtual bool ClearUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0;
virtual bool SetUserAchievement(CSteamID steamIDUser, const char* pchName) = 0;
virtual bool ClearUserAchievement(CSteamID steamIDUser, const char* pchName) = 0;
// Store the current data on the server, will get a GSStatsStored_t callback when set.
//
@ -57,21 +56,20 @@ 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.
STEAM_CALL_RESULT( GSStatsStored_t )
virtual SteamAPICall_t StoreUserStats( CSteamID steamIDUser ) = 0;
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 );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -80,19 +78,16 @@ STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamGameServerStats *, SteamGameSe
// Purpose: called when the latests stats and achievements have been received
// from the server
//-----------------------------------------------------------------------------
struct GSStatsReceived_t
{
struct GSStatsReceived_t {
enum { k_iCallback = k_iSteamGameServerStatsCallbacks };
EResult m_eResult; // Success / error fetching the stats
CSteamID m_steamIDUser; // The user for whom the stats are retrieved for
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the user stats for a game
//-----------------------------------------------------------------------------
struct GSStatsStored_t
{
struct GSStatsStored_t {
enum { k_iCallback = k_iSteamGameServerStatsCallbacks + 1 };
EResult m_eResult; // success / error
CSteamID m_steamIDUser; // The user for whom the stats were stored
@ -102,13 +97,11 @@ struct GSStatsStored_t
// Purpose: Callback indicating that a user's stats have been unloaded.
// Call RequestUserStats again to access stats for this user
//-----------------------------------------------------------------------------
struct GSStatsUnloaded_t
{
struct GSStatsUnloaded_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 };
CSteamID m_steamIDUser; // User whose stats have been unloaded
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMGAMESERVERSTATS_H

View File

@ -18,10 +18,9 @@ const uint32 INVALID_HTMLBROWSER = 0;
//-----------------------------------------------------------------------------
// Purpose: Functions for displaying HTML pages and interacting with them
//-----------------------------------------------------------------------------
class ISteamHTMLSurface
{
class ISteamHTMLSurface {
public:
virtual ~ISteamHTMLSurface() {}
virtual ~ISteamHTMLSurface() { }
// Must call init and shutdown when starting/ending use of the interface
virtual bool Init() = 0;
@ -40,50 +39,48 @@ public:
// not implement these callback handlers, the browser may appear to hang instead of
// navigating to new pages or triggering javascript popups.
//
STEAM_CALL_RESULT( HTML_BrowserReady_t )
virtual SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS ) = 0;
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
virtual void RemoveBrowser( HHTMLBrowser unBrowserHandle ) = 0;
virtual void RemoveBrowser(HHTMLBrowser unBrowserHandle) = 0;
// Navigate to this URL, results in a HTML_StartRequest_t as the request commences
virtual void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchPostData ) = 0;
virtual void LoadURL(HHTMLBrowser unBrowserHandle, const char* pchURL, const char* pchPostData) = 0;
// Tells the surface the size in pixels to display the surface
virtual void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight ) = 0;
virtual void SetSize(HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight) = 0;
// Stop the load of the current html page
virtual void StopLoad( HHTMLBrowser unBrowserHandle ) = 0;
virtual void StopLoad(HHTMLBrowser unBrowserHandle) = 0;
// Reload (most likely from local cache) the current page
virtual void Reload( HHTMLBrowser unBrowserHandle ) = 0;
virtual void Reload(HHTMLBrowser unBrowserHandle) = 0;
// navigate back in the page history
virtual void GoBack( HHTMLBrowser unBrowserHandle ) = 0;
virtual void GoBack(HHTMLBrowser unBrowserHandle) = 0;
// navigate forward in the page history
virtual void GoForward( HHTMLBrowser unBrowserHandle ) = 0;
virtual void GoForward(HHTMLBrowser unBrowserHandle) = 0;
// add this header to any url requests from this browser
virtual void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue ) = 0;
virtual void AddHeader(HHTMLBrowser unBrowserHandle, const char* pchKey, const char* pchValue) = 0;
// run this javascript script in the currently loaded page
virtual void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript ) = 0;
virtual void ExecuteJavascript(HHTMLBrowser unBrowserHandle, const char* pchScript) = 0;
enum EHTMLMouseButton
{
enum EHTMLMouseButton {
eHTMLMouseButton_Left = 0,
eHTMLMouseButton_Right = 1,
eHTMLMouseButton_Middle = 2,
};
// Mouse click and mouse movement commands
virtual void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
virtual void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
virtual void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
virtual void MouseUp(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton) = 0;
virtual void MouseDown(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton) = 0;
virtual void MouseDoubleClick(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton) = 0;
// x and y are relative to the HTML bounds
virtual void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
virtual void MouseMove(HHTMLBrowser unBrowserHandle, int x, int y) = 0;
// nDelta is pixels of scroll
virtual void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta ) = 0;
virtual void MouseWheel(HHTMLBrowser unBrowserHandle, int32 nDelta) = 0;
enum EMouseCursor
{
enum EMouseCursor {
dc_user = 0,
dc_none,
dc_arrow,
@ -129,8 +126,7 @@ public:
dc_last, // custom cursors start from this value and up
};
enum EHTMLKeyModifiers
{
enum EHTMLKeyModifiers {
k_eHTMLKeyModifier_None = 0,
k_eHTMLKeyModifier_AltDown = 1 << 0,
k_eHTMLKeyModifier_CtrlDown = 1 << 1,
@ -139,51 +135,51 @@ public:
// 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;
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;
virtual void KeyChar(HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers) = 0;
// programmatically scroll this many pixels on the page
virtual void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
virtual void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
virtual void SetHorizontalScroll(HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll) = 0;
virtual void SetVerticalScroll(HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll) = 0;
// tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things
virtual void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) = 0;
virtual void SetKeyFocus(HHTMLBrowser unBrowserHandle, bool bHasKeyFocus) = 0;
// open the current pages html code in the local editor of choice, used for debugging
virtual void ViewSource( HHTMLBrowser unBrowserHandle ) = 0;
virtual void ViewSource(HHTMLBrowser unBrowserHandle) = 0;
// copy the currently selected text on the html page to the local clipboard
virtual void CopyToClipboard( HHTMLBrowser unBrowserHandle ) = 0;
virtual void CopyToClipboard(HHTMLBrowser unBrowserHandle) = 0;
// paste from the local clipboard to the current html page
virtual void PasteFromClipboard( HHTMLBrowser unBrowserHandle ) = 0;
virtual void PasteFromClipboard(HHTMLBrowser unBrowserHandle) = 0;
// find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element
virtual void Find( HHTMLBrowser unBrowserHandle, const char *pchSearchStr, bool bCurrentlyInFind, bool bReverse ) = 0;
virtual void Find(HHTMLBrowser unBrowserHandle, const char* pchSearchStr, bool bCurrentlyInFind, bool bReverse) = 0;
// cancel a currently running find
virtual void StopFind( HHTMLBrowser unBrowserHandle ) = 0;
virtual void StopFind(HHTMLBrowser unBrowserHandle) = 0;
// return details about the link at position x,y on the current page
virtual void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
virtual void GetLinkAtPosition(HHTMLBrowser unBrowserHandle, int x, int y) = 0;
// set a webcookie for the hostname in question
virtual void SetCookie( const char *pchHostname, const char *pchKey, const char *pchValue, const char *pchPath = "/", RTime32 nExpires = 0, bool bSecure = false, bool bHTTPOnly = false ) = 0;
virtual void SetCookie(const char* pchHostname, const char* pchKey, const char* pchValue, const char* pchPath = "/", RTime32 nExpires = 0, bool bSecure = false, bool bHTTPOnly = false) = 0;
// Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)
virtual void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) = 0;
virtual void SetPageScaleFactor(HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY) = 0;
// Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are
// more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled,
// all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1".
// When background mode is disabled, any video or audio objects with that property will resume with ".play()".
virtual void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) = 0;
virtual void SetBackgroundMode(HHTMLBrowser unBrowserHandle, bool bBackgroundMode) = 0;
// Scale the output display space by this factor, this is useful when displaying content on high dpi devices.
// Specifies the ratio between physical and logical pixels.
virtual void SetDPIScalingFactor( HHTMLBrowser unBrowserHandle, float flDPIScaling ) = 0;
virtual void SetDPIScalingFactor(HHTMLBrowser unBrowserHandle, float flDPIScaling) = 0;
// Open HTML/JS developer tools
virtual void OpenDeveloperTools( HHTMLBrowser unBrowserHandle ) = 0;
virtual void OpenDeveloperTools(HHTMLBrowser unBrowserHandle) = 0;
// CALLBACKS
//
@ -194,47 +190,45 @@ public:
// Set bAllowed to true to allow this navigation, false to cancel it and stay
// on the current page. You can use this feature to limit the valid pages
// allowed in your HTML surface.
virtual void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed ) = 0;
virtual void AllowStartRequest(HHTMLBrowser unBrowserHandle, bool bAllowed) = 0;
// You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback
// Set bResult to true for the OK option of a confirm, use false otherwise
virtual void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) = 0;
virtual void JSDialogResponse(HHTMLBrowser unBrowserHandle, bool bResult) = 0;
// You MUST call this in response to a HTML_FileOpenDialog_t callback
STEAM_IGNOREATTR()
virtual void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) = 0;
virtual void FileLoadDialogResponse(HHTMLBrowser unBrowserHandle, const char** pchSelectedFiles) = 0;
};
#define STEAMHTMLSURFACE_INTERFACE_VERSION "STEAMHTMLSURFACE_INTERFACE_VERSION_005"
// Global interface accessor
inline ISteamHTMLSurface *SteamHTMLSurface();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamHTMLSurface *, SteamHTMLSurface, STEAMHTMLSURFACE_INTERFACE_VERSION );
inline ISteamHTMLSurface* SteamHTMLSurface();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamHTMLSurface*, SteamHTMLSurface, STEAMHTMLSURFACE_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: The browser is ready for use
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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(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
@ -247,20 +241,18 @@ STEAM_CALLBACK_MEMBER(10, float, flPageScale) // the page scale factor on this p
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
//-----------------------------------------------------------------------------
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(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)
//-----------------------------------------------------------------------------
@ -268,139 +260,125 @@ 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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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)
//-----------------------------------------------------------------------------
// Purpose: show a Javascript alert dialog, call JSDialogResponse
// when the user dismisses this dialog (or right away to ignore it)
//-----------------------------------------------------------------------------
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_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)
//-----------------------------------------------------------------------------
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_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.
//-----------------------------------------------------------------------------
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_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 is being created.
//
@ -410,71 +388,63 @@ STEAM_CALLBACK_END(3)
// 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.
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
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_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
//-----------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( HTML_HideToolTip_t, k_iSteamHTMLSurfaceCallbacks + 26 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
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
//-----------------------------------------------------------------------------
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_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 )
#pragma pack(pop)
#endif // ISTEAMHTMLSURFACE_H

View File

@ -23,144 +23,141 @@ typedef uint32 HTTPCookieContainerHandle;
//-----------------------------------------------------------------------------
// Purpose: interface to http client
//-----------------------------------------------------------------------------
class ISteamHTTP
{
class ISteamHTTP {
public:
// Initializes a new HTTP request, returning a handle to use in further operations on it. Requires
// the method (GET or POST) and the absolute URL for the request. Both http and https are supported,
// so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/
// or such.
virtual HTTPRequestHandle CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL ) = 0;
virtual HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, const char* pchAbsoluteURL) = 0;
// Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after
// sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.
virtual bool SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue ) = 0;
virtual bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, uint64 ulContextValue) = 0;
// Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default
// timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request
// has already been sent.
virtual bool SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds ) = 0;
virtual bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint32 unTimeoutSeconds) = 0;
// Set a request header value for the request, must be called prior to sending the request. Will
// return false if the handle is invalid or the request is already sent.
virtual bool SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, const char *pchHeaderValue ) = 0;
virtual bool SetHTTPRequestHeaderValue(HTTPRequestHandle hRequest, const char* pchHeaderName, const char* pchHeaderValue) = 0;
// Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified
// when creating the request. Must be called prior to sending the request. Will return false if the
// handle is invalid or the request is already sent.
virtual bool SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, const char *pchParamName, const char *pchParamValue ) = 0;
virtual bool SetHTTPRequestGetOrPostParameter(HTTPRequestHandle hRequest, const char* pchParamName, const char* pchParamValue) = 0;
// Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on
// asynchronous response via callback.
//
// Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control
// header and only do a local cache lookup rather than sending any actual remote request.
virtual bool SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0;
virtual bool SendHTTPRequest(HTTPRequestHandle hRequest, SteamAPICall_t* pCallHandle) = 0;
// Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on
// asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and
// HTTPRequestDataReceived_t callbacks while streaming.
virtual bool SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0;
virtual bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, SteamAPICall_t* pCallHandle) = 0;
// Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move
// the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.
virtual bool DeferHTTPRequest( HTTPRequestHandle hRequest ) = 0;
virtual bool DeferHTTPRequest(HTTPRequestHandle hRequest) = 0;
// Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move
// the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.
virtual bool PrioritizeHTTPRequest( HTTPRequestHandle hRequest ) = 0;
virtual bool PrioritizeHTTPRequest(HTTPRequestHandle hRequest) = 0;
// Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also
// returns the size of the header value if present so the caller and allocate a correctly sized buffer for
// GetHTTPResponseHeaderValue.
virtual bool GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const char *pchHeaderName, uint32 *unResponseHeaderSize ) = 0;
virtual bool GetHTTPResponseHeaderSize(HTTPRequestHandle hRequest, const char* pchHeaderName, uint32* unResponseHeaderSize) = 0;
// Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// header is not present or if your buffer is too small to contain it's value. You should first call
// BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.
virtual bool GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, uint8 *pHeaderValueBuffer, uint32 unBufferSize ) = 0;
virtual bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, const char* pchHeaderName, uint8* pHeaderValueBuffer, uint32 unBufferSize) = 0;
// Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// handle is invalid.
virtual bool GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize ) = 0;
virtual bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, uint32* unBodySize) = 0;
// Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out
// the correct buffer size to use.
virtual bool GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0;
virtual bool GetHTTPResponseBodyData(HTTPRequestHandle hRequest, uint8* pBodyDataBuffer, uint32 unBufferSize) = 0;
// Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the
// handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset
// do not match the size and offset sent in HTTPRequestDataReceived_t.
virtual bool GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0;
virtual bool GetHTTPStreamingResponseBodyData(HTTPRequestHandle hRequest, uint32 cOffset, uint8* pBodyDataBuffer, uint32 unBufferSize) = 0;
// Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t
// callback and finishing using the response.
virtual bool ReleaseHTTPRequest( HTTPRequestHandle hRequest ) = 0;
virtual bool ReleaseHTTPRequest(HTTPRequestHandle hRequest) = 0;
// Gets progress on downloading the body for the request. This will be zero unless a response header has already been
// received which included a content-length field. For responses that contain no content-length it will report
// zero for the duration of the request as the size is unknown until the connection closes.
virtual bool GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut ) = 0;
virtual bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, float* pflPercentOut) = 0;
// Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params
// have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType
// parameter will set the content-type header for the request so the server may know how to interpret the body.
virtual bool SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen ) = 0;
virtual bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, const char* pchContentType, uint8* pubBody, uint32 unBodyLen) = 0;
// Creates a cookie container handle which you must later free with ReleaseCookieContainer(). If bAllowResponsesToModify=true
// than any response to your requests using this cookie container may add new cookies which may be transmitted with
// future requests. If bAllowResponsesToModify=false than only cookies you explicitly set will be sent. This API is just for
// during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across
// repeat executions of your process.
virtual HTTPCookieContainerHandle CreateCookieContainer( bool bAllowResponsesToModify ) = 0;
virtual HTTPCookieContainerHandle CreateCookieContainer(bool bAllowResponsesToModify) = 0;
// Release a cookie container you are finished using, freeing it's memory
virtual bool ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer ) = 0;
virtual bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer) = 0;
// Adds a cookie to the specified cookie container that will be used with future requests.
virtual bool SetCookie( HTTPCookieContainerHandle hCookieContainer, const char *pchHost, const char *pchUrl, const char *pchCookie ) = 0;
virtual bool SetCookie(HTTPCookieContainerHandle hCookieContainer, const char* pchHost, const char* pchUrl, const char* pchCookie) = 0;
// Set the cookie container to use for a HTTP request
virtual bool SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer ) = 0;
virtual bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer) = 0;
// 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;
virtual bool SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, const char* pchUserAgentInfo) = 0;
// 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;
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
// which can bump everytime we get more data
virtual bool SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, uint32 unMilliseconds ) = 0;
virtual bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint32 unMilliseconds) = 0;
// Check if the reason the request failed was because we timed it out (rather than some harder failure)
virtual bool GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut ) = 0;
virtual bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, bool* pbWasTimedOut) = 0;
};
#define STEAMHTTP_INTERFACE_VERSION "STEAMHTTP_INTERFACE_VERSION003"
// Global interface accessor
inline ISteamHTTP *SteamHTTP();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamHTTP *, SteamHTTP, STEAMHTTP_INTERFACE_VERSION );
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 );
inline ISteamHTTP* SteamGameServerHTTP();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(ISteamHTTP*, SteamGameServerHTTP, STEAMHTTP_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct HTTPRequestCompleted_t
{
struct HTTPRequestCompleted_t {
enum { k_iCallback = k_iClientHTTPCallbacks + 1 };
// Handle value for the request that has completed.
@ -181,9 +178,7 @@ struct HTTPRequestCompleted_t
uint32 m_unBodySize; // Same as GetHTTPResponseBodySize()
};
struct HTTPRequestHeadersReceived_t
{
struct HTTPRequestHeadersReceived_t {
enum { k_iCallback = k_iClientHTTPCallbacks + 2 };
// Handle value for the request that has received headers.
@ -194,8 +189,7 @@ struct HTTPRequestHeadersReceived_t
uint64 m_ulContextValue;
};
struct HTTPRequestDataReceived_t
{
struct HTTPRequestDataReceived_t {
enum { k_iCallback = k_iClientHTTPCallbacks + 3 };
// Handle value for the request that has received data.
@ -205,7 +199,6 @@ struct HTTPRequestDataReceived_t
// no context value was set.
uint64 m_ulContextValue;
// Offset to provide to GetHTTPStreamingResponseBodyData to get this chunk of data
uint32 m_cOffset;
@ -213,7 +206,6 @@ struct HTTPRequestDataReceived_t
uint32 m_cBytesReceived;
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMHTTP_H

View File

@ -31,8 +31,7 @@
#define STEAM_INPUT_MIN_ANALOG_ACTION_DATA -1.0f
#define STEAM_INPUT_MAX_ANALOG_ACTION_DATA 1.0f
enum EInputSourceMode
{
enum EInputSourceMode {
k_EInputSourceMode_None,
k_EInputSourceMode_Dpad,
k_EInputSourceMode_Buttons,
@ -56,8 +55,7 @@ enum EInputSourceMode
// 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
{
enum EInputActionOrigin {
// Steam Controller
k_EInputActionOrigin_None,
k_EInputActionOrigin_SteamController_A,
@ -258,7 +256,6 @@ enum EInputActionOrigin
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,
@ -411,8 +408,7 @@ enum EInputActionOrigin
k_EInputActionOrigin_MaximumPossibleValue = 32767, // Origins are currently a maximum of 16 bits.
};
enum EXboxOrigin
{
enum EXboxOrigin {
k_EXboxOrigin_A,
k_EXboxOrigin_B,
k_EXboxOrigin_X,
@ -444,14 +440,12 @@ enum EXboxOrigin
k_EXboxOrigin_Count,
};
enum ESteamControllerPad
{
enum ESteamControllerPad {
k_ESteamControllerPad_Left,
k_ESteamControllerPad_Right
};
enum ESteamInputType
{
enum ESteamInputType {
k_ESteamInputType_Unknown,
k_ESteamInputType_SteamController,
k_ESteamInputType_XBox360Controller,
@ -471,8 +465,7 @@ enum ESteamInputType
};
// These values are passed into SetLEDColor
enum ESteamInputLEDFlag
{
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.
@ -483,17 +476,15 @@ enum ESteamInputLEDFlag
// 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 )
#pragma pack(push, 1)
struct InputAnalogActionData_t
{
struct InputAnalogActionData_t {
// Type of data coming from this action, this will match what got specified in the action set
EInputSourceMode eMode;
@ -504,8 +495,7 @@ struct InputAnalogActionData_t
bool bActive;
};
struct InputDigitalActionData_t
{
struct InputDigitalActionData_t {
// The current state of this action; will be true if currently pressed
bool bState;
@ -513,8 +503,7 @@ struct InputDigitalActionData_t
bool bActive;
};
struct InputMotionData_t
{
struct InputMotionData_t {
// Sensor-fused absolute rotation; will drift in heading
float rotQuatX;
float rotQuatY;
@ -532,16 +521,13 @@ struct InputMotionData_t
float rotVelZ;
};
#pragma pack( pop )
#pragma pack(pop)
//-----------------------------------------------------------------------------
// Purpose: Steam Input API
//-----------------------------------------------------------------------------
class ISteamInput
{
class ISteamInput {
public:
// Init and Shutdown must be called when starting/ending use of this interface
virtual bool Init() = 0;
virtual bool Shutdown() = 0;
@ -556,86 +542,86 @@ public:
// 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( STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_COUNT, Receives list of connected controllers ) InputHandle_t *handlesOut ) = 0;
virtual int GetConnectedControllers(STEAM_OUT_ARRAY_COUNT(STEAM_INPUT_MAX_COUNT, Receives list of connected controllers) 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;
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;
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 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;
// Enumerate currently active layers.
// handlesOut should point to a STEAM_INPUT_MAX_ACTIVE_LAYERS sized array of ControllerActionSetHandle_t handles
// Returns the number of handles written to handlesOut
virtual int GetActiveActionSetLayers( InputHandle_t inputHandle, STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_ACTIVE_LAYERS, Receives list of active layers ) InputActionSetHandle_t *handlesOut ) = 0;
virtual int GetActiveActionSetLayers(InputHandle_t inputHandle, STEAM_OUT_ARRAY_COUNT(STEAM_INPUT_MAX_ACTIVE_LAYERS, Receives list of active layers) 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;
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;
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, STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_ORIGINS, Receives list of action origins ) EInputActionOrigin *originsOut ) = 0;
virtual int GetDigitalActionOrigins(InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, STEAM_OUT_ARRAY_COUNT(STEAM_INPUT_MAX_ORIGINS, Receives list of action origins) 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;
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;
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, STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_ORIGINS, Receives list of action origins ) EInputActionOrigin *originsOut ) = 0;
virtual int GetAnalogActionOrigins(InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, STEAM_OUT_ARRAY_COUNT(STEAM_INPUT_MAX_ORIGINS, Receives list of action origins) EInputActionOrigin* originsOut) = 0;
// Get a local path to art for on-screen glyph for a particular origin
virtual const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) = 0;
virtual const char* GetGlyphForActionOrigin(EInputActionOrigin eOrigin) = 0;
// Returns a localized string (from Steam's language setting) for the specified origin.
virtual const char *GetStringForActionOrigin( EInputActionOrigin eOrigin ) = 0;
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;
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;
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;
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;
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;
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;
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
@ -643,46 +629,46 @@ public:
// 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;
virtual bool ShowBindingPanel(InputHandle_t inputHandle) = 0;
// Returns the input type for a particular handle - unlike EInputActionOrigin which update with Steam and may return unrecognized values
// ESteamInputType will remain static and only return valid values from your SDK version
virtual ESteamInputType GetInputTypeForHandle( InputHandle_t inputHandle ) = 0;
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;
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;
virtual int GetGamepadIndexForController(InputHandle_t ulinputHandle) = 0;
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin.
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
virtual const char* GetStringForXboxOrigin(EXboxOrigin eOrigin) = 0;
// Get a local path to art for on-screen glyph for a particular Xbox controller origin
virtual const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) = 0;
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;
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 and the closest origin that your version of the SDK recognized 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;
virtual EInputActionOrigin TranslateActionOrigin(ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin) = 0;
// Get the binding revision for a given device. Returns false if the handle was not valid or if a mapping is not yet loaded for the device
virtual bool GetDeviceBindingRevision( InputHandle_t inputHandle, int *pMajor, int *pMinor ) = 0;
virtual bool GetDeviceBindingRevision(InputHandle_t inputHandle, int* pMajor, int* pMinor) = 0;
// Get the Steam Remote Play session ID associated with a device, or 0 if there is no session associated with it
// See isteamremoteplay.h for more information on Steam Remote Play sessions
virtual uint32 GetRemotePlaySessionID( InputHandle_t inputHandle ) = 0;
virtual uint32 GetRemotePlaySessionID(InputHandle_t inputHandle) = 0;
};
#define STEAMINPUT_INTERFACE_VERSION "SteamInput002"
// Global interface accessor
inline ISteamInput *SteamInput();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamInput *, SteamInput, STEAMINPUT_INTERFACE_VERSION );
inline ISteamInput* SteamInput();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamInput*, SteamInput, STEAMINPUT_INTERFACE_VERSION);
#endif // ISTEAMINPUT_H

View File

@ -13,15 +13,14 @@
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// Every individual instance of an item has a globally-unique ItemInstanceID.
// This ID is unique to the combination of (player, specific item instance)
// and will not be transferred to another player or re-used for another item.
@ -35,9 +34,7 @@ static const SteamItemInstanceID_t k_SteamItemInstanceIDInvalid = (SteamItemInst
// reserved for internal Steam use.
typedef int32 SteamItemDef_t;
enum ESteamItemFlags
{
enum ESteamItemFlags {
// Item status flags - these flags are permanently attached to specific item instances
k_ESteamItemNoTrade = 1 << 0, // This item is account-locked and cannot be traded or given away.
@ -49,8 +46,7 @@ enum ESteamItemFlags
// Do not assume anything about the state of other flags which are not defined here.
};
struct SteamItemDetails_t
{
struct SteamItemDetails_t {
SteamItemInstanceID_t m_itemId;
SteamItemDef_t m_iDefinition;
uint16 m_unQuantity;
@ -67,10 +63,8 @@ const SteamInventoryUpdateHandle_t k_SteamInventoryUpdateHandleInvalid = 0xfffff
//-----------------------------------------------------------------------------
// Purpose: Steam Inventory query and manipulation API
//-----------------------------------------------------------------------------
class ISteamInventory
{
class ISteamInventory {
public:
// INVENTORY ASYNC RESULT MANAGEMENT
//
// Asynchronous inventory queries always output a result handle which can be used with
@ -87,14 +81,15 @@ public:
// k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits
// k_EResultFail - ERROR: unknown / generic error
STEAM_METHOD_DESC(Find out the status of an asynchronous inventory result handle.)
virtual EResult GetResultStatus( SteamInventoryResult_t resultHandle ) = 0;
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.
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,
STEAM_OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray,
uint32 *punOutItemsArraySize ) = 0;
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,
STEAM_OUT_ARRAY_COUNT(punOutItemsArraySize, Output array) SteamItemDetails_t* pOutItemsArray,
uint32* punOutItemsArraySize)
= 0;
// In combination with GetResultItems, you can use GetResultItemProperty to retrieve
// dynamic string properties for a given item returned in the result set.
@ -108,26 +103,26 @@ public:
// suggested buffer size. Otherwise it will be the number of bytes actually copied
// to pchValueBuffer. If the results do not fit in the given buffer, partial
// results may be copied.
virtual bool GetResultItemProperty( SteamInventoryResult_t resultHandle,
virtual bool GetResultItemProperty(SteamInventoryResult_t resultHandle,
uint32 unItemIndex,
const char *pchPropertyName,
STEAM_OUT_STRING_COUNT( punValueBufferSizeOut ) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
const char* pchPropertyName,
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.
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;
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.
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;
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.
STEAM_METHOD_DESC(Destroys a result handle and frees all associated memory.)
virtual void DestroyResult( SteamInventoryResult_t resultHandle ) = 0;
virtual void DestroyResult(SteamInventoryResult_t resultHandle) = 0;
// INVENTORY ASYNC QUERY
//
@ -140,8 +135,7 @@ public:
// this function only when you are about to display the user's full inventory,
// or if you expect that the inventory may have changed.
STEAM_METHOD_DESC(Captures the entire state of the current users Steam inventory.)
virtual bool GetAllItems( SteamInventoryResult_t *pResultHandle ) = 0;
virtual bool GetAllItems(SteamInventoryResult_t* pResultHandle) = 0;
// Captures the state of a subset of the current user's Steam inventory,
// identified by an array of item instance IDs. The results from this call
@ -151,8 +145,7 @@ public:
// currently equipped cosmetic items and serialize this to a buffer, and
// then transmit this buffer to other players upon joining a game.
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;
virtual bool GetItemsByID(SteamInventoryResult_t* pResultHandle, STEAM_ARRAY_COUNT(unCountInstanceIDs) const SteamItemInstanceID_t* pInstanceIDs, uint32 unCountInstanceIDs) = 0;
// RESULT SERIALIZATION AND AUTHENTICATION
//
@ -169,7 +162,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, STEAM_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,8 +180,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, STEAM_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,27 +191,27 @@ 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, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_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.
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;
virtual bool GrantPromoItems(SteamInventoryResult_t* pResultHandle) = 0;
// AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of
// scanning for all eligible promotional items, the check is restricted to a single item
// 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, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength ) = 0;
virtual bool AddPromoItem(SteamInventoryResult_t* pResultHandle, SteamItemDef_t itemDef) = 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.
STEAM_METHOD_DESC(ConsumeItem() removes items from the inventory permanently.)
virtual bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity ) = 0;
virtual bool ConsumeItem(SteamInventoryResult_t* pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity) = 0;
// ExchangeItems() is an atomic combination of item generation and consumption.
// It can be used to implement crafting recipes or transmutations, or items which unpack
@ -229,23 +221,22 @@ public:
// Exchange recipes are evaluated atomically by the Inventory Service; if the supplied
// components do not match the recipe, or do not contain sufficient quantity, the
// exchange will fail.
virtual bool ExchangeItems( SteamInventoryResult_t *pResultHandle,
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;
virtual bool ExchangeItems(SteamInventoryResult_t* pResultHandle,
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
// quantity greater than one). It can be used to split a stack into two, or to transfer
// quantity from one stack into another stack of identical items. To split one stack into
// two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.
virtual bool TransferItemQuantity( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest ) = 0;
virtual bool TransferItemQuantity(SteamInventoryResult_t* pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest) = 0;
// TIMED DROPS AND PLAYTIME CREDIT
//
// Deprecated. Calling this method is not required for proper playtime accounting.
STEAM_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
@ -258,14 +249,13 @@ public:
// See your Steamworks configuration to set playtime drop rates for individual itemdefs.
// The client library will suppress too-frequent calls to this method.
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;
virtual bool TriggerItemDrop(SteamInventoryResult_t* pResultHandle, SteamItemDef_t dropListDefinition) = 0;
// Deprecated. This method is not supported.
virtual bool TradeItems( SteamInventoryResult_t *pResultHandle, CSteamID steamIDTradePartner,
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;
virtual bool TradeItems(SteamInventoryResult_t* pResultHandle, CSteamID steamIDTradePartner,
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
//
@ -290,8 +280,9 @@ 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(
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;
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
@ -302,33 +293,35 @@ public:
// suggested buffer size. Otherwise it will be the number of bytes actually copied
// 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,
STEAM_OUT_STRING_COUNT(punValueBufferSizeOut) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
virtual bool GetItemDefinitionProperty(SteamItemDef_t iDefinition, const char* pchPropertyName,
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.
STEAM_CALL_RESULT( SteamInventoryEligiblePromoItemDefIDs_t )
virtual SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID ) = 0;
STEAM_CALL_RESULT(SteamInventoryEligiblePromoItemDefIDs_t)
virtual SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs(CSteamID steamID) = 0;
// After handling a SteamInventoryEligiblePromoItemDefIDs_t call result, use this
// function to pull out the list of item definition ids that the user can be
// manually granted via the AddPromoItems() call.
virtual bool GetEligiblePromoItemDefinitionIDs(
CSteamID steamID,
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;
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.
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;
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
STEAM_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.
@ -343,54 +336,52 @@ public:
// 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 *pCurrentPrice, uint64 *pBasePrice ) = 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;
// Remove the property on the item
virtual bool RemoveProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName ) = 0;
virtual bool RemoveProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char* pchPropertyName) = 0;
// Accessor methods to set properties on items
STEAM_FLAT_NAME( SetPropertyString )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, const char *pchPropertyValue ) = 0;
STEAM_FLAT_NAME(SetPropertyString)
virtual bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char* pchPropertyName, const char* pchPropertyValue) = 0;
STEAM_FLAT_NAME( SetPropertyBool )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, bool bValue ) = 0;
STEAM_FLAT_NAME(SetPropertyBool)
virtual bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char* pchPropertyName, bool bValue) = 0;
STEAM_FLAT_NAME( SetPropertyInt64 )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, int64 nValue ) = 0;
STEAM_FLAT_NAME(SetPropertyInt64)
virtual bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char* pchPropertyName, int64 nValue) = 0;
STEAM_FLAT_NAME( SetPropertyFloat )
virtual bool SetProperty( SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char *pchPropertyName, float flValue ) = 0;
STEAM_FLAT_NAME(SetPropertyFloat)
virtual bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char* pchPropertyName, float flValue) = 0;
// Submit the update request by handle
virtual bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle, SteamInventoryResult_t * pResultHandle ) = 0;
virtual bool SubmitUpdateProperties(SteamInventoryUpdateHandle_t handle, SteamInventoryResult_t* pResultHandle) = 0;
STEAM_METHOD_DESC(Look up the given token and return a pseudo-Inventory item.)
virtual bool InspectItem( SteamInventoryResult_t *pResultHandle, const char *pchItemToken ) = 0;
STEAM_METHOD_DESC(Look up the given token and return a pseudo - Inventory item.)
virtual bool InspectItem(SteamInventoryResult_t* pResultHandle, const char* pchItemToken) = 0;
};
#define STEAMINVENTORY_INTERFACE_VERSION "STEAMINVENTORY_INTERFACE_V003"
// Global interface accessor
inline ISteamInventory *SteamInventory();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamInventory *, SteamInventory, STEAMINVENTORY_INTERFACE_VERSION );
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 );
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
// always be exactly one callback per handle.
struct SteamInventoryResultReady_t
{
struct SteamInventoryResultReady_t {
enum { k_iCallback = k_iClientInventoryCallbacks + 0 };
SteamInventoryResult_t m_handle;
EResult m_result;
};
// SteamInventoryFullUpdate_t callbacks are triggered when GetAllItems
// successfully returns a result which is newer / fresher than the last
// known result. (It will not trigger if the inventory hasn't changed,
@ -398,25 +389,21 @@ struct SteamInventoryResultReady_t
// the earlier result is already known to be stale/out-of-date.)
// The normal ResultReady callback will still be triggered immediately
// afterwards; this is an additional notification for your convenience.
struct SteamInventoryFullUpdate_t
{
struct SteamInventoryFullUpdate_t {
enum { k_iCallback = k_iClientInventoryCallbacks + 1 };
SteamInventoryResult_t m_handle;
};
// A SteamInventoryDefinitionUpdate_t callback is triggered whenever
// item definitions have been updated, which could be in response to
// LoadItemDefinitions() or any other async request which required
// a definition update in order to process results from the server.
struct SteamInventoryDefinitionUpdate_t
{
struct SteamInventoryDefinitionUpdate_t {
enum { k_iCallback = k_iClientInventoryCallbacks + 2 };
};
// Returned
struct SteamInventoryEligiblePromoItemDefIDs_t
{
struct SteamInventoryEligiblePromoItemDefIDs_t {
enum { k_iCallback = k_iClientInventoryCallbacks + 3 };
EResult m_result;
CSteamID m_steamID;
@ -425,24 +412,20 @@ struct SteamInventoryEligiblePromoItemDefIDs_t
};
// Triggered from StartPurchase call
struct SteamInventoryStartPurchaseResult_t
{
struct SteamInventoryStartPurchaseResult_t {
enum { k_iCallback = k_iClientInventoryCallbacks + 4 };
EResult m_result;
uint64 m_ulOrderID;
uint64 m_ulTransID;
};
// Triggered from RequestPrices
struct SteamInventoryRequestPricesResult_t
{
struct SteamInventoryRequestPricesResult_t {
enum { k_iCallback = k_iClientInventoryCallbacks + 5 };
EResult m_result;
char m_rgchCurrency[4];
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMCONTROLLER_H

View File

@ -10,13 +10,12 @@
#pragma once
#endif
#include "steam_api_common.h"
#include "matchmakingtypes.h"
#include "isteamfriends.h"
#include "matchmakingtypes.h"
#include "steam_api_common.h"
// lobby type description
enum ELobbyType
{
enum ELobbyType {
k_ELobbyTypePrivate = 0, // only way to join the lobby is to invite to someone else
k_ELobbyTypeFriendsOnly = 1, // shows for friends or invitees, but not in lobby list
k_ELobbyTypePublic = 2, // visible for friends and in lobby list
@ -28,8 +27,7 @@ enum ELobbyType
};
// lobby search filter tools
enum ELobbyComparison
{
enum ELobbyComparison {
k_ELobbyComparisonEqualToOrLessThan = -2,
k_ELobbyComparisonLessThan = -1,
k_ELobbyComparisonEqual = 0,
@ -39,8 +37,7 @@ enum ELobbyComparison
};
// lobby search distance. Lobby results are sorted from closest to farthest.
enum ELobbyDistanceFilter
{
enum ELobbyDistanceFilter {
k_ELobbyDistanceFilterClose, // only lobbies in the same immediate region will be returned
k_ELobbyDistanceFilterDefault, // only lobbies in the same region or near by regions
k_ELobbyDistanceFilterFar, // for games that don't have many latency requirements, will return lobbies about half-way around the globe
@ -54,8 +51,7 @@ enum ELobbyDistanceFilter
// Purpose: Functions for match making services for clients to get to favorites
// and to operate on game lobbies.
//-----------------------------------------------------------------------------
class ISteamMatchmaking
{
class ISteamMatchmaking {
public:
// game server favorites storage
// saves basic details about a multiplayer game server locally
@ -68,13 +64,13 @@ public:
// *pnIP, *pnConnPort are filled in the with IP:port of the game server
// *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections
// *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added
virtual bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0;
virtual bool GetFavoriteGame(int iGame, AppId_t* pnAppID, uint32* pnIP, uint16* pnConnPort, uint16* pnQueryPort, uint32* punFlags, uint32* pRTime32LastPlayedOnServer) = 0;
// adds the game server to the local list; updates the time played of the server if it already exists in the list
virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) = 0;
virtual int AddFavoriteGame(AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer) = 0;
// removes the game server from the local storage; returns true if one was removed
virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
virtual bool RemoveFavoriteGame(AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags) = 0;
///////
// Game lobby functions
@ -103,30 +99,30 @@ public:
}
*/
//
STEAM_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
// these are cleared on each call to RequestLobbyList()
virtual void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pchValueToMatch, ELobbyComparison eComparisonType ) = 0;
virtual void AddRequestLobbyListStringFilter(const char* pchKeyToMatch, const char* pchValueToMatch, ELobbyComparison eComparisonType) = 0;
// numerical comparison
virtual void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType ) = 0;
virtual void AddRequestLobbyListNumericalFilter(const char* pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType) = 0;
// returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence
virtual void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueToBeCloseTo ) = 0;
virtual void AddRequestLobbyListNearValueFilter(const char* pchKeyToMatch, int nValueToBeCloseTo) = 0;
// returns only lobbies with the specified number of slots available
virtual void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable ) = 0;
virtual void AddRequestLobbyListFilterSlotsAvailable(int nSlotsAvailable) = 0;
// sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed)
virtual void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilter ) = 0;
virtual void AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter eLobbyDistanceFilter) = 0;
// sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client
virtual void AddRequestLobbyListResultCountFilter( int cMaxResults ) = 0;
virtual void AddRequestLobbyListResultCountFilter(int cMaxResults) = 0;
virtual void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby ) = 0;
virtual void AddRequestLobbyListCompatibleMembersFilter(CSteamID steamIDLobby) = 0;
// returns the CSteamID of a lobby, as retrieved by a RequestLobbyList call
// should only be called after a LobbyMatchList_t callback is received
// iLobby is of the range [0, LobbyMatchList_t::m_nLobbiesMatching)
// the returned CSteamID::IsValid() will be false if iLobby is out of range
virtual CSteamID GetLobbyByIndex( int iLobby ) = 0;
virtual CSteamID GetLobbyByIndex(int iLobby) = 0;
// Create a lobby on the Steam servers.
// If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID
@ -134,19 +130,19 @@ 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)
STEAM_CALL_RESULT( LobbyCreated_t )
virtual SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers ) = 0;
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
STEAM_CALL_RESULT( LobbyEnter_t )
virtual SteamAPICall_t JoinLobby( CSteamID steamIDLobby ) = 0;
STEAM_CALL_RESULT(LobbyEnter_t)
virtual SteamAPICall_t JoinLobby(CSteamID steamIDLobby) = 0;
// Leave a lobby; this will take effect immediately on the client side
// other users in the lobby will be notified by a LobbyChatUpdate_t callback
virtual void LeaveLobby( CSteamID steamIDLobby ) = 0;
virtual void LeaveLobby(CSteamID steamIDLobby) = 0;
// Invite another user to the lobby
// the target user will receive a LobbyInvite_t callback
@ -154,7 +150,7 @@ public:
// returns false if the local user is not connected to the Steam servers
// if the other user clicks the join link, a GameLobbyJoinRequested_t will be posted if the user is in-game,
// or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id>
virtual bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) = 0;
virtual bool InviteUserToLobby(CSteamID steamIDLobby, CSteamID steamIDInvitee) = 0;
// Lobby iteration, for viewing details of users in a lobby
// only accessible if the lobby user is a member of the specified lobby
@ -162,49 +158,49 @@ public:
// and accessible via ISteamFriends interface
// returns the number of users in the specified lobby
virtual int GetNumLobbyMembers( CSteamID steamIDLobby ) = 0;
virtual int GetNumLobbyMembers(CSteamID steamIDLobby) = 0;
// returns the CSteamID of a user in the lobby
// iMember is of range [0,GetNumLobbyMembers())
// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
virtual CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember ) = 0;
virtual CSteamID GetLobbyMemberByIndex(CSteamID steamIDLobby, int iMember) = 0;
// Get data associated with this lobby
// takes a simple key, and returns the string associated with it
// "" will be returned if no value is set, or if steamIDLobby is invalid
virtual const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0;
virtual const char* GetLobbyData(CSteamID steamIDLobby, const char* pchKey) = 0;
// Sets a key/value pair in the lobby metadata
// each user in the lobby will be broadcast this new value, and any new users joining will receive any existing data
// this can be used to set lobby names, map, etc.
// to reset a key, just set it to ""
// other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback
virtual bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0;
virtual bool SetLobbyData(CSteamID steamIDLobby, const char* pchKey, const char* pchValue) = 0;
// returns the number of metadata keys set on the specified lobby
virtual int GetLobbyDataCount( CSteamID steamIDLobby ) = 0;
virtual int GetLobbyDataCount(CSteamID steamIDLobby) = 0;
// returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount())
virtual bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize ) = 0;
virtual bool GetLobbyDataByIndex(CSteamID steamIDLobby, int iLobbyData, char* pchKey, int cchKeyBufferSize, char* pchValue, int cchValueBufferSize) = 0;
// removes a metadata key from the lobby
virtual bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0;
virtual bool DeleteLobbyData(CSteamID steamIDLobby, const char* pchKey) = 0;
// Gets per-user metadata for someone in this lobby
virtual const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey ) = 0;
virtual const char* GetLobbyMemberData(CSteamID steamIDLobby, CSteamID steamIDUser, const char* pchKey) = 0;
// Sets per-user metadata (for the local user implicitly)
virtual void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0;
virtual void SetLobbyMemberData(CSteamID steamIDLobby, const char* pchKey, const char* pchValue) = 0;
// Broadcasts a chat message to the all the users in the lobby
// users in the lobby (including the local user) will receive a LobbyChatMsg_t callback
// returns true if the message is successfully sent
// pvMsgBody can be binary or text data, up to 4k
// if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator
virtual bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody ) = 0;
virtual bool SendLobbyChatMsg(CSteamID steamIDLobby, const void* pvMsgBody, int cubMsgBody) = 0;
// Get a chat message as specified in a LobbyChatMsg_t callback
// iChatID is the LobbyChatMsg_t::m_iChatID value in the callback
// *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, STEAM_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
@ -213,55 +209,55 @@ public:
// returns false if the local user is not connected to the Steam servers
// results will be returned by a LobbyDataUpdate_t callback
// if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false
virtual bool RequestLobbyData( CSteamID steamIDLobby ) = 0;
virtual bool RequestLobbyData(CSteamID steamIDLobby) = 0;
// sets the game server associated with the lobby
// usually at this point, the users will join the specified game server
// either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect
virtual void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer ) = 0;
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, STEAM_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;
virtual bool SetLobbyMemberLimit(CSteamID steamIDLobby, int cMaxMembers) = 0;
// returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined
virtual int GetLobbyMemberLimit( CSteamID steamIDLobby ) = 0;
virtual int GetLobbyMemberLimit(CSteamID steamIDLobby) = 0;
// updates which type of lobby it is
// only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls
virtual bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType ) = 0;
virtual bool SetLobbyType(CSteamID steamIDLobby, ELobbyType eLobbyType) = 0;
// sets whether or not a lobby is joinable - defaults to true for a new lobby
// if set to false, no user can join, even if they are a friend or have been invited
virtual bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable ) = 0;
virtual bool SetLobbyJoinable(CSteamID steamIDLobby, bool bLobbyJoinable) = 0;
// returns the current lobby owner
// you must be a member of the lobby to access this
// there always one lobby owner - if the current owner leaves, another user will become the owner
// it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner
virtual CSteamID GetLobbyOwner( CSteamID steamIDLobby ) = 0;
virtual CSteamID GetLobbyOwner(CSteamID steamIDLobby) = 0;
// changes who the lobby owner is
// you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby
// after completion, the local user will no longer be the owner
virtual bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner ) = 0;
virtual bool SetLobbyOwner(CSteamID steamIDLobby, CSteamID steamIDNewOwner) = 0;
// link two lobbies for the purposes of checking player compatibility
// you must be the lobby owner of both lobbies
virtual bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent ) = 0;
virtual bool SetLinkedLobby(CSteamID steamIDLobby, CSteamID steamIDLobbyDependent) = 0;
#ifdef _PS3
// changes who the lobby owner is
// you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby
// after completion, the local user will no longer be the owner
virtual void CheckForPSNGameBootInvite( unsigned int iGameBootAttributes ) = 0;
virtual void CheckForPSNGameBootInvite(unsigned int iGameBootAttributes) = 0;
#endif
};
#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking009"
// Global interface accessor
inline ISteamMatchmaking *SteamMatchmaking();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMatchmaking *, SteamMatchmaking, STEAMMATCHMAKING_INTERFACE_VERSION );
inline ISteamMatchmaking* SteamMatchmaking();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamMatchmaking*, SteamMatchmaking, STEAMMATCHMAKING_INTERFACE_VERSION);
//-----------------------------------------------------------------------------
// Callback interfaces for server list functions (see ISteamMatchmakingServers below)
@ -289,20 +285,18 @@ typedef void* HServerListRequest;
// to cancel any in-progress queries so you don't get a callback into the destructed
// object and crash.
//-----------------------------------------------------------------------------
class ISteamMatchmakingServerListResponse
{
class ISteamMatchmakingServerListResponse {
public:
// Server has responded ok with updated data
virtual void ServerResponded( HServerListRequest hRequest, int iServer ) = 0;
virtual void ServerResponded(HServerListRequest hRequest, int iServer) = 0;
// Server has failed to respond
virtual void ServerFailedToRespond( HServerListRequest hRequest, int iServer ) = 0;
virtual void ServerFailedToRespond(HServerListRequest hRequest, int iServer) = 0;
// A list refresh you had initiated is now 100% completed
virtual void RefreshComplete( HServerListRequest hRequest, EMatchMakingServerResponse response ) = 0;
virtual void RefreshComplete(HServerListRequest hRequest, EMatchMakingServerResponse response) = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after pinging an individual server
//
@ -313,17 +307,15 @@ public:
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
class ISteamMatchmakingPingResponse
{
class ISteamMatchmakingPingResponse {
public:
// Server has responded successfully and has updated data
virtual void ServerResponded( gameserveritem_t &server ) = 0;
virtual void ServerResponded(gameserveritem_t& server) = 0;
// Server failed to respond to the ping request
virtual void ServerFailedToRespond() = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after requesting details on
// who is playing on a particular server.
@ -335,12 +327,11 @@ public:
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
class ISteamMatchmakingPlayersResponse
{
class ISteamMatchmakingPlayersResponse {
public:
// Got data on a new player on the server -- you'll get this callback once per player
// on the server which you have requested player data on.
virtual void AddPlayerToList( const char *pchName, int nScore, float flTimePlayed ) = 0;
virtual void AddPlayerToList(const char* pchName, int nScore, float flTimePlayed) = 0;
// The server failed to respond to the request for player details
virtual void PlayersFailedToRespond() = 0;
@ -350,7 +341,6 @@ public:
virtual void PlayersRefreshComplete() = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after requesting rules
// details on a particular server.
@ -362,12 +352,11 @@ public:
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
class ISteamMatchmakingRulesResponse
{
class ISteamMatchmakingRulesResponse {
public:
// Got data on a rule on the server -- you'll get one of these per rule defined on
// the server you are querying
virtual void RulesResponded( const char *pchRule, const char *pchValue ) = 0;
virtual void RulesResponded(const char* pchRule, const char* pchValue) = 0;
// The server failed to respond to the request for rule details
virtual void RulesFailedToRespond() = 0;
@ -377,7 +366,6 @@ public:
virtual void RulesRefreshComplete() = 0;
};
//-----------------------------------------------------------------------------
// Typedef for handle type you will receive when querying details on an individual server.
//-----------------------------------------------------------------------------
@ -387,22 +375,21 @@ const int HSERVERQUERY_INVALID = 0xffffffff;
//-----------------------------------------------------------------------------
// Purpose: Functions for match making services for clients to get to game lists and details
//-----------------------------------------------------------------------------
class ISteamMatchmakingServers
{
class ISteamMatchmakingServers {
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, 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, 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;
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, 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.
virtual void ReleaseRequest( HServerListRequest hServerListRequest ) = 0;
virtual void ReleaseRequest(HServerListRequest hServerListRequest) = 0;
/* the filter operation codes that go in the key part of MatchMakingKeyValuePair_t should be one of these:
@ -477,7 +464,7 @@ public:
// Get details on a given server in the list, you can get the valid range of index
// values by calling GetServerCount(). You will also receive index values in
// ISteamMatchmakingServerListResponse::ServerResponded() callbacks
virtual gameserveritem_t *GetServerDetails( HServerListRequest hRequest, int iServer ) = 0;
virtual gameserveritem_t* GetServerDetails(HServerListRequest hRequest, int iServer) = 0;
// Cancel an request which is operation on the given list type. You should call this to cancel
// any in-progress requests before destructing a callback object that may have been passed
@ -485,60 +472,57 @@ public:
// occurs on the destructed object.
// Canceling a query does not release the allocated request handle.
// The request handle must be released using ReleaseRequest( hRequest )
virtual void CancelQuery( HServerListRequest hRequest ) = 0;
virtual void CancelQuery(HServerListRequest hRequest) = 0;
// Ping every server in your list again but don't update the list of servers
// Query callback installed when the server list was requested will be used
// again to post notifications and RefreshComplete, so the callback must remain
// valid until another RefreshComplete is called on it or the request
// is released with ReleaseRequest( hRequest )
virtual void RefreshQuery( HServerListRequest hRequest ) = 0;
virtual void RefreshQuery(HServerListRequest hRequest) = 0;
// Returns true if the list is currently refreshing its server list
virtual bool IsRefreshing( HServerListRequest hRequest ) = 0;
virtual bool IsRefreshing(HServerListRequest hRequest) = 0;
// How many servers in the given list, GetServerDetails above takes 0... GetServerCount() - 1
virtual int GetServerCount( HServerListRequest hRequest ) = 0;
virtual int GetServerCount(HServerListRequest hRequest) = 0;
// Refresh a single server inside of a query (rather than all the servers )
virtual void RefreshServer( HServerListRequest hRequest, int iServer ) = 0;
virtual void RefreshServer(HServerListRequest hRequest, int iServer) = 0;
//-----------------------------------------------------------------------------
// Queries to individual servers directly via IP/Port
//-----------------------------------------------------------------------------
// Request updated ping time and other details from a single server
virtual HServerQuery PingServer( uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse *pRequestServersResponse ) = 0;
virtual HServerQuery PingServer(uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse* pRequestServersResponse) = 0;
// Request the list of players currently playing on a server
virtual HServerQuery PlayerDetails( uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse *pRequestServersResponse ) = 0;
virtual HServerQuery PlayerDetails(uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse* pRequestServersResponse) = 0;
// Request the list of rules that the server is running (See ISteamGameServer::SetKeyValue() to set the rules server side)
virtual HServerQuery ServerRules( uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse *pRequestServersResponse ) = 0;
virtual HServerQuery ServerRules(uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse* pRequestServersResponse) = 0;
// Cancel an outstanding Ping/Players/Rules query from above. You should call this to cancel
// any in-progress requests before destructing a callback object that may have been passed
// to one of the above calls to avoid crashing when callbacks occur.
virtual void CancelServerQuery( HServerQuery hServerQuery ) = 0;
virtual void CancelServerQuery(HServerQuery hServerQuery) = 0;
};
#define STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION "SteamMatchMakingServers002"
// Global interface accessor
inline ISteamMatchmakingServers *SteamMatchmakingServers();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMatchmakingServers *, SteamMatchmakingServers, STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION );
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
const uint32 k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list
//-----------------------------------------------------------------------------
// Purpose: Used in ChatInfo messages - fields specific to a chat member - must fit in a uint32
//-----------------------------------------------------------------------------
enum EChatMemberStateChange
{
enum EChatMemberStateChange {
// Specific to joining / leaving the chatroom
k_EChatMemberStateChangeEntered = 0x0001, // This user has joined or is joining the chat room
k_EChatMemberStateChangeLeft = 0x0002, // This user has left or is leaving the chat room
@ -548,32 +532,29 @@ enum EChatMemberStateChange
};
// returns true of the flags indicate that a user has been removed from the chat
#define BChatMemberStateChangeRemoved( rgfChatMemberStateChangeFlags ) ( rgfChatMemberStateChangeFlags & ( k_EChatMemberStateChangeDisconnected | k_EChatMemberStateChangeLeft | k_EChatMemberStateChangeKicked | k_EChatMemberStateChangeBanned ) )
#define BChatMemberStateChangeRemoved(rgfChatMemberStateChangeFlags) (rgfChatMemberStateChangeFlags & (k_EChatMemberStateChangeDisconnected | k_EChatMemberStateChangeLeft | k_EChatMemberStateChangeKicked | k_EChatMemberStateChangeBanned))
//-----------------------------------------------------------------------------
// Purpose: Functions for match making services for clients to get to favorites
// and to operate on game lobbies.
//-----------------------------------------------------------------------------
class ISteamGameSearch
{
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;
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;
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;
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
@ -581,7 +562,7 @@ public:
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;
virtual EGameSearchErrorCode_t RetrieveConnectionDetails(CSteamID steamIDHost, char* pchConnectionDetails, int cubConnectionDetails) = 0;
// leaves queue if still waiting
virtual EGameSearchErrorCode_t EndGameSearch() = 0;
@ -590,72 +571,65 @@ public:
// 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;
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;
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;
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;
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;
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;
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 );
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
{
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct SteamPartyBeaconLocation_t
{
struct SteamPartyBeaconLocation_t {
ESteamPartyBeaconLocationType m_eType;
uint64 m_ulLocationID;
};
enum ESteamPartyBeaconLocationData
{
enum ESteamPartyBeaconLocationData {
k_ESteamPartyBeaconLocationDataInvalid = 0,
k_ESteamPartyBeaconLocationDataName = 1,
k_ESteamPartyBeaconLocationDataIconURLSmall = 2,
@ -663,65 +637,61 @@ enum ESteamPartyBeaconLocationData
k_ESteamPartyBeaconLocationDataIconURLLarge = 4,
};
class ISteamParties
{
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;
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;
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;
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;
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;
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;
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;
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;
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;
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 );
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)
@ -729,8 +699,7 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamParties *, SteamParties, STEAMPARTIE
//-----------------------------------------------------------------------------
// Purpose: a server was added/removed from the favorites list, you should refresh now
//-----------------------------------------------------------------------------
struct FavoritesListChanged_t
{
struct FavoritesListChanged_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 2 };
uint32 m_nIP; // an IP of 0 means reload the whole list, any other value means just one server
uint32 m_nQueryPort;
@ -741,7 +710,6 @@ struct FavoritesListChanged_t
AccountID_t m_unAccountId;
};
//-----------------------------------------------------------------------------
// Purpose: Someone has invited you to join a Lobby
// normally you don't need to do anything with this, since
@ -750,8 +718,7 @@ struct FavoritesListChanged_t
// if the user outside a game chooses to join, your game will be launched with the parameter "+connect_lobby <64-bit lobby id>",
// or with the callback GameLobbyJoinRequested_t if they're already in-game
//-----------------------------------------------------------------------------
struct LobbyInvite_t
{
struct LobbyInvite_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 3 };
uint64 m_ulSteamIDUser; // Steam ID of the person making the invite
@ -759,14 +726,12 @@ struct LobbyInvite_t
uint64 m_ulGameID; // GameID of the Lobby
};
//-----------------------------------------------------------------------------
// Purpose: Sent on entering a lobby, or on failing to enter
// m_EChatRoomEnterResponse will be set to k_EChatRoomEnterResponseSuccess on success,
// or a higher value on failure (see enum EChatRoomEnterResponse)
//-----------------------------------------------------------------------------
struct LobbyEnter_t
{
struct LobbyEnter_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 4 };
uint64 m_ulSteamIDLobby; // SteamID of the Lobby you have entered
@ -775,14 +740,12 @@ struct LobbyEnter_t
uint32 m_EChatRoomEnterResponse; // EChatRoomEnterResponse
};
//-----------------------------------------------------------------------------
// Purpose: The lobby metadata has changed
// if m_ulSteamIDMember is the steamID of a lobby member, use GetLobbyMemberData() to access per-user details
// if m_ulSteamIDMember == m_ulSteamIDLobby, use GetLobbyData() to access lobby metadata
//-----------------------------------------------------------------------------
struct LobbyDataUpdate_t
{
struct LobbyDataUpdate_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 5 };
uint64 m_ulSteamIDLobby; // steamID of the Lobby
@ -791,13 +754,11 @@ struct LobbyDataUpdate_t
// will only be false if RequestLobbyData() was called on a lobby that no longer exists
};
//-----------------------------------------------------------------------------
// Purpose: The lobby chat room state has changed
// this is usually sent when a user has joined or left the lobby
//-----------------------------------------------------------------------------
struct LobbyChatUpdate_t
{
struct LobbyChatUpdate_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 6 };
uint64 m_ulSteamIDLobby; // Lobby ID
@ -807,13 +768,11 @@ struct LobbyChatUpdate_t
uint32 m_rgfChatMemberStateChange; // bitfield of EChatMemberStateChange values
};
//-----------------------------------------------------------------------------
// Purpose: A chat message for this lobby has been sent
// use GetLobbyChatEntry( m_iChatID ) to retrieve the contents of this message
//-----------------------------------------------------------------------------
struct LobbyChatMsg_t
{
struct LobbyChatMsg_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 7 };
uint64 m_ulSteamIDLobby; // the lobby id this is in
@ -822,15 +781,13 @@ struct LobbyChatMsg_t
uint32 m_iChatID; // index of the chat entry to lookup
};
//-----------------------------------------------------------------------------
// Purpose: A game created a game for all the members of the lobby to join,
// as triggered by a SetLobbyGameServer()
// it's up to the individual clients to take action on this; the usual
// game behavior is to leave the lobby and connect to the specified game server
//-----------------------------------------------------------------------------
struct LobbyGameCreated_t
{
struct LobbyGameCreated_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 9 };
uint64 m_ulSteamIDLobby; // the lobby we were in
@ -839,39 +796,33 @@ struct LobbyGameCreated_t
uint16 m_usPort;
};
//-----------------------------------------------------------------------------
// Purpose: Number of matching lobbies found
// iterate the returned lobbies with GetLobbyByIndex(), from values 0 to m_nLobbiesMatching-1
//-----------------------------------------------------------------------------
struct LobbyMatchList_t
{
struct LobbyMatchList_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 10 };
uint32 m_nLobbiesMatching; // Number of lobbies that matched search criteria and we have SteamIDs for
};
//-----------------------------------------------------------------------------
// Purpose: posted if a user is forcefully removed from a lobby
// can occur if a user loses connection to Steam
//-----------------------------------------------------------------------------
struct LobbyKicked_t
{
struct LobbyKicked_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 12 };
uint64 m_ulSteamIDLobby; // Lobby
uint64 m_ulSteamIDAdmin; // User who kicked you - possibly the ID of the lobby itself
uint8 m_bKickedDueToDisconnect; // true if you were kicked from the lobby due to the user losing connection to Steam (currently always true)
};
//-----------------------------------------------------------------------------
// Purpose: Result of our request to create a Lobby
// m_eResult == k_EResultOK on success
// at this point, the lobby has been joined and is ready for use
// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
//-----------------------------------------------------------------------------
struct LobbyCreated_t
{
struct LobbyCreated_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 13 };
EResult m_eResult; // k_EResultOK - the lobby was successfully created
@ -887,42 +838,35 @@ struct LobbyCreated_t
// used by now obsolete RequestFriendsLobbiesResponse_t
// enum { k_iCallback = k_iSteamMatchmakingCallbacks + 14 };
//-----------------------------------------------------------------------------
// Purpose: Result of CheckForPSNGameBootInvite
// m_eResult == k_EResultOK on success
// at this point, the local user may not have finishing joining this lobby;
// game code should wait until the subsequent LobbyEnter_t callback is received
//-----------------------------------------------------------------------------
struct PSNGameBootInviteResult_t
{
struct PSNGameBootInviteResult_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 15 };
bool m_bGameBootInviteExists;
CSteamID m_steamIDLobby; // Should be valid if m_bGameBootInviteExists == true
};
//-----------------------------------------------------------------------------
// Purpose: Result of our request to create a Lobby
// m_eResult == k_EResultOK on success
// at this point, the lobby has been joined and is ready for use
// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
//-----------------------------------------------------------------------------
struct FavoritesListAccountsUpdated_t
{
struct FavoritesListAccountsUpdated_t {
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 16 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Callbacks for ISteamGameSearch (which go through the regular Steam callback registration system)
struct SearchForGameProgressCallback_t
{
struct SearchForGameProgressCallback_t {
enum { k_iCallback = k_iSteamGameSearchCallbacks + 1 };
uint64 m_ullSearchID; // all future callbacks referencing this search will include this Search ID
@ -936,8 +880,7 @@ struct SearchForGameProgressCallback_t
};
// notification to all players searching that a game has been found
struct SearchForGameResultCallback_t
{
struct SearchForGameResultCallback_t {
enum { k_iCallback = k_iSteamGameSearchCallbacks + 2 };
uint64 m_ullSearchID;
@ -952,14 +895,12 @@ struct SearchForGameResultCallback_t
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
{
struct RequestPlayersForGameProgressCallback_t {
enum { k_iCallback = k_iSteamGameSearchCallbacks + 11 };
EResult m_eResult; // m_ullSearchID will be non-zero if this is k_EResultOK
@ -969,8 +910,7 @@ struct RequestPlayersForGameProgressCallback_t
// 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
{
struct RequestPlayersForGameResultCallback_t {
enum { k_iCallback = k_iSteamGameSearchCallbacks + 12 };
EResult m_eResult; // m_ullSearchID will be non-zero if this is k_EResultOK
@ -978,8 +918,7 @@ struct RequestPlayersForGameResultCallback_t
CSteamID m_SteamIDPlayerFound; // player steamID
CSteamID m_SteamIDLobby; // if the player is in a lobby, the lobby ID
enum PlayerAcceptState_t
{
enum PlayerAcceptState_t {
k_EStateUnknown = 0,
k_EStatePlayerAccepted = 1,
k_EStatePlayerDeclined = 2,
@ -992,9 +931,7 @@ struct RequestPlayersForGameResultCallback_t
uint64 m_ullUniqueGameID;
};
struct RequestPlayersForGameFinalResultCallback_t
{
struct RequestPlayersForGameFinalResultCallback_t {
enum { k_iCallback = k_iSteamGameSearchCallbacks + 13 };
EResult m_eResult;
@ -1002,11 +939,8 @@ struct RequestPlayersForGameFinalResultCallback_t
uint64 m_ullUniqueGameID;
};
// this callback confirms that results were received by the matchmaking service for this player
struct SubmitPlayerResultResultCallback_t
{
struct SubmitPlayerResultResultCallback_t {
enum { k_iCallback = k_iSteamGameSearchCallbacks + 14 };
EResult m_eResult;
@ -1014,23 +948,19 @@ struct SubmitPlayerResultResultCallback_t
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
{
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
{
struct JoinPartyCallback_t {
enum { k_iCallback = k_iSteamPartiesCallbacks + 1 };
EResult m_eResult;
@ -1040,8 +970,7 @@ struct JoinPartyCallback_t
};
// Response to CreateBeacon request. If successful, the beacon ID is provided.
struct CreateBeaconCallback_t
{
struct CreateBeaconCallback_t {
enum { k_iCallback = k_iSteamPartiesCallbacks + 2 };
EResult m_eResult;
@ -1052,8 +981,7 @@ struct CreateBeaconCallback_t
// 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
{
struct ReservationNotificationCallback_t {
enum { k_iCallback = k_iSteamPartiesCallbacks + 3 };
PartyBeaconID_t m_ulBeaconID;
@ -1061,27 +989,22 @@ struct ReservationNotificationCallback_t
};
// Response to ChangeNumOpenSlots call
struct ChangeNumOpenSlotsCallback_t
{
struct ChangeNumOpenSlotsCallback_t {
enum { k_iCallback = k_iSteamPartiesCallbacks + 4 };
EResult m_eResult;
};
// The list of possible Party beacon locations has changed
struct AvailableBeaconLocationsUpdated_t
{
struct AvailableBeaconLocationsUpdated_t {
enum { k_iCallback = k_iSteamPartiesCallbacks + 5 };
};
// The list of active beacons may have changed
struct ActiveBeaconsUpdated_t
{
struct ActiveBeaconsUpdated_t {
enum { k_iCallback = k_iSteamPartiesCallbacks + 6 };
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMMATCHMAKING

View File

@ -11,20 +11,17 @@
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
enum AudioPlayback_Status
{
enum AudioPlayback_Status {
AudioPlayback_Undefined = 0,
AudioPlayback_Playing = 1,
AudioPlayback_Paused = 2,
AudioPlayback_Idle = 3
};
//-----------------------------------------------------------------------------
// Purpose: Functions to control music playback in the steam client
//-----------------------------------------------------------------------------
class ISteamMusic
{
class ISteamMusic {
public:
virtual bool BIsEnabled() = 0;
virtual bool BIsPlaying() = 0;
@ -37,35 +34,32 @@ public:
virtual void PlayNext() = 0;
// volume is between 0.0 and 1.0
virtual void SetVolume( float flVolume ) = 0;
virtual void SetVolume(float flVolume) = 0;
virtual float GetVolume() = 0;
};
#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamMusic *SteamMusic();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMusic *, SteamMusic, STEAMMUSIC_INTERFACE_VERSION );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
STEAM_CALLBACK_BEGIN( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 )
STEAM_CALLBACK_BEGIN(PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, float, m_flNewVolume )
STEAM_CALLBACK_BEGIN(VolumeHasChanged_t, k_iSteamMusicCallbacks + 2)
STEAM_CALLBACK_MEMBER(0, float, m_flNewVolume)
STEAM_CALLBACK_END(1)
#pragma pack( pop )
#pragma pack(pop)
#endif // #define ISTEAMMUSIC_H

View File

@ -6,128 +6,123 @@
#pragma once
#endif
#include "steam_api_common.h"
#include "isteammusic.h"
#include "steam_api_common.h"
#define k_SteamMusicNameMaxLength 255
#define k_SteamMusicPNGMaxLength 65535
class ISteamMusicRemote
{
class ISteamMusicRemote {
public:
// Service Definition
virtual bool RegisterSteamMusicRemote( const char *pchName ) = 0;
virtual bool RegisterSteamMusicRemote(const char* pchName) = 0;
virtual bool DeregisterSteamMusicRemote() = 0;
virtual bool BIsCurrentMusicRemote() = 0;
virtual bool BActivationSuccess( bool bValue ) = 0;
virtual bool BActivationSuccess(bool bValue) = 0;
virtual bool SetDisplayName( const char *pchDisplayName ) = 0;
virtual bool SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength ) = 0;
virtual bool SetDisplayName(const char* pchDisplayName) = 0;
virtual bool SetPNGIcon_64x64(void* pvBuffer, uint32 cbBufferLength) = 0;
// Abilities for the user interface
virtual bool EnablePlayPrevious(bool bValue) = 0;
virtual bool EnablePlayNext( bool bValue ) = 0;
virtual bool EnableShuffled( bool bValue ) = 0;
virtual bool EnableLooped( bool bValue ) = 0;
virtual bool EnableQueue( bool bValue ) = 0;
virtual bool EnablePlaylists( bool bValue ) = 0;
virtual bool EnablePlayNext(bool bValue) = 0;
virtual bool EnableShuffled(bool bValue) = 0;
virtual bool EnableLooped(bool bValue) = 0;
virtual bool EnableQueue(bool bValue) = 0;
virtual bool EnablePlaylists(bool bValue) = 0;
// Status
virtual bool UpdatePlaybackStatus( AudioPlayback_Status nStatus ) = 0;
virtual bool UpdateShuffled( bool bValue ) = 0;
virtual bool UpdateLooped( bool bValue ) = 0;
virtual bool UpdateVolume( float flValue ) = 0; // volume is between 0.0 and 1.0
virtual bool UpdatePlaybackStatus(AudioPlayback_Status nStatus) = 0;
virtual bool UpdateShuffled(bool bValue) = 0;
virtual bool UpdateLooped(bool bValue) = 0;
virtual bool UpdateVolume(float flValue) = 0; // volume is between 0.0 and 1.0
// Current Entry
virtual bool CurrentEntryWillChange() = 0;
virtual bool CurrentEntryIsAvailable( bool bAvailable ) = 0;
virtual bool UpdateCurrentEntryText( const char *pchText ) = 0;
virtual bool UpdateCurrentEntryElapsedSeconds( int nValue ) = 0;
virtual bool UpdateCurrentEntryCoverArt( void *pvBuffer, uint32 cbBufferLength ) = 0;
virtual bool CurrentEntryIsAvailable(bool bAvailable) = 0;
virtual bool UpdateCurrentEntryText(const char* pchText) = 0;
virtual bool UpdateCurrentEntryElapsedSeconds(int nValue) = 0;
virtual bool UpdateCurrentEntryCoverArt(void* pvBuffer, uint32 cbBufferLength) = 0;
virtual bool CurrentEntryDidChange() = 0;
// Queue
virtual bool QueueWillChange() = 0;
virtual bool ResetQueueEntries() = 0;
virtual bool SetQueueEntry( int nID, int nPosition, const char *pchEntryText ) = 0;
virtual bool SetCurrentQueueEntry( int nID ) = 0;
virtual bool SetQueueEntry(int nID, int nPosition, const char* pchEntryText) = 0;
virtual bool SetCurrentQueueEntry(int nID) = 0;
virtual bool QueueDidChange() = 0;
// Playlist
virtual bool PlaylistWillChange() = 0;
virtual bool ResetPlaylistEntries() = 0;
virtual bool SetPlaylistEntry( int nID, int nPosition, const char *pchEntryText ) = 0;
virtual bool SetCurrentPlaylistEntry( int nID ) = 0;
virtual bool SetPlaylistEntry(int nID, int nPosition, const char* pchEntryText) = 0;
virtual bool SetCurrentPlaylistEntry(int nID) = 0;
virtual bool PlaylistDidChange() = 0;
};
#define STEAMMUSICREMOTE_INTERFACE_VERSION "STEAMMUSICREMOTE_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamMusicRemote *SteamMusicRemote();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMusicRemote *, SteamMusicRemote, STEAMMUSICREMOTE_INTERFACE_VERSION );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteWillActivate_t, k_iSteamMusicRemoteCallbacks + 1)
STEAM_CALLBACK_BEGIN(MusicPlayerRemoteWillActivate_t, k_iSteamMusicRemoteCallbacks + 1)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteWillDeactivate_t, k_iSteamMusicRemoteCallbacks + 2 )
STEAM_CALLBACK_BEGIN(MusicPlayerRemoteWillDeactivate_t, k_iSteamMusicRemoteCallbacks + 2)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteToFront_t, k_iSteamMusicRemoteCallbacks + 3 )
STEAM_CALLBACK_BEGIN(MusicPlayerRemoteToFront_t, k_iSteamMusicRemoteCallbacks + 3)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWillQuit_t, k_iSteamMusicRemoteCallbacks + 4 )
STEAM_CALLBACK_BEGIN(MusicPlayerWillQuit_t, k_iSteamMusicRemoteCallbacks + 4)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlay_t, k_iSteamMusicRemoteCallbacks + 5 )
STEAM_CALLBACK_BEGIN(MusicPlayerWantsPlay_t, k_iSteamMusicRemoteCallbacks + 5)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPause_t, k_iSteamMusicRemoteCallbacks + 6 )
STEAM_CALLBACK_BEGIN(MusicPlayerWantsPause_t, k_iSteamMusicRemoteCallbacks + 6)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayPrevious_t, k_iSteamMusicRemoteCallbacks + 7 )
STEAM_CALLBACK_BEGIN(MusicPlayerWantsPlayPrevious_t, k_iSteamMusicRemoteCallbacks + 7)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayNext_t, k_iSteamMusicRemoteCallbacks + 8 )
STEAM_CALLBACK_BEGIN(MusicPlayerWantsPlayNext_t, k_iSteamMusicRemoteCallbacks + 8)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsShuffled_t, k_iSteamMusicRemoteCallbacks + 9 )
STEAM_CALLBACK_MEMBER( 0, bool, m_bShuffled )
STEAM_CALLBACK_BEGIN(MusicPlayerWantsShuffled_t, k_iSteamMusicRemoteCallbacks + 9)
STEAM_CALLBACK_MEMBER(0, bool, m_bShuffled)
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsLooped_t, k_iSteamMusicRemoteCallbacks + 10 )
STEAM_CALLBACK_MEMBER(0, bool, m_bLooped )
STEAM_CALLBACK_BEGIN(MusicPlayerWantsLooped_t, k_iSteamMusicRemoteCallbacks + 10)
STEAM_CALLBACK_MEMBER(0, bool, m_bLooped)
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsVolume_t, k_iSteamMusicCallbacks + 11 )
STEAM_CALLBACK_MEMBER(0, float, m_flNewVolume)
STEAM_CALLBACK_BEGIN(MusicPlayerWantsVolume_t, k_iSteamMusicCallbacks + 11)
STEAM_CALLBACK_MEMBER(0, float, m_flNewVolume)
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerSelectsQueueEntry_t, k_iSteamMusicCallbacks + 12 )
STEAM_CALLBACK_MEMBER(0, int, nID )
STEAM_CALLBACK_BEGIN(MusicPlayerSelectsQueueEntry_t, k_iSteamMusicCallbacks + 12)
STEAM_CALLBACK_MEMBER(0, int, nID)
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerSelectsPlaylistEntry_t, k_iSteamMusicCallbacks + 13 )
STEAM_CALLBACK_MEMBER(0, int, nID )
STEAM_CALLBACK_BEGIN(MusicPlayerSelectsPlaylistEntry_t, k_iSteamMusicCallbacks + 13)
STEAM_CALLBACK_MEMBER(0, int, nID)
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayingRepeatStatus_t, k_iSteamMusicRemoteCallbacks + 14 )
STEAM_CALLBACK_MEMBER(0, int, m_nPlayingRepeatStatus )
STEAM_CALLBACK_BEGIN(MusicPlayerWantsPlayingRepeatStatus_t, k_iSteamMusicRemoteCallbacks + 14)
STEAM_CALLBACK_MEMBER(0, int, m_nPlayingRepeatStatus)
STEAM_CALLBACK_END(1)
#pragma pack( pop )
#pragma pack(pop)
#endif // #define ISTEAMMUSICREMOTE_H

View File

@ -14,8 +14,7 @@
// list of possible errors returned by SendP2PPacket() API
// these will be posted in the P2PSessionConnectFail_t callback
enum EP2PSessionError
{
enum EP2PSessionError {
k_EP2PSessionErrorNone = 0,
k_EP2PSessionErrorNoRightsToApp = 2, // local user doesn't own the app that is running
k_EP2PSessionErrorTimeout = 4, // target isn't responding, perhaps not calling AcceptP2PSessionWithUser()
@ -32,8 +31,7 @@ enum EP2PSessionError
// SendP2PPacket() send types
// Typically k_EP2PSendUnreliable is what you want for UDP-like packets, k_EP2PSendReliable for TCP-like packets
enum EP2PSend
{
enum EP2PSend {
// Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare).
// The sending API does have some knowledge of the underlying connection, so if there is no NAT-traversal accomplished or
// there is a recognized adjustment happening on the connection, the packet will be batched until the connection is open again.
@ -57,18 +55,16 @@ enum EP2PSend
};
// connection state to a specified user, returned by GetP2PSessionState()
// this is under-the-hood info about what's going on with a SendP2PPacket(), shouldn't be needed except for debuggin
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct P2PSessionState_t
{
struct P2PSessionState_t {
uint8 m_bConnectionActive; // true if we've got an active open connection
uint8 m_bConnecting; // true if we're currently trying to establish a connection
uint8 m_eP2PSessionError; // last error recorded (see enum above)
@ -78,16 +74,14 @@ struct P2PSessionState_t
uint32 m_nRemoteIP; // potential IP:Port of remote host. Could be TURN server.
uint16 m_nRemotePort; // Only exists for compatibility with older authentication api's
};
#pragma pack( pop )
#pragma pack(pop)
// handle to a socket
typedef uint32 SNetSocket_t; // CreateP2PConnectionSocket()
typedef uint32 SNetListenSocket_t; // CreateListenSocket()
// connection progress indicators, used by CreateP2PConnectionSocket()
enum ESNetSocketState
{
enum ESNetSocketState {
k_ESNetSocketStateInvalid = 0,
// communication is valid
@ -98,7 +92,7 @@ enum ESNetSocketState
// p2p connections
k_ESNetSocketStateLocalCandidatesFound = 11, // we've found our local IP info
k_ESNetSocketStateReceivedRemoteCandidates = 12,// we've received information from the remote machine, via the Steam back-end, about their IP info
k_ESNetSocketStateReceivedRemoteCandidates = 12, // we've received information from the remote machine, via the Steam back-end, about their IP info
// direct connections
k_ESNetSocketStateChallengeHandshake = 15, // we've received a challenge packet from the server
@ -113,14 +107,12 @@ enum ESNetSocketState
};
// describes how the socket is currently connected
enum ESNetSocketConnectionType
{
enum ESNetSocketConnectionType {
k_ESNetSocketConnectionTypeNotConnected = 0,
k_ESNetSocketConnectionTypeUDP = 1,
k_ESNetSocketConnectionTypeUDPRelay = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Functions for making connections and sending data between clients,
// traversing NAT's where possible
@ -129,8 +121,7 @@ enum ESNetSocketConnectionType
/// the Steamworks SDK. Please see ISteamNetworkingSockets and
/// ISteamNetworkingMessages
//-----------------------------------------------------------------------------
class ISteamNetworking
{
class ISteamNetworking {
public:
////////////////////////////////////////////////////////////////////////////////////////////
//
@ -154,16 +145,16 @@ public:
// nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket()
// with the same channel number in order to retrieve the data on the other end
// using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources
virtual bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0 ) = 0;
virtual bool SendP2PPacket(CSteamID steamIDRemote, const void* pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0) = 0;
// returns true if any data is available for read, and the amount of data that will need to be read
virtual bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel = 0 ) = 0;
virtual bool IsP2PPacketAvailable(uint32* pcubMsgSize, int nChannel = 0) = 0;
// reads in a packet that has been sent from another user via SendP2PPacket()
// returns the size of the message and the steamID of the user who sent it in the last two parameters
// if the buffer passed in is too small, the message will be truncated
// this call is not blocking, and will return false if no data is available
virtual bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel = 0 ) = 0;
virtual bool ReadP2PPacket(void* pubDest, uint32 cubDest, uint32* pcubMsgSize, CSteamID* psteamIDRemote, int nChannel = 0) = 0;
// AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback
// P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet
@ -171,21 +162,21 @@ public:
// if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically
// this may be called multiple times for a single user
// (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)
virtual bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
virtual bool AcceptP2PSessionWithUser(CSteamID steamIDRemote) = 0;
// call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood
// if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted
virtual bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
virtual bool CloseP2PSessionWithUser(CSteamID steamIDRemote) = 0;
// call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels
// open channels to a user have been closed, the open session to the user will be closed and new data from this
// user will trigger a P2PSessionRequest_t callback
virtual bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) = 0;
virtual bool CloseP2PChannelWithUser(CSteamID steamIDRemote, int nChannel) = 0;
// fills out P2PSessionState_t structure with details about the underlying connection to the user
// should only needed for debugging purposes
// returns false if no connection exists to the specified user
virtual bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) = 0;
virtual bool GetP2PSessionState(CSteamID steamIDRemote, P2PSessionState_t* pConnectionState) = 0;
// Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection
// or NAT-traversal cannot be established. Only applies to connections created after setting this value,
@ -196,8 +187,7 @@ public:
// NOTE: This function is deprecated and may be removed in a future version of the SDK. For
// security purposes, we may decide to relay the traffic to certain peers, even if you pass false
// to this function, to prevent revealing the client's IP address top another peer.
virtual bool AllowP2PPacketRelay( bool bAllow ) = 0;
virtual bool AllowP2PPacketRelay(bool bAllow) = 0;
////////////////////////////////////////////////////////////////////////////////////////////
//
@ -218,7 +208,6 @@ public:
//
////////////////////////////////////////////////////////////////////////////////////////////
// creates a socket and listens others to connect
// will trigger a SocketStatusCallback_t callback on another client connecting
// nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports
@ -227,45 +216,45 @@ public:
// pass in 0 if you just want the default local IP
// unPort is the port to use
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0;
virtual SNetListenSocket_t CreateListenSocket(int nVirtualP2PPort, SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay) = 0;
// creates a socket and begin connection to a remote destination
// can connect via a known steamID (client or game server), or directly to an IP
// on success will trigger a SocketStatusCallback_t callback
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0;
virtual SNetSocket_t CreateConnectionSocket( SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec ) = 0;
virtual SNetSocket_t CreateP2PConnectionSocket(CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay) = 0;
virtual SNetSocket_t CreateConnectionSocket(SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec) = 0;
// disconnects the connection to the socket, if any, and invalidates the handle
// any unread data on the socket will be thrown away
// if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect
virtual bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
virtual bool DestroySocket(SNetSocket_t hSocket, bool bNotifyRemoteEnd) = 0;
// destroying a listen socket will automatically kill all the regular sockets generated from it
virtual bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
virtual bool DestroyListenSocket(SNetListenSocket_t hSocket, bool bNotifyRemoteEnd) = 0;
// sending data
// must be a handle to a connected socket
// data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets
// use the reliable flag with caution; although the resend rate is pretty aggressive,
// it can still cause stalls in receiving data (like TCP)
virtual bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) = 0;
virtual bool SendDataOnSocket(SNetSocket_t hSocket, void* pubData, uint32 cubData, bool bReliable) = 0;
// receiving data
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
virtual bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) = 0;
virtual bool IsDataAvailableOnSocket(SNetSocket_t hSocket, uint32* pcubMsgSize) = 0;
// fills in pubDest with the contents of the message
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
virtual bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
virtual bool RetrieveDataFromSocket(SNetSocket_t hSocket, void* pubDest, uint32 cubDest, uint32* pcubMsgSize) = 0;
// checks for data from any socket that has been connected off this listen socket
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
// fills out *phSocket with the socket that data is available on
virtual bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
virtual bool IsDataAvailable(SNetListenSocket_t hListenSocket, uint32* pcubMsgSize, SNetSocket_t* phSocket) = 0;
// retrieves data from any socket that has been connected off this listen socket
// fills in pubDest with the contents of the message
@ -273,64 +262,59 @@ public:
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
// fills out *phSocket with the socket that data is available on
virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
virtual bool RetrieveData(SNetListenSocket_t hListenSocket, void* pubDest, uint32 cubDest, uint32* pcubMsgSize, SNetSocket_t* phSocket) = 0;
// returns information about the specified socket, filling out the contents of the pointers
virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, SteamIPAddress_t *punIPRemote, uint16 *punPortRemote ) = 0;
virtual bool GetSocketInfo(SNetSocket_t hSocket, CSteamID* pSteamIDRemote, int* peSocketStatus, SteamIPAddress_t* punIPRemote, uint16* punPortRemote) = 0;
// returns which local port the listen socket is bound to
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pnIP, uint16 *pnPort ) = 0;
virtual bool GetListenSocketInfo(SNetListenSocket_t hListenSocket, SteamIPAddress_t* pnIP, uint16* pnPort) = 0;
// returns true to describe how the socket ended up connecting
virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0;
virtual ESNetSocketConnectionType GetSocketConnectionType(SNetSocket_t hSocket) = 0;
// max packet size, in bytes
virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0;
virtual int GetMaxPacketSize(SNetSocket_t hSocket) = 0;
};
#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking006"
// Global interface accessor
inline ISteamNetworking *SteamNetworking();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworking *, SteamNetworking, STEAMNETWORKING_INTERFACE_VERSION );
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 );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#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
// in response, a call to AcceptP2PPacketsFromUser() needs to be made, if you want to talk with them
struct P2PSessionRequest_t
{
struct P2PSessionRequest_t {
enum { k_iCallback = k_iSteamNetworkingCallbacks + 2 };
CSteamID m_steamIDRemote; // user who wants to talk to us
};
// callback notification - packets can't get through to the specified user via the SendP2PPacket() API
// all packets queued packets unsent at this point will be dropped
// further attempts to send will retry making the connection (but will be dropped if we fail again)
struct P2PSessionConnectFail_t
{
struct P2PSessionConnectFail_t {
enum { k_iCallback = k_iSteamNetworkingCallbacks + 3 };
CSteamID m_steamIDRemote; // user we were sending packets to
uint8 m_eP2PSessionError; // EP2PSessionError indicating why we're having trouble
};
// callback notification - status of a socket has changed
// used as part of the CreateListenSocket() / CreateP2PConnectionSocket()
struct SocketStatusCallback_t
{
struct SocketStatusCallback_t {
enum { k_iCallback = k_iSteamNetworkingCallbacks + 1 };
SNetSocket_t m_hSocket; // the socket used to send/receive data to the remote host
SNetListenSocket_t m_hListenSocket; // this is the server socket that we were listening on; NULL if this was an outgoing connection
@ -338,6 +322,6 @@ struct SocketStatusCallback_t
int m_eSNetSocketState; // socket state, ESNetSocketState
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMNETWORKING

View File

@ -4,8 +4,8 @@
#define ISTEAMNETWORKINGMESSAGES
#pragma once
#include "steamnetworkingtypes.h"
#include "steam_api_common.h"
#include "steamnetworkingtypes.h"
//-----------------------------------------------------------------------------
/// The non-connection-oriented interface to send and receive messages
@ -33,8 +33,7 @@
/// you may find the symmetric connection mode of ISteamNetworkingSockets useful.
/// (See k_ESteamNetworkingConfig_SymmetricConnect.)
///
class ISteamNetworkingMessages
{
class ISteamNetworkingMessages {
public:
/// Sends a message to the specified host. If we don't already have a session with that user,
/// a session is implicitly created. There might be some handshaking that needs to happen
@ -78,13 +77,13 @@ public:
/// GetSessionConnectionInfo to get the details.) In order to acknowledge the broken session
/// and start a new one, you must call CloseSessionWithUser
/// - See ISteamNetworkingSockets::SendMessageToConnection for more possible return values
virtual EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const void *pubData, uint32 cubData, int nSendFlags, int nRemoteChannel ) = 0;
virtual EResult SendMessageToUser(const SteamNetworkingIdentity& identityRemote, const void* pubData, uint32 cubData, int nSendFlags, int nRemoteChannel) = 0;
/// Reads the next message that has been sent from another user via SendMessageToUser() on the given channel.
/// Returns number of messages returned into your list. (0 if no message are available on that channel.)
///
/// When you're done with the message object(s), make sure and call SteamNetworkingMessage_t::Release()!
virtual int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
virtual int ReceiveMessagesOnChannel(int nLocalChannel, SteamNetworkingMessage_t** ppOutMessages, int nMaxMessages) = 0;
/// Call this in response to a SteamNetworkingMessagesSessionRequest_t callback.
/// SteamNetworkingMessagesSessionRequest_t are posted when a user tries to send you a message,
@ -96,20 +95,20 @@ public:
/// existing active session, this function will return true, even if it is not pending.
///
/// Calling SendMessageToUser() will implicitly accepts any pending session request to that user.
virtual bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0;
virtual bool AcceptSessionWithUser(const SteamNetworkingIdentity& identityRemote) = 0;
/// Call this when you're done talking to a user to immediately free up resources under-the-hood.
/// If the remote user tries to send data to you again, another SteamNetworkingMessagesSessionRequest_t
/// callback will be posted.
///
/// Note that sessions that go unused for a few minutes are automatically timed out.
virtual bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0;
virtual bool CloseSessionWithUser(const SteamNetworkingIdentity& identityRemote) = 0;
/// Call this when you're done talking to a user on a specific channel. Once all
/// open channels to a user have been closed, the open session to the user will be
/// closed, and any new data from this user will trigger a
/// SteamSteamNetworkingMessagesSessionRequest_t callback
virtual bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nLocalChannel ) = 0;
virtual bool CloseChannelWithUser(const SteamNetworkingIdentity& identityRemote, int nLocalChannel) = 0;
/// Returns information about the latest state of a connection, if any, with the given peer.
/// Primarily intended for debugging purposes, but can also be used to get more detailed
@ -120,7 +119,7 @@ public:
/// you do not need the corresponding details. Note that sessions time out after a while,
/// so if a connection fails, or SendMessageToUser returns k_EResultNoConnection, you cannot wait
/// indefinitely to obtain the reason for failure.
virtual ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity &identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetworkingQuickConnectionStatus *pQuickStatus ) = 0;
virtual ESteamNetworkingConnectionState GetSessionConnectionInfo(const SteamNetworkingIdentity& identityRemote, SteamNetConnectionInfo_t* pConnectionInfo, SteamNetworkingQuickConnectionStatus* pQuickStatus) = 0;
};
#define STEAMNETWORKINGMESSAGES_INTERFACE_VERSION "SteamNetworkingMessages002"
@ -128,11 +127,10 @@ public:
// Callbacks
//
#pragma pack( push, 1 )
#pragma pack(push, 1)
/// Posted when a remote host is sending us a message, and we do not already have a session with them
struct SteamNetworkingMessagesSessionRequest_t
{
struct SteamNetworkingMessagesSessionRequest_t {
enum { k_iCallback = k_iSteamNetworkingMessagesCallbacks + 1 };
SteamNetworkingIdentity m_identityRemote; // user who wants to talk to us
};
@ -148,8 +146,7 @@ struct SteamNetworkingMessagesSessionRequest_t
/// Also, if a session times out due to inactivity, no callbacks will be posted. The only
/// way to detect that this is happening is that querying the session state may return
/// none, connecting, and findingroute again.
struct SteamNetworkingMessagesSessionFailed_t
{
struct SteamNetworkingMessagesSessionFailed_t {
enum { k_iCallback = k_iSteamNetworkingMessagesCallbacks + 2 };
/// Detailed info about the session that failed.
@ -164,36 +161,45 @@ struct SteamNetworkingMessagesSessionFailed_t
// Using standalone lib
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
// Standalone lib.
static_assert( STEAMNETWORKINGMESSAGES_INTERFACE_VERSION[25] == '2', "Version mismatch" );
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamNetworkingMessages_LibV2();
inline ISteamNetworkingMessages *SteamNetworkingMessages_Lib() { return SteamNetworkingMessages_LibV2(); }
// Standalone lib.
static_assert(STEAMNETWORKINGMESSAGES_INTERFACE_VERSION[25] == '2', "Version mismatch");
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages* SteamNetworkingMessages_LibV2();
inline ISteamNetworkingMessages* SteamNetworkingMessages_Lib() { return SteamNetworkingMessages_LibV2(); }
// If running in context of steam, we also define a gameserver instance.
#ifdef STEAMNETWORKINGSOCKETS_STEAM
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamGameServerNetworkingMessages_LibV2();
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages_Lib() { return SteamGameServerNetworkingMessages_LibV2(); }
#endif
// If running in context of steam, we also define a gameserver instance.
#ifdef STEAMNETWORKINGSOCKETS_STEAM
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages* SteamGameServerNetworkingMessages_LibV2();
inline ISteamNetworkingMessages* SteamGameServerNetworkingMessages_Lib() { return SteamGameServerNetworkingMessages_LibV2(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingMessages *SteamNetworkingMessages() { return SteamNetworkingMessages_LibV2(); }
#ifdef STEAMNETWORKINGSOCKETS_STEAM
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_LibV2(); }
#endif
#endif
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingMessages* SteamNetworkingMessages()
{
return SteamNetworkingMessages_LibV2();
}
#ifdef STEAMNETWORKINGSOCKETS_STEAM
inline ISteamNetworkingMessages* SteamGameServerNetworkingMessages()
{
return SteamGameServerNetworkingMessages_LibV2();
}
#endif
#endif
#endif
// Using Steamworks SDK
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI
// Steamworks SDK
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworkingMessages *, SteamNetworkingMessages_SteamAPI, STEAMNETWORKINGMESSAGES_INTERFACE_VERSION );
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworkingMessages *, SteamGameServerNetworkingMessages_SteamAPI, STEAMNETWORKINGMESSAGES_INTERFACE_VERSION );
// Steamworks SDK
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamNetworkingMessages*, SteamNetworkingMessages_SteamAPI, STEAMNETWORKINGMESSAGES_INTERFACE_VERSION);
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(ISteamNetworkingMessages*, SteamGameServerNetworkingMessages_SteamAPI, STEAMNETWORKINGMESSAGES_INTERFACE_VERSION);
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingMessages *SteamNetworkingMessages() { return SteamNetworkingMessages_SteamAPI(); }
inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_SteamAPI(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingMessages* SteamNetworkingMessages()
{
return SteamNetworkingMessages_SteamAPI();
}
inline ISteamNetworkingMessages* SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_SteamAPI(); }
#endif
#endif
#endif // ISTEAMNETWORKINGMESSAGES

View File

@ -4,8 +4,8 @@
#define ISTEAMNETWORKINGSOCKETS
#pragma once
#include "steamnetworkingtypes.h"
#include "steam_api_common.h"
#include "steamnetworkingtypes.h"
struct SteamNetAuthenticationStatus_t;
class ISteamNetworkingConnectionSignaling;
@ -34,10 +34,8 @@ class ISteamNetworkingSignalingRecvContext;
///
/// See also: ISteamNetworkingMessages, the UDP-style interface. This API might be
/// easier to use, especially when porting existing UDP code.
class ISteamNetworkingSockets
{
class ISteamNetworkingSockets {
public:
/// Creates a "server" socket that listens for clients to connect to by
/// calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6)
///
@ -57,7 +55,7 @@ public:
///
/// 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, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
virtual HSteamListenSocket CreateListenSocketIP(const SteamNetworkingIPAddr& localAddress, int nOptions, const SteamNetworkingConfigValue_t* pOptions) = 0;
/// Creates a connection and begins talking to a "server" over UDP at the
/// given IPv4 or IPv6 address. The remote host must be listening with a
@ -81,7 +79,7 @@ public:
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
virtual HSteamNetConnection ConnectByIPAddress(const SteamNetworkingIPAddr& address, int nOptions, const SteamNetworkingConfigValue_t* pOptions) = 0;
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P.
///
@ -106,7 +104,7 @@ public:
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamListenSocket CreateListenSocketP2P( int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
virtual HSteamListenSocket CreateListenSocketP2P(int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t* pOptions) = 0;
/// Begin connecting to a peer that is identified using a platform-specific identifier.
/// This uses the default rendezvous service, which depends on the platform and library
@ -119,7 +117,7 @@ public:
/// To use your own signaling service, see:
/// - ConnectP2PCustomSignaling
/// - k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
virtual HSteamNetConnection ConnectP2P(const SteamNetworkingIdentity& identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t* pOptions) = 0;
/// Accept an incoming connection that has been received on a listen socket.
///
@ -160,7 +158,7 @@ public:
/// socket, consider setting the options on the listen socket, since such options are
/// inherited automatically. If you really do need to set options that are connection
/// specific, it is safe to set them on the connection before accepting the connection.
virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0;
virtual EResult AcceptConnection(HSteamNetConnection hConn) = 0;
/// Disconnects from the remote host and invalidates the connection handle.
/// Any unread data on the connection is discarded.
@ -183,11 +181,11 @@ public:
/// 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;
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;
virtual bool CloseListenSocket(HSteamListenSocket hSocket) = 0;
/// Set connection user data. the data is returned in the following places
/// - You can query it using GetConnectionUserData.
@ -195,17 +193,17 @@ public:
/// - 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;
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;
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;
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;
virtual bool GetConnectionName(HSteamNetConnection hPeer, char* pszName, int nMaxLen) = 0;
/// Send a message to the remote host on the specified connection.
///
@ -244,7 +242,7 @@ public:
/// 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, int64 *pOutMessageNumber ) = 0;
virtual EResult SendMessageToConnection(HSteamNetConnection hConn, const void* pData, uint32 cbData, int nSendFlags, int64* pOutMessageNumber) = 0;
/// Send one or more messages without copying the message payload.
/// This is the most efficient way to send messages. To use this
@ -278,7 +276,7 @@ public:
/// -k_EResultInvalidState if the connection was in an invalid state.
/// See ISteamNetworkingSockets::SendMessageToConnection for possible
/// failure codes.
virtual void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult ) = 0;
virtual void SendMessages(int nMessages, SteamNetworkingMessage_t* const* pMessages, int64* pOutMessageNumberOrResult) = 0;
/// Flush any messages waiting on the Nagle timer and send them
/// at the next transmission opportunity (often that means right now).
@ -293,7 +291,7 @@ public:
/// 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;
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.
@ -310,14 +308,14 @@ public:
/// 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;
virtual int ReceiveMessagesOnConnection(HSteamNetConnection hConn, 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;
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;
virtual bool GetQuickConnectionStatus(HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus* pStats) = 0;
/// Returns detailed connection stats in text format. Useful
/// for dumping to a log, etc.
@ -327,13 +325,13 @@ public:
/// 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;
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;
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
@ -355,14 +353,14 @@ public:
/// 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;
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;
virtual bool GetIdentity(SteamNetworkingIdentity* pIdentity) = 0;
/// Indicate our desire to be ready participate in authenticated communications.
/// If we are currently not ready, then steps will be taken to obtain the necessary
@ -396,7 +394,7 @@ public:
/// The value of SteamNetAuthenticationStatus_t::m_eAvail is returned. If you only
/// want this high level status, you can pass NULL for pDetails. If you want further
/// details, pass non-NULL to receive them.
virtual ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) = 0;
virtual ESteamNetworkingAvailability GetAuthenticationStatus(SteamNetAuthenticationStatus_t* pDetails) = 0;
//
// Poll groups. A poll group is a set of connections that can be polled efficiently.
@ -414,7 +412,7 @@ public:
/// If there are any connections in the poll group, they are removed from the group,
/// and left in a state where they are not part of any poll group.
/// Returns false if passed an invalid poll group handle.
virtual bool DestroyPollGroup( HSteamNetPollGroup hPollGroup ) = 0;
virtual bool DestroyPollGroup(HSteamNetPollGroup hPollGroup) = 0;
/// Assign a connection to a poll group. Note that a connection may only belong to a
/// single poll group. Adding a connection to a poll group implicitly removes it from
@ -430,7 +428,7 @@ public:
///
/// Returns false if the connection handle is invalid, or if the poll group handle
/// is invalid (and not k_HSteamNetPollGroup_Invalid).
virtual bool SetConnectionPollGroup( HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup ) = 0;
virtual bool SetConnectionPollGroup(HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup) = 0;
/// Same as ReceiveMessagesOnConnection, but will return the next messages available
/// on any connection in the poll group. Examine SteamNetworkingMessage_t::m_conn
@ -447,7 +445,7 @@ public:
/// (But the messages are not grouped by connection, so they will not necessarily
/// appear consecutively in the list; they may be interleaved with messages for
/// other connections.)
virtual int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
virtual int ReceiveMessagesOnPollGroup(HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t** ppOutMessages, int nMaxMessages) = 0;
//
// Clients connecting to dedicated servers hosted in a data center,
@ -460,7 +458,7 @@ public:
/// 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;
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
@ -468,7 +466,7 @@ public:
///
/// 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 nRemoteVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
virtual int FindRelayAuthTicketForServer(const SteamNetworkingIdentity& identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket* pOutParsedTicket) = 0;
/// Client call to connect to a server hosted in a Valve data center, on the specified virtual
/// port. You must have placed a ticket for this server into the cache, or else this connect
@ -486,7 +484,7 @@ public:
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
virtual HSteamNetConnection ConnectToHostedDedicatedServer(const SteamNetworkingIdentity& identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t* pOptions) = 0;
//
// Servers hosted in data centers known to the Valve relay network
@ -531,7 +529,7 @@ public:
///
/// NOTE: The returned blob is not encrypted. Send it to your backend, but don't
/// directly share it with clients.
virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) = 0;
virtual EResult 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
@ -546,7 +544,7 @@ public:
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket(int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t* pOptions) = 0;
/// Generate an authentication blob that can be used to securely login with
/// your backend, using SteamDatagram_ParseHostedServerLogin. (See
@ -578,8 +576,7 @@ public:
///
/// NOTE: The routing blob returned here is not encrypted. Send it to your backend
/// and don't share it directly with clients.
virtual EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob ) = 0;
virtual EResult GetGameCoordinatorServerLogin(SteamDatagramGameCoordinatorServerLogin* pLoginInfo, int* pcbSignedBlob, void* pBlob) = 0;
//
// Relayed connections using custom signaling protocol
@ -621,7 +618,7 @@ public:
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
virtual HSteamNetConnection ConnectP2PCustomSignaling(ISteamNetworkingConnectionSignaling* pSignaling, const SteamNetworkingIdentity* pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t* pOptions) = 0;
/// Called when custom signaling has received a message. When your
/// signaling channel receives a message, it should save off whatever
@ -652,12 +649,12 @@ public:
///
/// If you expect to be using relayed connections, then you probably want
/// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes
virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingSignalingRecvContext *pContext ) = 0;
virtual bool ReceivedP2PCustomSignal(const void* pMsg, int cbMsg, ISteamNetworkingSignalingRecvContext* pContext) = 0;
//
// Certificate provision by the application. On Steam, we normally handle all this automatically
// and you will not need to use these advanced functions.
//
//
// Certificate provision by the application. On Steam, we normally handle all this automatically
// and you will not need to use these advanced functions.
//
/// Get blob that describes a certificate request. You can send this to your game coordinator.
/// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will
@ -665,11 +662,11 @@ public:
/// size. (256 bytes is a very conservative estimate.)
///
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
virtual bool GetCertificateRequest(int* pcbBlob, void* pBlob, SteamNetworkingErrMsg& errMsg) = 0;
/// Set the certificate. The certificate blob should be the output of
/// SteamDatagram_CreateCert.
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
virtual bool SetCertificate(const void* pCertificate, int cbCertificate, SteamNetworkingErrMsg& errMsg) = 0;
/// Invoke all callback functions queued for this interface.
/// See k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, etc
@ -677,6 +674,7 @@ public:
/// You don't need to call this if you are using Steam's callback dispatch
/// mechanism (SteamAPI_RunCallbacks and SteamGameserver_RunCallbacks).
virtual void RunCallbacks() = 0;
protected:
~ISteamNetworkingSockets(); // Silence some warnings
};
@ -686,43 +684,52 @@ protected:
// Using standalone lib
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
// Standalone lib.
static_assert( STEAMNETWORKINGSOCKETS_INTERFACE_VERSION[24] == '9', "Version mismatch" );
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets_LibV9();
inline ISteamNetworkingSockets *SteamNetworkingSockets_Lib() { return SteamNetworkingSockets_LibV9(); }
// Standalone lib.
static_assert(STEAMNETWORKINGSOCKETS_INTERFACE_VERSION[24] == '9', "Version mismatch");
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets* SteamNetworkingSockets_LibV9();
inline ISteamNetworkingSockets* SteamNetworkingSockets_Lib() { return SteamNetworkingSockets_LibV9(); }
// If running in context of steam, we also define a gameserver instance.
#ifdef STEAMNETWORKINGSOCKETS_STEAM
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamGameServerNetworkingSockets_LibV9();
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets_Lib() { return SteamGameServerNetworkingSockets_LibV9(); }
#endif
// If running in context of steam, we also define a gameserver instance.
#ifdef STEAMNETWORKINGSOCKETS_STEAM
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets* SteamGameServerNetworkingSockets_LibV9();
inline ISteamNetworkingSockets* SteamGameServerNetworkingSockets_Lib() { return SteamGameServerNetworkingSockets_LibV9(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_LibV9(); }
#ifdef STEAMNETWORKINGSOCKETS_STEAM
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_LibV9(); }
#endif
#endif
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingSockets* SteamNetworkingSockets()
{
return SteamNetworkingSockets_LibV9();
}
#ifdef STEAMNETWORKINGSOCKETS_STEAM
inline ISteamNetworkingSockets* SteamGameServerNetworkingSockets()
{
return SteamGameServerNetworkingSockets_LibV9();
}
#endif
#endif
#endif
// Using Steamworks SDK
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI
// Steamworks SDK
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION );
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamGameServerNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION );
// Steamworks SDK
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamNetworkingSockets*, SteamNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION);
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(ISteamNetworkingSockets*, SteamGameServerNetworkingSockets_SteamAPI, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION);
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_SteamAPI(); }
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_SteamAPI(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingSockets* SteamNetworkingSockets()
{
return SteamNetworkingSockets_SteamAPI();
}
inline ISteamNetworkingSockets* SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_SteamAPI(); }
#endif
#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 )
#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
@ -762,8 +769,7 @@ protected:
/// 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
{
struct SteamNetConnectionStatusChangedCallback_t {
enum { k_iCallback = k_iSteamNetworkingSocketsCallbacks + 1 };
/// Connection handle
@ -784,8 +790,7 @@ struct SteamNetConnectionStatusChangedCallback_t
/// - A valid certificate issued by a CA.
///
/// This callback is posted whenever the state of our readiness changes.
struct SteamNetAuthenticationStatus_t
{
struct SteamNetAuthenticationStatus_t {
enum { k_iCallback = k_iSteamNetworkingSocketsCallbacks + 2 };
/// Status
@ -793,9 +798,9 @@ struct SteamNetAuthenticationStatus_t
/// Non-localized English language status. For diagnostic/debugging
/// purposes only.
char m_debugMsg[ 256 ];
char m_debugMsg[256];
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMNETWORKINGSOCKETS

View File

@ -8,8 +8,8 @@
#define ISTEAMNETWORKINGUTILS
#pragma once
#include "steamnetworkingtypes.h"
#include "steam_api_common.h"
#include "steamnetworkingtypes.h"
struct SteamDatagramRelayAuthTicket;
struct SteamRelayNetworkStatus_t;
@ -17,8 +17,7 @@ struct SteamRelayNetworkStatus_t;
//-----------------------------------------------------------------------------
/// Misc networking utilities for checking the local networking environment
/// and estimating pings.
class ISteamNetworkingUtils
{
class ISteamNetworkingUtils {
public:
//
// Efficient message sending
@ -38,7 +37,7 @@ public:
/// If cbAllocateBuffer=0, then no buffer is allocated. m_pData will be NULL,
/// m_cbSize will be zero, and m_pfnFreeData will be NULL. You will need to
/// set each of these.
virtual SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer ) = 0;
virtual SteamNetworkingMessage_t* AllocateMessage(int cbAllocateBuffer) = 0;
//
// Access to Steam Datagram Relay (SDR) network
@ -78,7 +77,7 @@ public:
///
/// SteamRelayNetworkStatus_t::m_eAvail is returned. If you want
/// more details, you can pass a non-NULL value.
virtual ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *pDetails ) = 0;
virtual ESteamNetworkingAvailability GetRelayNetworkStatus(SteamRelayNetworkStatus_t* pDetails) = 0;
//
// "Ping location" functions
@ -107,7 +106,7 @@ public:
///
/// 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;
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
@ -131,7 +130,7 @@ public:
///
/// 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;
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
@ -141,17 +140,17 @@ public:
/// 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;
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;
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;
virtual bool ParsePingLocationString(const char* pszString, SteamNetworkPingLocation_t& result) = 0;
/// Check if the ping data of sufficient recency is available, and if
/// it's too old, start refreshing it.
@ -171,7 +170,7 @@ public:
///
/// You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
/// to know when ping measurement completes.
virtual bool CheckPingDataUpToDate( float flMaxAgeSeconds ) = 0;
virtual bool CheckPingDataUpToDate(float flMaxAgeSeconds) = 0;
//
// List of Valve data centers, and ping times to them. This might
@ -181,17 +180,17 @@ public:
/// Fetch ping time of best available relayed route from this host to
/// the specified data center.
virtual int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP ) = 0;
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;
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;
virtual int GetPOPList(SteamNetworkingPOPID* list, int nListSz) = 0;
//
// Misc
@ -239,20 +238,20 @@ public:
/// 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;
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 SetGlobalConfigValuePtr( ESteamNetworkingConfigValue eValue, void *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 );
bool SetGlobalConfigValueInt32(ESteamNetworkingConfigValue eValue, int32 val);
bool SetGlobalConfigValueFloat(ESteamNetworkingConfigValue eValue, float val);
bool SetGlobalConfigValueString(ESteamNetworkingConfigValue eValue, const char* val);
bool SetGlobalConfigValuePtr(ESteamNetworkingConfigValue eValue, void* 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 global callbacks. If you do not want to use Steam's callback dispatch mechanism and you
@ -260,11 +259,11 @@ public:
// simply install these callbacks first thing, and you are good to go.
// See ISteamNetworkingSockets::RunCallbacks
//
bool SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback );
bool SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback );
bool SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback );
bool SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback );
bool SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback );
bool SetGlobalCallback_SteamNetConnectionStatusChanged(FnSteamNetConnectionStatusChanged fnCallback);
bool SetGlobalCallback_SteamNetAuthenticationStatusChanged(FnSteamNetAuthenticationStatusChanged fnCallback);
bool SetGlobalCallback_SteamRelayNetworkStatusChanged(FnSteamRelayNetworkStatusChanged fnCallback);
bool SetGlobalCallback_MessagesSessionRequest(FnSteamNetworkingMessagesSessionRequest fnCallback);
bool SetGlobalCallback_MessagesSessionFailed(FnSteamNetworkingMessagesSessionFailed fnCallback);
/// Set a configuration value.
/// - eValue: which value is being set
@ -276,14 +275,15 @@ public:
/// will reset any custom value and restore it to the system default.
/// NOTE: When setting pointers (e.g. 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;
virtual bool SetConfigValue(ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType eDataType, const void* pArg)
= 0;
/// Set a configuration value, using a struct to pass the value.
/// (This is just a convenience shortcut; see below for the implementation and
/// a little insight into how SteamNetworkingConfigValue_t is used when
/// setting config options during listen socket and connection creation.)
bool SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj );
bool SetConfigValueStruct(const SteamNetworkingConfigValue_t& opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj);
/// Get a configuration value.
/// - eValue: which value to fetch
@ -292,8 +292,9 @@ public:
/// - 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;
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.
@ -302,17 +303,17 @@ public:
///
/// See k_ESteamNetworkingConfig_EnumerateDevVars for some more info about "dev" variables,
/// which are usually excluded from the set of variables enumerated using this function.
virtual bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue ) = 0;
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;
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
@ -323,38 +324,40 @@ protected:
// Using standalone lib
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
// Standalone lib
static_assert( STEAMNETWORKINGUTILS_INTERFACE_VERSION[22] == '3', "Version mismatch" );
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingUtils *SteamNetworkingUtils_LibV3();
inline ISteamNetworkingUtils *SteamNetworkingUtils_Lib() { return SteamNetworkingUtils_LibV3(); }
// Standalone lib
static_assert(STEAMNETWORKINGUTILS_INTERFACE_VERSION[22] == '3', "Version mismatch");
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingUtils* SteamNetworkingUtils_LibV3();
inline ISteamNetworkingUtils* SteamNetworkingUtils_Lib() { return SteamNetworkingUtils_LibV3(); }
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingUtils *SteamNetworkingUtils() { return SteamNetworkingUtils_LibV3(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STEAMAPI
inline ISteamNetworkingUtils* SteamNetworkingUtils()
{
return SteamNetworkingUtils_LibV3();
}
#endif
#endif
// Using Steamworks SDK
#ifdef STEAMNETWORKINGSOCKETS_STEAMAPI
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils_SteamAPI,
STEAM_DEFINE_INTERFACE_ACCESSOR(ISteamNetworkingUtils*, SteamNetworkingUtils_SteamAPI,
/* Prefer user version of the interface. But if it isn't found, then use
gameserver one. Yes, this is a completely terrible hack */
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) ?
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) :
SteamInternal_FindOrCreateGameServerInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ),
SteamInternal_FindOrCreateUserInterface(0, STEAMNETWORKINGUTILS_INTERFACE_VERSION) ? SteamInternal_FindOrCreateUserInterface(0, STEAMNETWORKINGUTILS_INTERFACE_VERSION) : SteamInternal_FindOrCreateGameServerInterface(0, STEAMNETWORKINGUTILS_INTERFACE_VERSION),
"global",
STEAMNETWORKINGUTILS_INTERFACE_VERSION
)
STEAMNETWORKINGUTILS_INTERFACE_VERSION)
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingUtils *SteamNetworkingUtils() { return SteamNetworkingUtils_SteamAPI(); }
#endif
#ifndef STEAMNETWORKINGSOCKETS_STANDALONELIB
inline ISteamNetworkingUtils* SteamNetworkingUtils()
{
return SteamNetworkingUtils_SteamAPI();
}
#endif
#endif
/// A struct used to describe our readiness to use the relay network.
/// To do this we first need to fetch the network configuration,
/// which describes what POPs are available.
struct SteamRelayNetworkStatus_t
{
struct SteamRelayNetworkStatus_t {
enum { k_iCallback = k_iSteamNetworkingUtilsCallbacks + 1 };
/// Summary status. When this is "current", initialization has
@ -382,77 +385,77 @@ struct SteamRelayNetworkStatus_t
/// Non-localized English language status. For diagnostic/debugging
/// purposes only.
char m_debugMsg[ 256 ];
char m_debugMsg[256];
};
/// Utility class for printing a SteamNetworkingIdentity.
/// E.g. printf( "Identity is '%s'\n", SteamNetworkingIdentityRender( identity ).c_str() );
struct SteamNetworkingIdentityRender
{
SteamNetworkingIdentityRender( const SteamNetworkingIdentity &x ) { x.ToString( buf, sizeof(buf) ); }
inline const char *c_str() const { return buf; }
struct SteamNetworkingIdentityRender {
SteamNetworkingIdentityRender(const SteamNetworkingIdentity& x) { x.ToString(buf, sizeof(buf)); }
inline const char* c_str() const { return buf; }
private:
char buf[ SteamNetworkingIdentity::k_cchMaxString ];
char buf[SteamNetworkingIdentity::k_cchMaxString];
};
/// Utility class for printing a SteamNetworkingIPAddrRender.
struct SteamNetworkingIPAddrRender
{
SteamNetworkingIPAddrRender( const SteamNetworkingIPAddr &x, bool bWithPort = true ) { x.ToString( buf, sizeof(buf), bWithPort ); }
inline const char *c_str() const { return buf; }
struct SteamNetworkingIPAddrRender {
SteamNetworkingIPAddrRender(const SteamNetworkingIPAddr& x, bool bWithPort = true) { x.ToString(buf, sizeof(buf), bWithPort); }
inline const char* c_str() const { return buf; }
private:
char buf[ SteamNetworkingIPAddr::k_cchMaxString ];
char buf[SteamNetworkingIPAddr::k_cchMaxString];
};
///////////////////////////////////////////////////////////////////////////////
//
// Internal stuff
inline void ISteamNetworkingUtils::InitRelayNetworkAccess() { CheckPingDataUpToDate( 1e10f ); }
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::SetGlobalConfigValuePtr( ESteamNetworkingConfigValue eValue, void *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Ptr, &val ); } // Note: passing pointer to pointer.
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 ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_AuthStatusChanged, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionRequest, (void*)fnCallback ); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionFailed, (void*)fnCallback ); }
inline void ISteamNetworkingUtils::InitRelayNetworkAccess() { CheckPingDataUpToDate(1e10f); }
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::SetGlobalConfigValuePtr(ESteamNetworkingConfigValue eValue, void* val) { return SetConfigValue(eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Ptr, &val); } // Note: passing pointer to pointer.
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); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetConnectionStatusChanged(FnSteamNetConnectionStatusChanged fnCallback) { return SetGlobalConfigValuePtr(k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, (void*)fnCallback); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetAuthenticationStatusChanged(FnSteamNetAuthenticationStatusChanged fnCallback) { return SetGlobalConfigValuePtr(k_ESteamNetworkingConfig_Callback_AuthStatusChanged, (void*)fnCallback); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamRelayNetworkStatusChanged(FnSteamRelayNetworkStatusChanged fnCallback) { return SetGlobalConfigValuePtr(k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged, (void*)fnCallback); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionRequest(FnSteamNetworkingMessagesSessionRequest fnCallback) { return SetGlobalConfigValuePtr(k_ESteamNetworkingConfig_Callback_MessagesSessionRequest, (void*)fnCallback); }
inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionFailed(FnSteamNetworkingMessagesSessionFailed fnCallback) { return SetGlobalConfigValuePtr(k_ESteamNetworkingConfig_Callback_MessagesSessionFailed, (void*)fnCallback); }
inline bool ISteamNetworkingUtils::SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj )
inline bool ISteamNetworkingUtils::SetConfigValueStruct(const SteamNetworkingConfigValue_t& opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj)
{
// Locate the argument. Strings are a special case, since the
// "value" (the whole string buffer) doesn't fit in the struct
// NOTE: for pointer values, we pass a pointer to the pointer,
// we do not pass the pointer directly.
const void *pVal = ( opt.m_eDataType == k_ESteamNetworkingConfig_String ) ? (const void *)opt.m_val.m_string : (const void *)&opt.m_val;
return SetConfigValue( opt.m_eValue, eScopeType, scopeObj, opt.m_eDataType, pVal );
const void* pVal = (opt.m_eDataType == k_ESteamNetworkingConfig_String) ? (const void*)opt.m_val.m_string : (const void*)&opt.m_val;
return SetConfigValue(opt.m_eValue, eScopeType, scopeObj, opt.m_eDataType, pVal);
}
// How to get helper functions.
#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) || defined( STEAMNETWORKINGSOCKETS_STANDALONELIB )
#if defined(STEAMNETWORKINGSOCKETS_STATIC_LINK) || defined(STEAMNETWORKINGSOCKETS_STANDALONELIB)
// Call direct to static functions
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr *pAddr, char *buf, size_t cbBuf, bool bWithPort );
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr );
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity *pIdentity, char *buf, size_t cbBuf );
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, size_t sizeofIdentity, const char *pszStr );
inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingIPAddr_ToString( this, buf, cbBuf, bWithPort ); }
inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamNetworkingIPAddr_ParseString( this, pszStr ); }
inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamNetworkingIdentity_ToString( this, buf, cbBuf ); }
inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamNetworkingIdentity_ParseString( this, sizeof(*this), pszStr ); }
// Call direct to static functions
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIPAddr_ToString(const SteamNetworkingIPAddr* pAddr, char* buf, size_t cbBuf, bool bWithPort);
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIPAddr_ParseString(SteamNetworkingIPAddr* pAddr, const char* pszStr);
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingIdentity_ToString(const SteamNetworkingIdentity* pIdentity, char* buf, size_t cbBuf);
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamNetworkingIdentity_ParseString(SteamNetworkingIdentity* pIdentity, size_t sizeofIdentity, const char* pszStr);
inline void SteamNetworkingIPAddr::ToString(char* buf, size_t cbBuf, bool bWithPort) const { SteamNetworkingIPAddr_ToString(this, buf, cbBuf, bWithPort); }
inline bool SteamNetworkingIPAddr::ParseString(const char* pszStr) { return SteamNetworkingIPAddr_ParseString(this, pszStr); }
inline void SteamNetworkingIdentity::ToString(char* buf, size_t cbBuf) const { SteamNetworkingIdentity_ToString(this, buf, cbBuf); }
inline bool SteamNetworkingIdentity::ParseString(const char* pszStr) { return SteamNetworkingIdentity_ParseString(this, sizeof(*this), pszStr); }
#elif defined( STEAMNETWORKINGSOCKETS_STEAMAPI )
// Using steamworks SDK - go through SteamNetworkingUtils()
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 ); }
#elif defined(STEAMNETWORKINGSOCKETS_STEAMAPI)
// Using steamworks SDK - go through SteamNetworkingUtils()
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); }
#else
#error "Invalid config"
#error "Invalid config"
#endif
#endif // ISTEAMNETWORKINGUTILS

View File

@ -13,8 +13,7 @@
#include "steam_api_common.h"
// Feature types for parental settings
enum EParentalFeature
{
enum EParentalFeature {
k_EFeatureInvalid = 0,
k_EFeatureStore = 1,
k_EFeatureCommunity = 2,
@ -32,32 +31,29 @@ enum EParentalFeature
k_EFeatureMax
};
class ISteamParentalSettings
{
class ISteamParentalSettings {
public:
virtual bool BIsParentalLockEnabled() = 0;
virtual bool BIsParentalLockLocked() = 0;
virtual bool BIsAppBlocked( AppId_t nAppID ) = 0;
virtual bool BIsAppInBlockList( AppId_t nAppID ) = 0;
virtual bool BIsAppBlocked(AppId_t nAppID) = 0;
virtual bool BIsAppInBlockList(AppId_t nAppID) = 0;
virtual bool BIsFeatureBlocked( EParentalFeature eFeature ) = 0;
virtual bool BIsFeatureInBlockList( EParentalFeature eFeature ) = 0;
virtual bool BIsFeatureBlocked(EParentalFeature eFeature) = 0;
virtual bool BIsFeatureInBlockList(EParentalFeature eFeature) = 0;
};
#define STEAMPARENTALSETTINGS_INTERFACE_VERSION "STEAMPARENTALSETTINGS_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamParentalSettings *SteamParentalSettings();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamParentalSettings *, SteamParentalSettings, STEAMPARENTALSETTINGS_INTERFACE_VERSION );
inline ISteamParentalSettings* SteamParentalSettings();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamParentalSettings*, SteamParentalSettings, STEAMPARENTALSETTINGS_INTERFACE_VERSION);
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
//-----------------------------------------------------------------------------
struct SteamParentalSettingsChanged_t
{
struct SteamParentalSettingsChanged_t {
enum { k_iCallback = k_ISteamParentalSettingsCallbacks + 1 };
};
#endif // ISTEAMPARENTALSETTINGS_H

View File

@ -16,59 +16,52 @@
//-----------------------------------------------------------------------------
// Purpose: Enum for supported gradient directions
//-----------------------------------------------------------------------------
enum EOverlayGradientDirection
{
enum EOverlayGradientDirection {
k_EOverlayGradientHorizontal = 1,
k_EOverlayGradientVertical = 2,
k_EOverlayGradientNone = 3,
};
// Helpers for fetching individual color components from ARGB packed DWORD colors Steam PS3 overlay renderer uses.
#define STEAM_COLOR_RED( color ) \
(int)(((color)>>16)&0xff)
#define STEAM_COLOR_RED(color) \
(int)(((color) >> 16) & 0xff)
#define STEAM_COLOR_GREEN( color ) \
(int)(((color)>>8)&0xff)
#define STEAM_COLOR_GREEN(color) \
(int)(((color) >> 8) & 0xff)
#define STEAM_COLOR_BLUE( color ) \
#define STEAM_COLOR_BLUE(color) \
(int)((color)&0xff)
#define STEAM_COLOR_ALPHA( color ) \
(int)(((color)>>24)&0xff)
#define STEAM_COLOR_ALPHA(color) \
(int)(((color) >> 24) & 0xff)
//-----------------------------------------------------------------------------
// Purpose: Interface the game must expose to Steam for rendering
//-----------------------------------------------------------------------------
class ISteamPS3OverlayRenderHost
{
class ISteamPS3OverlayRenderHost {
public:
// Interface for game engine to implement which Steam requires to render.
// Draw a textured rect. This may use only part of the texture and will pass texture coords, it will also possibly request a gradient and will specify colors for vertexes.
virtual void DrawTexturedRect( int x0, int y0, int x1, int y1, float u0, float v0, float u1, float v1, int32 iTextureID, DWORD colorStart, DWORD colorEnd, EOverlayGradientDirection eDirection ) = 0;
virtual void DrawTexturedRect(int x0, int y0, int x1, int y1, float u0, float v0, float u1, float v1, int32 iTextureID, DWORD colorStart, DWORD colorEnd, EOverlayGradientDirection eDirection) = 0;
// Load a RGBA texture for Steam, or update a previously loaded one. Updates may be partial. You must not evict or remove this texture once Steam has uploaded it.
virtual void LoadOrUpdateTexture( int32 iTextureID, bool bIsFullTexture, int x0, int y0, uint32 uWidth, uint32 uHeight, int32 iBytes, char *pData ) = 0;
virtual void LoadOrUpdateTexture(int32 iTextureID, bool bIsFullTexture, int x0, int y0, uint32 uWidth, uint32 uHeight, int32 iBytes, char* pData) = 0;
// Delete a texture Steam previously uploaded
virtual void DeleteTexture( int32 iTextureID ) = 0;
virtual void DeleteTexture(int32 iTextureID) = 0;
// Delete all previously uploaded textures
virtual void DeleteAllTextures() = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Interface Steam exposes for the game to tell it when to render, etc.
//-----------------------------------------------------------------------------
class ISteamPS3OverlayRender
{
class ISteamPS3OverlayRender {
public:
// Call once at startup to initialize the Steam overlay and pass it your host interface ptr
virtual bool BHostInitialize( uint32 unScreenWidth, uint32 unScreenHeight, uint32 unRefreshRate, ISteamPS3OverlayRenderHost *pRenderHost, void *CellFontLib ) = 0;
virtual bool BHostInitialize(uint32 unScreenWidth, uint32 unScreenHeight, uint32 unRefreshRate, ISteamPS3OverlayRenderHost* pRenderHost, void* CellFontLib) = 0;
// Call this once a frame when you are ready for the Steam overlay to render (ie, right before flipping buffers, after all your rendering)
virtual void Render() = 0;
@ -78,7 +71,7 @@ public:
// If this returns true, then the overlay is active and has consumed the input, your game
// should then ignore all the input until BHandleCellPadData once again returns false, which
// will mean the overlay is deactivated.
virtual bool BHandleCellPadData( const CellPadData &padData ) = 0;
virtual bool BHandleCellPadData(const CellPadData& padData) = 0;
// Call this if you detect no controllers connected or that the XMB is intercepting input
//
@ -87,5 +80,4 @@ public:
virtual bool BResetInputState() = 0;
};
#endif // ISTEAMPS3OVERLAYRENDERER_H

View File

@ -8,12 +8,10 @@
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: The form factor of a device
//-----------------------------------------------------------------------------
enum ESteamDeviceFormFactor
{
enum ESteamDeviceFormFactor {
k_ESteamDeviceFormFactorUnknown = 0,
k_ESteamDeviceFormFactorPhone = 1,
k_ESteamDeviceFormFactorTablet = 2,
@ -24,65 +22,59 @@ enum ESteamDeviceFormFactor
// Steam Remote Play session ID
typedef uint32 RemotePlaySessionID_t;
//-----------------------------------------------------------------------------
// Purpose: Functions to provide information about Steam Remote Play sessions
//-----------------------------------------------------------------------------
class ISteamRemotePlay
{
class ISteamRemotePlay {
public:
// Get the number of currently connected Steam Remote Play sessions
virtual uint32 GetSessionCount() = 0;
// Get the currently connected Steam Remote Play session ID at the specified index. Returns zero if index is out of bounds.
virtual RemotePlaySessionID_t GetSessionID( int iSessionIndex ) = 0;
virtual RemotePlaySessionID_t GetSessionID(int iSessionIndex) = 0;
// Get the SteamID of the connected user
virtual CSteamID GetSessionSteamID( RemotePlaySessionID_t unSessionID ) = 0;
virtual CSteamID GetSessionSteamID(RemotePlaySessionID_t unSessionID) = 0;
// Get the name of the session client device
// This returns NULL if the sessionID is not valid
virtual const char *GetSessionClientName( RemotePlaySessionID_t unSessionID ) = 0;
virtual const char* GetSessionClientName(RemotePlaySessionID_t unSessionID) = 0;
// Get the form factor of the session client device
virtual ESteamDeviceFormFactor GetSessionClientFormFactor( RemotePlaySessionID_t unSessionID ) = 0;
virtual ESteamDeviceFormFactor GetSessionClientFormFactor(RemotePlaySessionID_t unSessionID) = 0;
// Get the resolution, in pixels, of the session client device
// This is set to 0x0 if the resolution is not available
virtual bool BGetSessionClientResolution( RemotePlaySessionID_t unSessionID, int *pnResolutionX, int *pnResolutionY ) = 0;
virtual bool BGetSessionClientResolution(RemotePlaySessionID_t unSessionID, int* pnResolutionX, int* pnResolutionY) = 0;
// Invite a friend to Remote Play Together
// This returns false if the invite can't be sent
virtual bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend ) = 0;
virtual bool BSendRemotePlayTogetherInvite(CSteamID steamIDFriend) = 0;
};
#define STEAMREMOTEPLAY_INTERFACE_VERSION "STEAMREMOTEPLAY_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamRemotePlay *SteamRemotePlay();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamRemotePlay *, SteamRemotePlay, STEAMREMOTEPLAY_INTERFACE_VERSION );
inline ISteamRemotePlay* SteamRemotePlay();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamRemotePlay*, SteamRemotePlay, STEAMREMOTEPLAY_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
STEAM_CALLBACK_BEGIN(SteamRemotePlaySessionConnected_t, k_iSteamRemotePlayCallbacks + 1)
STEAM_CALLBACK_MEMBER(0, RemotePlaySessionID_t, m_unSessionID)
STEAM_CALLBACK_END(0)
STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionConnected_t, k_iSteamRemotePlayCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, RemotePlaySessionID_t, m_unSessionID )
STEAM_CALLBACK_END( 0 )
STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionDisconnected_t, k_iSteamRemotePlayCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, RemotePlaySessionID_t, m_unSessionID )
STEAM_CALLBACK_END( 0 )
#pragma pack( pop )
STEAM_CALLBACK_BEGIN(SteamRemotePlaySessionDisconnected_t, k_iSteamRemotePlayCallbacks + 2)
STEAM_CALLBACK_MEMBER(0, RemotePlaySessionID_t, m_unSessionID)
STEAM_CALLBACK_END(0)
#pragma pack(pop)
#endif // #define ISTEAMREMOTEPLAY_H

View File

@ -12,30 +12,27 @@
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Defines the largest allowed file size. Cloud files cannot be written
// in a single chunk over 100MB (and cannot be over 200MB total.)
//-----------------------------------------------------------------------------
const uint32 k_unMaxCloudFileChunkSize = 100 * 1024 * 1024;
//-----------------------------------------------------------------------------
// Purpose: Structure that contains an array of const char * strings and the number of those strings
//-----------------------------------------------------------------------------
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct SteamParamStringArray_t
{
const char ** m_ppStrings;
struct SteamParamStringArray_t {
const char** m_ppStrings;
int32 m_nNumStrings;
};
#pragma pack( pop )
#pragma pack(pop)
// A handle to a piece of user generated content
typedef uint64 UGCHandle_t;
@ -57,9 +54,7 @@ const uint32 k_cchTagListMax = 1024 + 1;
const uint32 k_cchFilenameMax = 260;
const uint32 k_cchPublishedFileURLMax = 256;
enum ERemoteStoragePlatform
{
enum ERemoteStoragePlatform {
k_ERemoteStoragePlatformNone = 0,
k_ERemoteStoragePlatformWindows = (1 << 0),
k_ERemoteStoragePlatformOSX = (1 << 1),
@ -73,17 +68,14 @@ enum ERemoteStoragePlatform
k_ERemoteStoragePlatformAll = 0xffffffff
};
enum ERemoteStoragePublishedFileVisibility
{
enum ERemoteStoragePublishedFileVisibility {
k_ERemoteStoragePublishedFileVisibilityPublic = 0,
k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1,
k_ERemoteStoragePublishedFileVisibilityPrivate = 2,
k_ERemoteStoragePublishedFileVisibilityUnlisted = 3,
};
enum EWorkshopFileType
{
enum EWorkshopFileType {
k_EWorkshopFileTypeFirst = 0,
k_EWorkshopFileTypeCommunity = 0, // normal Workshop item that can be subscribed to
@ -108,22 +100,19 @@ enum EWorkshopFileType
};
enum EWorkshopVote
{
enum EWorkshopVote {
k_EWorkshopVoteUnvoted = 0,
k_EWorkshopVoteFor = 1,
k_EWorkshopVoteAgainst = 2,
k_EWorkshopVoteLater = 3,
};
enum EWorkshopFileAction
{
enum EWorkshopFileAction {
k_EWorkshopFileActionPlayed = 0,
k_EWorkshopFileActionCompleted = 1,
};
enum EWorkshopEnumerationType
{
enum EWorkshopEnumerationType {
k_EWorkshopEnumerationTypeRankedByVote = 0,
k_EWorkshopEnumerationTypeRecent = 1,
k_EWorkshopEnumerationTypeTrending = 2,
@ -133,15 +122,12 @@ enum EWorkshopEnumerationType
k_EWorkshopEnumerationTypeRecentFromFollowedUsers = 6,
};
enum EWorkshopVideoProvider
{
enum EWorkshopVideoProvider {
k_EWorkshopVideoProviderNone = 0,
k_EWorkshopVideoProviderYoutube = 1
};
enum EUGCReadAction
{
enum EUGCReadAction {
// Keeps the file handle open unless the last byte is read. You can use this when reading large files (over 100MB) in sequential chunks.
// If the last byte is read, this will behave the same as k_EUGCRead_Close. Otherwise, it behaves the same as k_EUGCRead_ContinueReading.
// This value maintains the same behavior as before the EUGCReadAction parameter was introduced.
@ -156,14 +142,12 @@ enum EUGCReadAction
k_EUGCRead_Close = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing, reading and writing files stored remotely
// and cached locally
//-----------------------------------------------------------------------------
class ISteamRemoteStorage
{
public:
class ISteamRemoteStorage {
public:
// NOTE
//
// Filenames are case-insensitive, and will be converted to lowercase automatically.
@ -172,59 +156,59 @@ class ISteamRemoteStorage
//
// file operations
virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0;
virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0;
virtual bool FileWrite(const char* pchFile, const void* pvData, int32 cubData) = 0;
virtual int32 FileRead(const char* pchFile, void* pvData, int32 cubDataToRead) = 0;
STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0;
STEAM_CALL_RESULT(RemoteStorageFileWriteAsyncComplete_t)
virtual SteamAPICall_t FileWriteAsync(const char* pchFile, const void* pvData, uint32 cubData) = 0;
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;
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;
STEAM_CALL_RESULT( RemoteStorageFileShareResult_t )
virtual SteamAPICall_t FileShare( const char *pchFile ) = 0;
virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0;
virtual bool FileForget(const char* pchFile) = 0;
virtual bool FileDelete(const char* pchFile) = 0;
STEAM_CALL_RESULT(RemoteStorageFileShareResult_t)
virtual SteamAPICall_t FileShare(const char* pchFile) = 0;
virtual bool SetSyncPlatforms(const char* pchFile, ERemoteStoragePlatform eRemoteStoragePlatform) = 0;
// file operations that cause network IO
virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0;
virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0;
virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0;
virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0;
virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen(const char* pchFile) = 0;
virtual bool FileWriteStreamWriteChunk(UGCFileWriteStreamHandle_t writeHandle, const void* pvData, int32 cubData) = 0;
virtual bool FileWriteStreamClose(UGCFileWriteStreamHandle_t writeHandle) = 0;
virtual bool FileWriteStreamCancel(UGCFileWriteStreamHandle_t writeHandle) = 0;
// file information
virtual bool FileExists( const char *pchFile ) = 0;
virtual bool FilePersisted( const char *pchFile ) = 0;
virtual int32 GetFileSize( const char *pchFile ) = 0;
virtual int64 GetFileTimestamp( const char *pchFile ) = 0;
virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0;
virtual bool FileExists(const char* pchFile) = 0;
virtual bool FilePersisted(const char* pchFile) = 0;
virtual int32 GetFileSize(const char* pchFile) = 0;
virtual int64 GetFileTimestamp(const char* pchFile) = 0;
virtual ERemoteStoragePlatform GetSyncPlatforms(const char* pchFile) = 0;
// iteration
virtual int32 GetFileCount() = 0;
virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0;
virtual const char* GetFileNameAndSize(int iFile, int32* pnFileSizeInBytes) = 0;
// configuration management
virtual bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes ) = 0;
virtual bool GetQuota(uint64* pnTotalBytes, uint64* puAvailableBytes) = 0;
virtual bool IsCloudEnabledForAccount() = 0;
virtual bool IsCloudEnabledForApp() = 0;
virtual void SetCloudEnabledForApp( bool bEnabled ) = 0;
virtual void SetCloudEnabledForApp(bool bEnabled) = 0;
// user generated content
// 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.
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0;
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
// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0;
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, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_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.
@ -232,11 +216,11 @@ class ISteamRemoteStorage
// enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail
// unless UGCDownload is called again.
// For especially large files (anything over 100MB) it is a requirement that the file is read in chunks.
virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0;
virtual int32 UGCRead(UGCHandle_t hContent, void* pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction) = 0;
// Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead()
virtual int32 GetCachedUGCCount() = 0;
virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0;
virtual UGCHandle_t GetCachedUGCHandle(int32 iCachedContent) = 0;
// The following functions are only necessary on the Playstation 3. On PC & Mac, the Steam client will handle these operations for you
// On Playstation 3, the game controls which files are stored in the cloud, via FilePersist, FileFetch, and FileForget.
@ -245,9 +229,9 @@ class ISteamRemoteStorage
// Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback
virtual void GetFileListFromServer() = 0;
// Indicate this file should be downloaded in the next sync
virtual bool FileFetch( const char *pchFile ) = 0;
virtual bool FileFetch(const char* pchFile) = 0;
// Indicate this file should be persisted in the next sync
virtual bool FilePersist( const char *pchFile ) = 0;
virtual bool FilePersist(const char* pchFile) = 0;
// Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback
virtual bool SynchronizeToClient() = 0;
// Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback
@ -257,67 +241,67 @@ class ISteamRemoteStorage
#endif
// publishing UGC
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;
virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0;
virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0;
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;
STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0;
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;
virtual bool UpdatePublishedFilePreviewFile(PublishedFileUpdateHandle_t updateHandle, const char* pchPreviewFile) = 0;
virtual bool UpdatePublishedFileTitle(PublishedFileUpdateHandle_t updateHandle, const char* pchTitle) = 0;
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;
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.
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0;
STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
STEAM_CALL_RESULT(RemoteStorageGetPublishedFileDetailsResult_t)
virtual SteamAPICall_t GetPublishedFileDetails(PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld) = 0;
STEAM_CALL_RESULT(RemoteStorageDeletePublishedFileResult_t)
virtual SteamAPICall_t DeletePublishedFile(PublishedFileId_t unPublishedFileId) = 0;
// enumerate the files that the current user published with this app
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0;
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
STEAM_CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0;
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0;
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
STEAM_CALL_RESULT( RemoteStorageUpdateUserPublishedItemVoteResult_t )
virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0;
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0;
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;
STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t )
virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0;
STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0;
STEAM_CALL_RESULT(RemoteStorageEnumerateUserPublishedFilesResult_t)
virtual SteamAPICall_t EnumerateUserPublishedFiles(uint32 unStartIndex) = 0;
STEAM_CALL_RESULT(RemoteStorageSubscribePublishedFileResult_t)
virtual SteamAPICall_t SubscribePublishedFile(PublishedFileId_t unPublishedFileId) = 0;
STEAM_CALL_RESULT(RemoteStorageEnumerateUserSubscribedFilesResult_t)
virtual SteamAPICall_t EnumerateUserSubscribedFiles(uint32 unStartIndex) = 0;
STEAM_CALL_RESULT(RemoteStorageUnsubscribePublishedFileResult_t)
virtual SteamAPICall_t UnsubscribePublishedFile(PublishedFileId_t unPublishedFileId) = 0;
virtual bool UpdatePublishedFileSetChangeDescription(PublishedFileUpdateHandle_t updateHandle, const char* pchChangeDescription) = 0;
STEAM_CALL_RESULT(RemoteStorageGetPublishedItemVoteDetailsResult_t)
virtual SteamAPICall_t GetPublishedItemVoteDetails(PublishedFileId_t unPublishedFileId) = 0;
STEAM_CALL_RESULT(RemoteStorageUpdateUserPublishedItemVoteResult_t)
virtual SteamAPICall_t UpdateUserPublishedItemVote(PublishedFileId_t unPublishedFileId, bool bVoteUp) = 0;
STEAM_CALL_RESULT(RemoteStorageGetPublishedItemVoteDetailsResult_t)
virtual SteamAPICall_t GetUserPublishedItemVoteDetails(PublishedFileId_t unPublishedFileId) = 0;
STEAM_CALL_RESULT(RemoteStorageEnumerateUserPublishedFilesResult_t)
virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles(CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t* pRequiredTags, SteamParamStringArray_t* pExcludedTags) = 0;
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;
STEAM_CALL_RESULT(RemoteStorageSetUserPublishedFileActionResult_t)
virtual SteamAPICall_t SetUserPublishedFileAction(PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction) = 0;
STEAM_CALL_RESULT(RemoteStorageEnumeratePublishedFilesByUserActionResult_t)
virtual SteamAPICall_t EnumeratePublishedFilesByUserAction(EWorkshopFileAction eAction, uint32 unStartIndex) = 0;
// this method enumerates the public view of workshop files
STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0;
STEAM_CALL_RESULT(RemoteStorageEnumerateWorkshopFilesResult_t)
virtual SteamAPICall_t EnumeratePublishedWorkshopFiles(EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t* pTags, SteamParamStringArray_t* pUserTags) = 0;
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0;
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 );
inline ISteamRemoteStorage* SteamRemoteStorage();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamRemoteStorage*, SteamRemoteStorage, STEAMREMOTESTORAGE_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -326,8 +310,7 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamRemoteStorage *, SteamRemoteStorage,
// Purpose: sent when the local file cache is fully synced with the server for an app
// That means that an application can be started and has all latest files
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncedClient_t
{
struct RemoteStorageAppSyncedClient_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 1 };
AppId_t m_nAppID;
EResult m_eResult;
@ -338,8 +321,7 @@ struct RemoteStorageAppSyncedClient_t
// Purpose: sent when the server is fully synced with the local file cache for an app
// That means that we can shutdown Steam and our data is stored on the server
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncedServer_t
{
struct RemoteStorageAppSyncedServer_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 2 };
AppId_t m_nAppID;
EResult m_eResult;
@ -350,8 +332,7 @@ struct RemoteStorageAppSyncedServer_t
// Purpose: Status of up and downloads during a sync session
//
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncProgress_t
{
struct RemoteStorageAppSyncProgress_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 3 };
char m_rgchCurrentFile[k_cchFilenameMax]; // Current file being transferred
AppId_t m_nAppID; // App this info relates to
@ -364,98 +345,83 @@ struct RemoteStorageAppSyncProgress_t
// IMPORTANT! k_iClientRemoteStorageCallbacks + 4 is used, see iclientremotestorage.h
//
//-----------------------------------------------------------------------------
// Purpose: Sent after we've determined the list of files that are out of sync
// with the server.
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncStatusCheck_t
{
struct RemoteStorageAppSyncStatusCheck_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 5 };
AppId_t m_nAppID;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to FileShare()
//-----------------------------------------------------------------------------
struct RemoteStorageFileShareResult_t
{
struct RemoteStorageFileShareResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 };
EResult m_eResult; // The result of the operation
UGCHandle_t m_hFile; // The handle that can be shared with users and features
char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared
};
// k_iClientRemoteStorageCallbacks + 8 is deprecated! Do not reuse
//-----------------------------------------------------------------------------
// Purpose: The result of a call to PublishFile()
//-----------------------------------------------------------------------------
struct RemoteStoragePublishFileResult_t
{
struct RemoteStoragePublishFileResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 9 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to DeletePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageDeletePublishedFileResult_t
{
struct RemoteStorageDeletePublishedFileResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 11 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to EnumerateUserPublishedFiles()
//-----------------------------------------------------------------------------
struct RemoteStorageEnumerateUserPublishedFilesResult_t
{
struct RemoteStorageEnumerateUserPublishedFilesResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 12 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
PublishedFileId_t m_rgPublishedFileId[k_unEnumeratePublishedFilesMaxResults];
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to SubscribePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageSubscribePublishedFileResult_t
{
struct RemoteStorageSubscribePublishedFileResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 13 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to EnumerateSubscribePublishedFiles()
//-----------------------------------------------------------------------------
struct RemoteStorageEnumerateUserSubscribedFilesResult_t
{
struct RemoteStorageEnumerateUserSubscribedFilesResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 14 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
uint32 m_rgRTimeSubscribed[ k_unEnumeratePublishedFilesMaxResults ];
PublishedFileId_t m_rgPublishedFileId[k_unEnumeratePublishedFilesMaxResults];
uint32 m_rgRTimeSubscribed[k_unEnumeratePublishedFilesMaxResults];
};
#if defined(VALVE_CALLBACK_PACK_SMALL)
VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 );
VALVE_COMPILE_TIME_ASSERT(sizeof(RemoteStorageEnumerateUserSubscribedFilesResult_t) == (1 + 1 + 1 + 50 + 100) * 4);
#elif defined(VALVE_CALLBACK_PACK_LARGE)
VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 + 4 );
VALVE_COMPILE_TIME_ASSERT(sizeof(RemoteStorageEnumerateUserSubscribedFilesResult_t) == (1 + 1 + 1 + 50 + 100) * 4 + 4);
#else
#warning You must first include steam_api_common.h
#endif
@ -463,31 +429,26 @@ struct RemoteStorageEnumerateUserSubscribedFilesResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UnsubscribePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageUnsubscribePublishedFileResult_t
{
struct RemoteStorageUnsubscribePublishedFileResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 15 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to CommitPublishedFileUpdate()
//-----------------------------------------------------------------------------
struct RemoteStorageUpdatePublishedFileResult_t
{
struct RemoteStorageUpdatePublishedFileResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 16 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UGCDownload()
//-----------------------------------------------------------------------------
struct RemoteStorageDownloadUGCResult_t
{
struct RemoteStorageDownloadUGCResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 17 };
EResult m_eResult; // The result of the operation.
UGCHandle_t m_hFile; // The handle to the file that was attempted to be downloaded.
@ -497,12 +458,10 @@ struct RemoteStorageDownloadUGCResult_t
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetPublishedFileDetails()
//-----------------------------------------------------------------------------
struct RemoteStorageGetPublishedFileDetailsResult_t
{
struct RemoteStorageGetPublishedFileDetailsResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 18 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
@ -527,25 +486,21 @@ struct RemoteStorageGetPublishedFileDetailsResult_t
bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop
};
struct RemoteStorageEnumerateWorkshopFilesResult_t
{
struct RemoteStorageEnumerateWorkshopFilesResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 19 };
EResult m_eResult;
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ];
PublishedFileId_t m_rgPublishedFileId[k_unEnumeratePublishedFilesMaxResults];
float m_rgScore[k_unEnumeratePublishedFilesMaxResults];
AppId_t m_nAppId;
uint32 m_unStartIndex;
};
//-----------------------------------------------------------------------------
// Purpose: The result of GetPublishedItemVoteDetails
//-----------------------------------------------------------------------------
struct RemoteStorageGetPublishedItemVoteDetailsResult_t
{
struct RemoteStorageGetPublishedItemVoteDetailsResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 20 };
EResult m_eResult;
PublishedFileId_t m_unPublishedFileId;
@ -555,12 +510,10 @@ struct RemoteStorageGetPublishedItemVoteDetailsResult_t
float m_fScore;
};
//-----------------------------------------------------------------------------
// Purpose: User subscribed to a file for the app (from within the app or on the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileSubscribed_t
{
struct RemoteStoragePublishedFileSubscribed_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 21 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
@ -569,92 +522,78 @@ struct RemoteStoragePublishedFileSubscribed_t
//-----------------------------------------------------------------------------
// Purpose: User unsubscribed from a file for the app (from within the app or on the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileUnsubscribed_t
{
struct RemoteStoragePublishedFileUnsubscribed_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 22 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: Published file that a user owns was deleted (from within the app or the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileDeleted_t
{
struct RemoteStoragePublishedFileDeleted_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 23 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UpdateUserPublishedItemVote()
//-----------------------------------------------------------------------------
struct RemoteStorageUpdateUserPublishedItemVoteResult_t
{
struct RemoteStorageUpdateUserPublishedItemVoteResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 24 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetUserPublishedItemVoteDetails()
//-----------------------------------------------------------------------------
struct RemoteStorageUserVoteDetails_t
{
struct RemoteStorageUserVoteDetails_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 25 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
EWorkshopVote m_eVote; // what the user voted
};
struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t
{
struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 26 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
PublishedFileId_t m_rgPublishedFileId[k_unEnumeratePublishedFilesMaxResults];
};
struct RemoteStorageSetUserPublishedFileActionResult_t
{
struct RemoteStorageSetUserPublishedFileActionResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 27 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
EWorkshopFileAction m_eAction; // the action that was attempted
};
struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t
{
struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 28 };
EResult m_eResult; // The result of the operation.
EWorkshopFileAction m_eAction; // the action that was filtered on
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
uint32 m_rgRTimeUpdated[ k_unEnumeratePublishedFilesMaxResults ];
PublishedFileId_t m_rgPublishedFileId[k_unEnumeratePublishedFilesMaxResults];
uint32 m_rgRTimeUpdated[k_unEnumeratePublishedFilesMaxResults];
};
//-----------------------------------------------------------------------------
// Purpose: Called periodically while a PublishWorkshopFile is in progress
//-----------------------------------------------------------------------------
struct RemoteStoragePublishFileProgress_t
{
struct RemoteStoragePublishFileProgress_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 29 };
double m_dPercentFile;
bool m_bPreview;
};
//-----------------------------------------------------------------------------
// Purpose: Called when the content for a published file is updated
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileUpdated_t
{
struct RemoteStoragePublishedFileUpdated_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 30 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
@ -664,8 +603,7 @@ struct RemoteStoragePublishedFileUpdated_t
//-----------------------------------------------------------------------------
// Purpose: Called when a FileWriteAsync completes
//-----------------------------------------------------------------------------
struct RemoteStorageFileWriteAsyncComplete_t
{
struct RemoteStorageFileWriteAsyncComplete_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 31 };
EResult m_eResult; // result
};
@ -673,8 +611,7 @@ struct RemoteStorageFileWriteAsyncComplete_t
//-----------------------------------------------------------------------------
// Purpose: Called when a FileReadAsync completes
//-----------------------------------------------------------------------------
struct RemoteStorageFileReadAsyncComplete_t
{
struct RemoteStorageFileReadAsyncComplete_t {
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 32 };
SteamAPICall_t m_hFileReadAsync; // call handle of the async read which was made
EResult m_eResult; // result
@ -682,7 +619,6 @@ struct RemoteStorageFileReadAsyncComplete_t
uint32 m_cubRead; // amount read - will the <= the amount requested
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMREMOTESTORAGE_H

View File

@ -25,8 +25,7 @@ const int k_ScreenshotThumbWidth = 200;
typedef uint32 ScreenshotHandle;
#define INVALID_SCREENSHOT_HANDLE 0
enum EVRScreenshotType
{
enum EVRScreenshotType {
k_EVRScreenshotType_None = 0,
k_EVRScreenshotType_Mono = 1,
k_EVRScreenshotType_Stereo = 2,
@ -38,18 +37,17 @@ enum EVRScreenshotType
//-----------------------------------------------------------------------------
// Purpose: Functions for adding screenshots to the user's screenshot library
//-----------------------------------------------------------------------------
class ISteamScreenshots
{
class ISteamScreenshots {
public:
// Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
virtual ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight ) = 0;
virtual ScreenshotHandle WriteScreenshot(void* pubRGB, uint32 cubRGB, int nWidth, int nHeight) = 0;
// Adds a screenshot to the user's screenshot library from disk. If a thumbnail is provided, it must be 200 pixels wide and the same aspect ratio
// as the screenshot, otherwise a thumbnail will be generated if the user uploads the screenshot. The screenshots must be in either JPEG or TGA format.
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
// JPEG, TGA, and PNG formats are supported.
virtual ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight ) = 0;
virtual ScreenshotHandle AddScreenshotToLibrary(const char* pchFilename, const char* pchThumbnailFilename, int nWidth, int nHeight) = 0;
// Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead.
virtual void TriggerScreenshot() = 0;
@ -57,16 +55,16 @@ public:
// Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots,
// then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary
// in response.
virtual void HookScreenshots( bool bHook ) = 0;
virtual void HookScreenshots(bool bHook) = 0;
// Sets metadata about a screenshot's location (for example, the name of the map)
virtual bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) = 0;
virtual bool SetLocation(ScreenshotHandle hScreenshot, const char* pchLocation) = 0;
// Tags a user as being visible in the screenshot
virtual bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) = 0;
virtual bool TagUser(ScreenshotHandle hScreenshot, CSteamID steamID) = 0;
// Tags a published file as being visible in the screenshot
virtual bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID ) = 0;
virtual bool TagPublishedFile(ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID) = 0;
// Returns true if the app has hooked the screenshot
virtual bool IsScreenshotsHooked() = 0;
@ -76,20 +74,20 @@ public:
// pchVRFilename should contain the image that matches the correct type
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
// JPEG, TGA, and PNG formats are supported.
virtual ScreenshotHandle AddVRScreenshotToLibrary( EVRScreenshotType eType, const char *pchFilename, const char *pchVRFilename ) = 0;
virtual ScreenshotHandle AddVRScreenshotToLibrary(EVRScreenshotType eType, const char* pchFilename, const char* pchVRFilename) = 0;
};
#define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION003"
// Global interface accessor
inline ISteamScreenshots *SteamScreenshots();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamScreenshots *, SteamScreenshots, STEAMSCREENSHOTS_INTERFACE_VERSION );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -97,8 +95,7 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamScreenshots *, SteamScreenshots, STE
// Purpose: Screenshot successfully written or otherwise added to the library
// and can now be tagged
//-----------------------------------------------------------------------------
struct ScreenshotReady_t
{
struct ScreenshotReady_t {
enum { k_iCallback = k_iSteamScreenshotsCallbacks + 1 };
ScreenshotHandle m_hLocal;
EResult m_eResult;
@ -109,12 +106,10 @@ struct ScreenshotReady_t
// HookScreenshots() has been called, in which case Steam will not take
// the screenshot itself.
//-----------------------------------------------------------------------------
struct ScreenshotRequested_t
{
struct ScreenshotRequested_t {
enum { k_iCallback = k_iSteamScreenshotsCallbacks + 2 };
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMSCREENSHOTS_H

View File

@ -10,30 +10,26 @@
#pragma once
#endif
#include "steam_api_common.h"
#include "isteamremotestorage.h"
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
typedef uint64 UGCQueryHandle_t;
typedef uint64 UGCUpdateHandle_t;
const UGCQueryHandle_t k_UGCQueryHandleInvalid = 0xffffffffffffffffull;
const UGCUpdateHandle_t k_UGCUpdateHandleInvalid = 0xffffffffffffffffull;
// Matching UGC types for queries
enum EUGCMatchingUGCType
{
enum EUGCMatchingUGCType {
k_EUGCMatchingUGCType_Items = 0, // both mtx items and ready-to-use items
k_EUGCMatchingUGCType_Items_Mtx = 1,
k_EUGCMatchingUGCType_Items_ReadyToUse = 2,
@ -52,8 +48,7 @@ enum EUGCMatchingUGCType
// Different lists of published UGC for a user.
// If the current logged in user is different than the specified user, then some options may not be allowed.
enum EUserUGCList
{
enum EUserUGCList {
k_EUserUGCList_Published,
k_EUserUGCList_VotedOn,
k_EUserUGCList_VotedUp,
@ -66,8 +61,7 @@ enum EUserUGCList
};
// Sort order for user published UGC lists (defaults to creation order descending)
enum EUserUGCListSortOrder
{
enum EUserUGCListSortOrder {
k_EUserUGCListSortOrder_CreationOrderDesc,
k_EUserUGCListSortOrder_CreationOrderAsc,
k_EUserUGCListSortOrder_TitleAsc,
@ -78,8 +72,7 @@ enum EUserUGCListSortOrder
};
// Combination of sorting and filtering for queries across all UGC
enum EUGCQuery
{
enum EUGCQuery {
k_EUGCQuery_RankedByVote = 0,
k_EUGCQuery_RankedByPublicationDate = 1,
k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate = 2,
@ -101,8 +94,7 @@ enum EUGCQuery
k_EUGCQuery_RankedByLifetimePlaytimeSessions = 18,
};
enum EItemUpdateStatus
{
enum EItemUpdateStatus {
k_EItemUpdateStatusInvalid = 0, // The item update handle was invalid, job might be finished, listen too SubmitItemUpdateResult_t
k_EItemUpdateStatusPreparingConfig = 1, // The item update is processing configuration data
k_EItemUpdateStatusPreparingContent = 2, // The item update is reading and processing content files
@ -111,8 +103,7 @@ enum EItemUpdateStatus
k_EItemUpdateStatusCommittingChanges = 5 // The item update is committing all changes
};
enum EItemState
{
enum EItemState {
k_EItemStateNone = 0, // item not tracked on client
k_EItemStateSubscribed = 1, // current user is subscribed to this item. Not just cached.
k_EItemStateLegacyItem = 2, // item was created with ISteamRemoteStorage
@ -122,8 +113,7 @@ enum EItemState
k_EItemStateDownloadPending = 32, // DownloadItem() was called for this item, content isn't available until DownloadItemResult_t is fired
};
enum EItemStatistic
{
enum EItemStatistic {
k_EItemStatistic_NumSubscriptions = 0,
k_EItemStatistic_NumFavorites = 1,
k_EItemStatistic_NumFollowers = 2,
@ -139,8 +129,7 @@ enum EItemStatistic
k_EItemStatistic_NumPlaytimeSessionsDuringTimePeriod = 12,
};
enum EItemPreviewType
{
enum EItemPreviewType {
k_EItemPreviewType_Image = 0, // standard image file expected (e.g. jpg, png, gif, etc.)
k_EItemPreviewType_YouTubeVideo = 1, // video id is stored
k_EItemPreviewType_Sketchfab = 2, // model id is stored
@ -160,8 +149,7 @@ const uint32 kNumUGCResultsPerPage = 50;
const uint32 k_cchDeveloperMetadataMax = 5000;
// Details for a single published file/UGC
struct SteamUGCDetails_t
{
struct SteamUGCDetails_t {
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult; // The result of the operation.
EWorkshopFileType m_eFileType; // Type of the file
@ -196,187 +184,184 @@ struct SteamUGCDetails_t
//-----------------------------------------------------------------------------
// Purpose: Steam UGC support API
//-----------------------------------------------------------------------------
class ISteamUGC
{
class ISteamUGC {
public:
// Query UGC associated with a user. 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 CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
virtual UGCQueryHandle_t CreateQueryUserUGCRequest(AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage) = 0;
// 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.
STEAM_FLAT_NAME( CreateQueryAllUGCRequestPage )
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
STEAM_FLAT_NAME(CreateQueryAllUGCRequestPage)
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.
STEAM_FLAT_NAME( CreateQueryAllUGCRequestCursor )
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL ) = 0;
STEAM_FLAT_NAME(CreateQueryAllUGCRequestCursor)
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;
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest(PublishedFileId_t* pvecPublishedFileID, uint32 unNumPublishedFileIDs) = 0;
// Send the query to Steam
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
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 uint32 GetQueryUGCNumTags( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCTag( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 0;
virtual bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT( cchValueSize ) char* pchValue, uint32 cchValueSize ) = 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, 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, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
virtual bool GetQueryUGCResult(UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t* pDetails) = 0;
virtual uint32 GetQueryUGCNumTags(UGCQueryHandle_t handle, uint32 index) = 0;
virtual bool GetQueryUGCTag(UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT(cchValueSize) char* pchValue, uint32 cchValueSize) = 0;
virtual bool GetQueryUGCTagDisplayName(UGCQueryHandle_t handle, uint32 index, uint32 indexTag, STEAM_OUT_STRING_COUNT(cchValueSize) char* pchValue, uint32 cchValueSize) = 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, 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, STEAM_OUT_STRING_COUNT(cchKeySize) char* pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char* pchValue, uint32 cchValueSize) = 0;
// Return the first value matching the pchKey. Note that a key may map to multiple values. Returns false if there was an error or no matching value was found.
STEAM_FLAT_NAME( GetQueryFirstUGCKeyValueTag )
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
STEAM_FLAT_NAME(GetQueryFirstUGCKeyValueTag)
virtual bool GetQueryUGCKeyValueTag(UGCQueryHandle_t handle, uint32 index, const char* pchKey, 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;
virtual bool ReleaseQueryUGCRequest(UGCQueryHandle_t handle) = 0;
// Options to set for querying UGC
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool AddRequiredTagGroup( UGCQueryHandle_t handle, const SteamParamStringArray_t *pTagGroups ) = 0; // match any of the tags in this group
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) = 0;
virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0;
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0;
virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0;
virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0;
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
virtual bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays ) = 0;
virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0;
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
virtual bool AddRequiredTag(UGCQueryHandle_t handle, const char* pTagName) = 0;
virtual bool AddRequiredTagGroup(UGCQueryHandle_t handle, const SteamParamStringArray_t* pTagGroups) = 0; // match any of the tags in this group
virtual bool AddExcludedTag(UGCQueryHandle_t handle, const char* pTagName) = 0;
virtual bool SetReturnOnlyIDs(UGCQueryHandle_t handle, bool bReturnOnlyIDs) = 0;
virtual bool SetReturnKeyValueTags(UGCQueryHandle_t handle, bool bReturnKeyValueTags) = 0;
virtual bool SetReturnLongDescription(UGCQueryHandle_t handle, bool bReturnLongDescription) = 0;
virtual bool SetReturnMetadata(UGCQueryHandle_t handle, bool bReturnMetadata) = 0;
virtual bool SetReturnChildren(UGCQueryHandle_t handle, bool bReturnChildren) = 0;
virtual bool SetReturnAdditionalPreviews(UGCQueryHandle_t handle, bool bReturnAdditionalPreviews) = 0;
virtual bool SetReturnTotalOnly(UGCQueryHandle_t handle, bool bReturnTotalOnly) = 0;
virtual bool SetReturnPlaytimeStats(UGCQueryHandle_t handle, uint32 unDays) = 0;
virtual bool SetLanguage(UGCQueryHandle_t handle, const char* pchLanguage) = 0;
virtual bool SetAllowCachedResponse(UGCQueryHandle_t handle, uint32 unMaxAgeSeconds) = 0;
// Options only for querying user UGC
virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0;
virtual bool SetCloudFileNameFilter(UGCQueryHandle_t handle, const char* pMatchCloudFileName) = 0;
// Options only for querying all UGC
virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0;
virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0;
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0;
virtual bool SetMatchAnyTag(UGCQueryHandle_t handle, bool bMatchAnyTag) = 0;
virtual bool SetSearchText(UGCQueryHandle_t handle, const char* pSearchText) = 0;
virtual bool SetRankedByTrendDays(UGCQueryHandle_t handle, uint32 unDays) = 0;
virtual bool AddRequiredKeyValueTag(UGCQueryHandle_t handle, const char* pKey, const char* pValue) = 0;
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
STEAM_CALL_RESULT( SteamUGCRequestUGCDetailsResult_t )
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
STEAM_CALL_RESULT(SteamUGCRequestUGCDetailsResult_t)
virtual SteamAPICall_t RequestUGCDetails(PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds) = 0;
// Steam Workshop Creator API
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
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()
virtual UGCUpdateHandle_t StartItemUpdate(AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()
virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item
virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item
virtual bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item
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 RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle ) = 0; // remove all existing key-value tags (you can add new ones via the AddItemKeyValueTag function)
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
virtual bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) = 0; // add preview video for this item
virtual bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
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)
virtual bool SetItemTitle(UGCUpdateHandle_t handle, const char* pchTitle) = 0; // change the title of an UGC item
virtual bool SetItemDescription(UGCUpdateHandle_t handle, const char* pchDescription) = 0; // change the description of an UGC item
virtual bool SetItemUpdateLanguage(UGCUpdateHandle_t handle, const char* pchLanguage) = 0; // specify the language of the title or description that will be set
virtual bool SetItemMetadata(UGCUpdateHandle_t handle, const char* pchMetaData) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
virtual bool SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility) = 0; // change the visibility of an UGC item
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 RemoveAllItemKeyValueTags(UGCUpdateHandle_t handle) = 0; // remove all existing key-value tags (you can add new ones via the AddItemKeyValueTag function)
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
virtual bool AddItemPreviewVideo(UGCUpdateHandle_t handle, const char* pszVideoID) = 0; // add preview video for this item
virtual bool UpdateItemPreviewFile(UGCUpdateHandle_t handle, uint32 index, const char* pszPreviewFile) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
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)
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_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
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0;
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
STEAM_CALL_RESULT(SetUserItemVoteResult_t)
virtual SteamAPICall_t SetUserItemVote(PublishedFileId_t nPublishedFileID, bool bVoteUp) = 0;
STEAM_CALL_RESULT(GetUserItemVoteResult_t)
virtual SteamAPICall_t GetUserItemVote(PublishedFileId_t nPublishedFileID) = 0;
STEAM_CALL_RESULT(UserFavoriteItemsListChanged_t)
virtual SteamAPICall_t AddItemToFavorites(AppId_t nAppId, PublishedFileId_t nPublishedFileID) = 0;
STEAM_CALL_RESULT(UserFavoriteItemsListChanged_t)
virtual SteamAPICall_t RemoveItemFromFavorites(AppId_t nAppId, PublishedFileId_t nPublishedFileID) = 0;
STEAM_CALL_RESULT(RemoteStorageSubscribePublishedFileResult_t)
virtual SteamAPICall_t SubscribeItem(PublishedFileId_t nPublishedFileID) = 0; // subscribe to this item, will be installed ASAP
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
virtual uint32 GetSubscribedItems(PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries) = 0; // all subscribed item PublishFileIDs
// get EItemState flags about item on this client
virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0;
virtual uint32 GetItemState(PublishedFileId_t nPublishedFileID) = 0;
// 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, STEAM_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;
virtual bool GetItemDownloadInfo(PublishedFileId_t nPublishedFileID, uint64* punBytesDownloaded, uint64* punBytesTotal) = 0;
// download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,
// then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0;
virtual bool DownloadItem(PublishedFileId_t nPublishedFileID, bool bHighPriority) = 0;
// game servers can set a specific workshop folder before issuing any UGC commands.
// This is helpful if you want to support multiple game servers running out of the same install folder
virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0;
virtual bool BInitWorkshopForGameServer(DepotId_t unWorkshopDepotID, const char* pszFolder) = 0;
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
virtual void SuspendDownloads( bool bSuspend ) = 0;
virtual void SuspendDownloads(bool bSuspend) = 0;
// usage tracking
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
virtual SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
virtual SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
STEAM_CALL_RESULT(StartPlaytimeTrackingResult_t)
virtual SteamAPICall_t StartPlaytimeTracking(PublishedFileId_t* pvecPublishedFileID, uint32 unNumPublishedFileIDs) = 0;
STEAM_CALL_RESULT(StopPlaytimeTrackingResult_t)
virtual SteamAPICall_t StopPlaytimeTracking(PublishedFileId_t* pvecPublishedFileID, uint32 unNumPublishedFileIDs) = 0;
STEAM_CALL_RESULT(StopPlaytimeTrackingResult_t)
virtual SteamAPICall_t StopPlaytimeTrackingForAllItems() = 0;
// parent-child relationship or dependency management
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
virtual SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
virtual SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
STEAM_CALL_RESULT(AddUGCDependencyResult_t)
virtual SteamAPICall_t AddDependency(PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID) = 0;
STEAM_CALL_RESULT(RemoveUGCDependencyResult_t)
virtual SteamAPICall_t RemoveDependency(PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID) = 0;
// add/remove app dependence/requirements (usually DLC)
STEAM_CALL_RESULT( AddAppDependencyResult_t )
virtual SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
virtual SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
STEAM_CALL_RESULT(AddAppDependencyResult_t)
virtual SteamAPICall_t AddAppDependency(PublishedFileId_t nPublishedFileID, AppId_t nAppID) = 0;
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
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
virtual SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT(GetAppDependenciesResult_t)
virtual SteamAPICall_t GetAppDependencies(PublishedFileId_t nPublishedFileID) = 0;
// delete the item without prompting the user
STEAM_CALL_RESULT( DeleteItemResult_t )
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT(DeleteItemResult_t)
virtual SteamAPICall_t DeleteItem(PublishedFileId_t nPublishedFileID) = 0;
};
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION015"
// Global interface accessor
inline ISteamUGC *SteamUGC();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUGC *, SteamUGC, STEAMUGC_INTERFACE_VERSION );
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 );
inline ISteamUGC* SteamGameServerUGC();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(ISteamUGC*, SteamGameServerUGC, STEAMUGC_INTERFACE_VERSION);
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
//-----------------------------------------------------------------------------
struct SteamUGCQueryCompleted_t
{
struct SteamUGCQueryCompleted_t {
enum { k_iCallback = k_iClientUGCCallbacks + 1 };
UGCQueryHandle_t m_handle;
EResult m_eResult;
@ -386,58 +371,48 @@ struct SteamUGCQueryCompleted_t
char m_rgchNextCursor[k_cchPublishedFileURLMax]; // If a paging cursor was used, then this will be the next cursor to get the next result set.
};
//-----------------------------------------------------------------------------
// Purpose: Callback for requesting details on one piece of UGC
//-----------------------------------------------------------------------------
struct SteamUGCRequestUGCDetailsResult_t
{
struct SteamUGCRequestUGCDetailsResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 2 };
SteamUGCDetails_t m_details;
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
};
//-----------------------------------------------------------------------------
// Purpose: result for ISteamUGC::CreateItem()
//-----------------------------------------------------------------------------
struct CreateItemResult_t
{
struct CreateItemResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 3 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId; // new item got this UGC PublishFileID
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: result for ISteamUGC::SubmitItemUpdate()
//-----------------------------------------------------------------------------
struct SubmitItemUpdateResult_t
{
struct SubmitItemUpdateResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 4 };
EResult m_eResult;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: a Workshop item has been installed or updated
//-----------------------------------------------------------------------------
struct ItemInstalled_t
{
struct ItemInstalled_t {
enum { k_iCallback = k_iClientUGCCallbacks + 5 };
AppId_t m_unAppID;
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: result of DownloadItem(), existing item files can be accessed again
//-----------------------------------------------------------------------------
struct DownloadItemResult_t
{
struct DownloadItemResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 6 };
AppId_t m_unAppID;
PublishedFileId_t m_nPublishedFileId;
@ -447,8 +422,7 @@ struct DownloadItemResult_t
//-----------------------------------------------------------------------------
// Purpose: result of AddItemToFavorites() or RemoveItemFromFavorites()
//-----------------------------------------------------------------------------
struct UserFavoriteItemsListChanged_t
{
struct UserFavoriteItemsListChanged_t {
enum { k_iCallback = k_iClientUGCCallbacks + 7 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
@ -458,8 +432,7 @@ struct UserFavoriteItemsListChanged_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to SetUserItemVote()
//-----------------------------------------------------------------------------
struct SetUserItemVoteResult_t
{
struct SetUserItemVoteResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 8 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
@ -469,8 +442,7 @@ struct SetUserItemVoteResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetUserItemVote()
//-----------------------------------------------------------------------------
struct GetUserItemVoteResult_t
{
struct GetUserItemVoteResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 9 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
@ -482,8 +454,7 @@ struct GetUserItemVoteResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to StartPlaytimeTracking()
//-----------------------------------------------------------------------------
struct StartPlaytimeTrackingResult_t
{
struct StartPlaytimeTrackingResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 10 };
EResult m_eResult;
};
@ -491,8 +462,7 @@ struct StartPlaytimeTrackingResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to StopPlaytimeTracking()
//-----------------------------------------------------------------------------
struct StopPlaytimeTrackingResult_t
{
struct StopPlaytimeTrackingResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 11 };
EResult m_eResult;
};
@ -500,8 +470,7 @@ struct StopPlaytimeTrackingResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to AddDependency
//-----------------------------------------------------------------------------
struct AddUGCDependencyResult_t
{
struct AddUGCDependencyResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 12 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
@ -511,20 +480,17 @@ struct AddUGCDependencyResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to RemoveDependency
//-----------------------------------------------------------------------------
struct RemoveUGCDependencyResult_t
{
struct RemoveUGCDependencyResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 13 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
PublishedFileId_t m_nChildPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to AddAppDependency
//-----------------------------------------------------------------------------
struct AddAppDependencyResult_t
{
struct AddAppDependencyResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 14 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
@ -534,8 +500,7 @@ struct AddAppDependencyResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to RemoveAppDependency
//-----------------------------------------------------------------------------
struct RemoveAppDependencyResult_t
{
struct RemoveAppDependencyResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 15 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
@ -546,8 +511,7 @@ struct RemoveAppDependencyResult_t
// Purpose: The result of a call to GetAppDependencies. Callback may be called
// multiple times until all app dependencies have been returned.
//-----------------------------------------------------------------------------
struct GetAppDependenciesResult_t
{
struct GetAppDependenciesResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 16 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
@ -559,13 +523,12 @@ struct GetAppDependenciesResult_t
//-----------------------------------------------------------------------------
// Purpose: The result of a call to DeleteItem
//-----------------------------------------------------------------------------
struct DeleteItemResult_t
{
struct DeleteItemResult_t {
enum { k_iCallback = k_iClientUGCCallbacks + 17 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId;
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMUGC_H

View File

@ -16,8 +16,7 @@
// Purpose: Functions for accessing and manipulating a steam account
// associated with one client instance
//-----------------------------------------------------------------------------
class ISteamUser
{
class ISteamUser {
public:
// returns the HSteamUser this interface represents
// this is only used internally by the API, and by a few select interfaces that support multi-user
@ -47,34 +46,34 @@ public:
//
// return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed
// The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process.
virtual int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) = 0;
virtual int InitiateGameConnection(void* pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure) = 0;
// notify of disconnect
// needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call
virtual void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) = 0;
virtual void TerminateGameConnection(uint32 unIPServer, uint16 usPortServer) = 0;
// Legacy functions
// used by only a few games to track usage events
virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0;
virtual void TrackAppUsageEvent(CGameID gameID, int eAppUsageEvent, const char* pchExtraInfo = "") = 0;
// get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
// this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0;
virtual bool GetUserDataFolder(char* pchBuffer, int cubBuffer) = 0;
// Starts voice recording. Once started, use GetVoice() to get the data
virtual void StartVoiceRecording( ) = 0;
virtual void StartVoiceRecording() = 0;
// Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for
// a little bit after this function is called. GetVoice() should continue to be called until it returns
// k_eVoiceResultNotRecording
virtual void StopVoiceRecording( ) = 0;
virtual void StopVoiceRecording() = 0;
// Determine the size of captured audio data that is available from GetVoice.
// Most applications will only use compressed data and should ignore the other
// parameters, which exist primarily for backwards compatibility. See comments
// below for further explanation of "uncompressed" data.
virtual EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0 ) = 0;
virtual EVoiceResult GetAvailableVoice(uint32* pcbCompressed, uint32* pcbUncompressed_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0) = 0;
// ---------------------------------------------------------------------------
// NOTE: "uncompressed" audio is a deprecated feature and should not be used
@ -97,7 +96,7 @@ public:
// compressed data and should pass NULL/zero for the "uncompressed" parameters.
// Compressed data can be transmitted by your application and decoded into raw
// using the DecompressVoice function below.
virtual EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed_Deprecated = false, void *pUncompressedDestBuffer_Deprecated = 0, uint32 cbUncompressedDestBufferSize_Deprecated = 0, uint32 *nUncompressBytesWritten_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0 ) = 0;
virtual EVoiceResult GetVoice(bool bWantCompressed, void* pDestBuffer, uint32 cbDestBufferSize, uint32* nBytesWritten, bool bWantUncompressed_Deprecated = false, void* pUncompressedDestBuffer_Deprecated = 0, uint32 cbUncompressedDestBufferSize_Deprecated = 0, uint32* nUncompressBytesWritten_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0) = 0;
// Decodes the compressed voice data returned by GetVoice. The output data is
// raw single-channel 16-bit PCM audio. The decoder supports any sample rate
@ -105,7 +104,7 @@ public:
// If the output buffer is not large enough, then *nBytesWritten will be set
// to the required buffer size, and k_EVoiceResultBufferTooSmall is returned.
// It is suggested to start with a 20kb buffer and reallocate as necessary.
virtual EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate ) = 0;
virtual EVoiceResult DecompressVoice(const void* pCompressed, uint32 cbCompressed, void* pDestBuffer, uint32 cbDestBufferSize, uint32* nBytesWritten, uint32 nDesiredSampleRate) = 0;
// This returns the native sample rate of the Steam voice decompressor; using
// this sample rate for DecompressVoice will perform the least CPU processing.
@ -118,21 +117,21 @@ public:
// Retrieve ticket to be sent to the entity who wishes to authenticate you.
// pcbTicket retrieves the length of the actual ticket.
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
virtual HAuthTicket GetAuthSessionTicket(void* pTicket, int cbMaxTicket, uint32* pcbTicket) = 0;
// Authenticate ticket from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
virtual EBeginAuthSessionResult BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, CSteamID steamID) = 0;
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
virtual void EndAuthSession( CSteamID steamID ) = 0;
virtual void EndAuthSession(CSteamID steamID) = 0;
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
virtual void CancelAuthTicket(HAuthTicket hAuthTicket) = 0;
// After receiving a user's authentication data, and passing it to BeginAuthSession, use this function
// to determine if the user owns downloadable content specified by the provided AppID.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
virtual EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID) = 0;
// returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam
// (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.
@ -141,13 +140,13 @@ public:
// set data to be replicated to friends so that they can join your game
// CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
virtual void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer ) = 0;
virtual void AdvertiseGame(CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer) = 0;
// 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 )
STEAM_CALL_RESULT( EncryptedAppTicketResponse_t )
virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0;
STEAM_CALL_RESULT(EncryptedAppTicketResponse_t)
virtual SteamAPICall_t RequestEncryptedAppTicket(void* pDataToInclude, int cbDataToInclude) = 0;
// Retrieves a finished ticket.
// If no ticket is available, or your buffer is too small, returns false.
@ -155,12 +154,12 @@ public:
// (if true was returned), or the size needed (if false was returned). To determine the
// proper size of the ticket, you can pass pTicket=NULL and cbMaxTicket=0; if a ticket
// is available, *pcbTicket will contain the size needed, otherwise it will be zero.
virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
virtual bool GetEncryptedAppTicket(void* pTicket, int cbMaxTicket, uint32* pcbTicket) = 0;
// Trading Card badges data access
// if you only have one set of cards, the series will be 1
// the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)
virtual int GetGameBadgeLevel( int nSeries, bool bFoil ) = 0;
virtual int GetGameBadgeLevel(int nSeries, bool bFoil) = 0;
// gets the Steam Level of the user, as shown on their profile
virtual int GetPlayerSteamLevel() = 0;
@ -175,8 +174,8 @@ 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.
STEAM_CALL_RESULT( StoreAuthURLResponse_t )
virtual SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL ) = 0;
STEAM_CALL_RESULT(StoreAuthURLResponse_t)
virtual SteamAPICall_t RequestStoreAuthURL(const char* pchRedirectURL) = 0;
// gets whether the users phone number is verified
virtual bool BIsPhoneVerified() = 0;
@ -190,31 +189,30 @@ public:
// gets whether the users phone number is awaiting (re)verification
virtual bool BIsPhoneRequiringVerification() = 0;
STEAM_CALL_RESULT( MarketEligibilityResponse_t )
STEAM_CALL_RESULT(MarketEligibilityResponse_t)
virtual SteamAPICall_t GetMarketEligibility() = 0;
// Retrieves anti indulgence / duration control for current user
STEAM_CALL_RESULT( DurationControl_t )
STEAM_CALL_RESULT(DurationControl_t)
virtual SteamAPICall_t GetDurationControl() = 0;
// Advise steam china duration control system about the online state of the game.
// This will prevent offline gameplay time from counting against a user's
// playtime limits.
virtual bool BSetDurationControlOnlineState( EDurationControlOnlineState eNewState ) = 0;
virtual bool BSetDurationControlOnlineState(EDurationControlOnlineState eNewState) = 0;
};
#define STEAMUSER_INTERFACE_VERSION "SteamUser021"
// Global interface accessor
inline ISteamUser *SteamUser();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUser *, SteamUser, STEAMUSER_INTERFACE_VERSION );
inline ISteamUser* SteamUser();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamUser*, SteamUser, STEAMUSER_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -226,8 +224,7 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUser *, SteamUser, STEAMUSER_INTERFA
// only be seen if the user has dropped connection due to a networking issue
// or a Steam server update
//-----------------------------------------------------------------------------
struct SteamServersConnected_t
{
struct SteamServersConnected_t {
enum { k_iCallback = k_iSteamUserCallbacks + 1 };
};
@ -236,33 +233,28 @@ struct SteamServersConnected_t
// this will occur periodically if the Steam client is not connected,
// and has failed in it's retry to establish a connection
//-----------------------------------------------------------------------------
struct SteamServerConnectFailure_t
{
struct SteamServerConnectFailure_t {
enum { k_iCallback = k_iSteamUserCallbacks + 2 };
EResult m_eResult;
bool m_bStillRetrying;
};
//-----------------------------------------------------------------------------
// Purpose: called if the client has lost connection to the Steam servers
// real-time services will be disabled until a matching SteamServersConnected_t has been posted
//-----------------------------------------------------------------------------
struct SteamServersDisconnected_t
{
struct SteamServersDisconnected_t {
enum { k_iCallback = k_iSteamUserCallbacks + 3 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Sent by the Steam server to the client telling it to disconnect from the specified game server,
// which it may be in the process of or already connected to.
// The game client should immediately disconnect upon receiving this message.
// This can usually occur if the user doesn't have rights to play on the game server.
//-----------------------------------------------------------------------------
struct ClientGameServerDeny_t
{
struct ClientGameServerDeny_t {
enum { k_iCallback = k_iSteamUserCallbacks + 13 };
uint32 m_uAppID;
@ -272,50 +264,41 @@ struct ClientGameServerDeny_t
uint32 m_uReason;
};
//-----------------------------------------------------------------------------
// Purpose: called when the callback system for this client is in an error state (and has flushed pending callbacks)
// When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect.
// This usually occurs in the rare event the Steam client has some kind of fatal error.
//-----------------------------------------------------------------------------
struct IPCFailure_t
{
struct IPCFailure_t {
enum { k_iCallback = k_iSteamUserCallbacks + 17 };
enum EFailureType
{
enum EFailureType {
k_EFailureFlushedCallbackQueue,
k_EFailurePipeFail,
};
uint8 m_eFailureType;
};
//-----------------------------------------------------------------------------
// Purpose: Signaled whenever licenses change
//-----------------------------------------------------------------------------
struct LicensesUpdated_t
{
struct LicensesUpdated_t {
enum { k_iCallback = k_iSteamUserCallbacks + 25 };
};
//-----------------------------------------------------------------------------
// callback for BeginAuthSession
//-----------------------------------------------------------------------------
struct ValidateAuthTicketResponse_t
{
struct ValidateAuthTicketResponse_t {
enum { k_iCallback = k_iSteamUserCallbacks + 43 };
CSteamID m_SteamID;
EAuthSessionResponse m_eAuthSessionResponse;
CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed
};
//-----------------------------------------------------------------------------
// Purpose: called when a user has responded to a microtransaction authorization request
//-----------------------------------------------------------------------------
struct MicroTxnAuthorizationResponse_t
{
struct MicroTxnAuthorizationResponse_t {
enum { k_iCallback = k_iSteamUserCallbacks + 52 };
uint32 m_unAppID; // AppID for this microtransaction
@ -323,12 +306,10 @@ struct MicroTxnAuthorizationResponse_t
uint8 m_bAuthorized; // if user authorized transaction
};
//-----------------------------------------------------------------------------
// Purpose: Result from RequestEncryptedAppTicket
//-----------------------------------------------------------------------------
struct EncryptedAppTicketResponse_t
{
struct EncryptedAppTicketResponse_t {
enum { k_iCallback = k_iSteamUserCallbacks + 54 };
EResult m_eResult;
@ -337,19 +318,16 @@ struct EncryptedAppTicketResponse_t
//-----------------------------------------------------------------------------
// callback for GetAuthSessionTicket
//-----------------------------------------------------------------------------
struct GetAuthSessionTicketResponse_t
{
struct GetAuthSessionTicketResponse_t {
enum { k_iCallback = k_iSteamUserCallbacks + 63 };
HAuthTicket m_hAuthTicket;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to a steam://gamewebcallback/ command
//-----------------------------------------------------------------------------
struct GameWebCallback_t
{
struct GameWebCallback_t {
enum { k_iCallback = k_iSteamUserCallbacks + 64 };
char m_szURL[256];
};
@ -357,18 +335,15 @@ struct GameWebCallback_t
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to ISteamUser::RequestStoreAuthURL
//-----------------------------------------------------------------------------
struct StoreAuthURLResponse_t
{
struct StoreAuthURLResponse_t {
enum { k_iCallback = k_iSteamUserCallbacks + 65 };
char m_szURL[512];
};
//-----------------------------------------------------------------------------
// Purpose: sent in response to ISteamUser::GetMarketEligibility
//-----------------------------------------------------------------------------
struct MarketEligibilityResponse_t
{
struct MarketEligibilityResponse_t {
enum { k_iCallback = k_iSteamUserCallbacks + 66 };
bool m_bAllowed;
EMarketNotAllowedReasonFlags m_eNotAllowedReason;
@ -378,7 +353,6 @@ struct MarketEligibilityResponse_t
int m_cdayNewDeviceCooldown; // The number of days after initial device authorization a user must wait before using the market on that device
};
//-----------------------------------------------------------------------------
// Purpose: sent for games with enabled anti indulgence / duration control, for
// enabled users. Lets the game know whether the user can keep playing or
@ -387,8 +361,7 @@ struct MarketEligibilityResponse_t
// This callback is fired asynchronously in response to timers triggering.
// It is also fired in response to calls to GetDurationControl().
//-----------------------------------------------------------------------------
struct DurationControl_t
{
struct DurationControl_t {
enum { k_iCallback = k_iSteamUserCallbacks + 67 };
EResult m_eResult; // result of call (always k_EResultOK for asynchronous timer-based notifications)
@ -404,7 +377,6 @@ struct DurationControl_t
int32 m_csecsRemaining; // playtime remaining until the user hits a regulatory limit
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMUSER_H

View File

@ -10,8 +10,8 @@
#pragma once
#endif
#include "steam_api_common.h"
#include "isteamremotestorage.h"
#include "steam_api_common.h"
// size limit on stat or achievement name (UTF-8 encoded)
enum { k_cchStatNameMax = 128 };
@ -29,8 +29,7 @@ typedef uint64 SteamLeaderboard_t;
typedef uint64 SteamLeaderboardEntries_t;
// type of data request, when downloading leaderboard entries
enum ELeaderboardDataRequest
{
enum ELeaderboardDataRequest {
k_ELeaderboardDataRequestGlobal = 0,
k_ELeaderboardDataRequestGlobalAroundUser = 1,
k_ELeaderboardDataRequestFriends = 2,
@ -38,40 +37,36 @@ enum ELeaderboardDataRequest
};
// the sort order of a leaderboard
enum ELeaderboardSortMethod
{
enum ELeaderboardSortMethod {
k_ELeaderboardSortMethodNone = 0,
k_ELeaderboardSortMethodAscending = 1, // top-score is lowest number
k_ELeaderboardSortMethodDescending = 2, // top-score is highest number
};
// the display type (used by the Steam Community web site) for a leaderboard
enum ELeaderboardDisplayType
{
enum ELeaderboardDisplayType {
k_ELeaderboardDisplayTypeNone = 0,
k_ELeaderboardDisplayTypeNumeric = 1, // simple numerical score
k_ELeaderboardDisplayTypeTimeSeconds = 2, // the score represents a time, in seconds
k_ELeaderboardDisplayTypeTimeMilliSeconds = 3, // the score represents a time, in milliseconds
};
enum ELeaderboardUploadScoreMethod
{
enum ELeaderboardUploadScoreMethod {
k_ELeaderboardUploadScoreMethodNone = 0,
k_ELeaderboardUploadScoreMethodKeepBest = 1, // Leaderboard will keep user's best score
k_ELeaderboardUploadScoreMethodForceUpdate = 2, // Leaderboard will always replace score with specified
};
// a single entry in a leaderboard, as returned by GetDownloadedLeaderboardEntry()
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct LeaderboardEntry_t
{
struct LeaderboardEntry_t {
CSteamID m_steamIDUser; // user with the entry - use SteamFriends()->GetFriendPersonaName() & SteamFriends()->GetFriendAvatar() to get more info
int32 m_nGlobalRank; // [1..N], where N is the number of users with an entry in the leaderboard
int32 m_nScore; // score as set in the leaderboard
@ -79,44 +74,42 @@ struct LeaderboardEntry_t
UGCHandle_t m_hUGC; // handle for UGC attached to the entry
};
#pragma pack( pop )
#pragma pack(pop)
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing stats, achievements, and leaderboard information
//-----------------------------------------------------------------------------
class ISteamUserStats
{
class ISteamUserStats {
public:
// Ask the server to send down this user's data and achievements for this game
STEAM_CALL_BACK( UserStatsReceived_t )
STEAM_CALL_BACK(UserStatsReceived_t)
virtual bool RequestCurrentStats() = 0;
// Data accessors
STEAM_FLAT_NAME( GetStatInt32 )
virtual bool GetStat( const char *pchName, int32 *pData ) = 0;
STEAM_FLAT_NAME(GetStatInt32)
virtual bool GetStat(const char* pchName, int32* pData) = 0;
STEAM_FLAT_NAME( GetStatFloat )
virtual bool GetStat( const char *pchName, float *pData ) = 0;
STEAM_FLAT_NAME(GetStatFloat)
virtual bool GetStat(const char* pchName, float* pData) = 0;
// Set / update data
STEAM_FLAT_NAME( SetStatInt32 )
virtual bool SetStat( const char *pchName, int32 nData ) = 0;
STEAM_FLAT_NAME(SetStatInt32)
virtual bool SetStat(const char* pchName, int32 nData) = 0;
STEAM_FLAT_NAME( SetStatFloat )
virtual bool SetStat( const char *pchName, float fData ) = 0;
STEAM_FLAT_NAME(SetStatFloat)
virtual bool SetStat(const char* pchName, float fData) = 0;
virtual bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength ) = 0;
virtual bool UpdateAvgRateStat(const char* pchName, float flCountThisSession, double dSessionLength) = 0;
// Achievement flag accessors
virtual bool GetAchievement( const char *pchName, bool *pbAchieved ) = 0;
virtual bool SetAchievement( const char *pchName ) = 0;
virtual bool ClearAchievement( const char *pchName ) = 0;
virtual bool GetAchievement(const char* pchName, bool* pbAchieved) = 0;
virtual bool SetAchievement(const char* pchName) = 0;
virtual bool ClearAchievement(const char* pchName) = 0;
// Get the achievement status, and the time it was unlocked if unlocked.
// If the return value is true, but the unlock time is zero, that means it was unlocked before Steam
// began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970.
virtual bool GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0;
virtual bool GetAchievementAndUnlockTime(const char* pchName, bool* pbAchieved, uint32* punUnlockTime) = 0;
// Store the current data on the server, will get a callback when set
// And one callback for every new achievement
@ -133,22 +126,22 @@ public:
// A return value of 0 may indicate we are still fetching data, and you can wait for the UserAchievementIconFetched_t callback
// which will notify you when the bits are ready. If the callback still returns zero, then there is no image set for the
// specified achievement.
virtual int GetAchievementIcon( const char *pchName ) = 0;
virtual int GetAchievementIcon(const char* pchName) = 0;
// Get general attributes for an achievement. Accepts the following keys:
// - "name" and "desc" for retrieving the localized achievement name and description (returned in UTF8)
// - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden)
virtual const char *GetAchievementDisplayAttribute( const char *pchName, const char *pchKey ) = 0;
virtual const char* GetAchievementDisplayAttribute(const char* pchName, const char* pchKey) = 0;
// Achievement progress - triggers an AchievementProgress callback, that is all.
// Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.
virtual bool IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress ) = 0;
virtual bool IndicateAchievementProgress(const char* pchName, uint32 nCurProgress, uint32 nMaxProgress) = 0;
// Used for iterating achievements. In general games should not need these functions because they should have a
// list of existing achievements compiled into them
virtual uint32 GetNumAchievements() = 0;
// Get achievement name iAchievement in [0,GetNumAchievements)
virtual const char *GetAchievementName( uint32 iAchievement ) = 0;
virtual const char* GetAchievementName(uint32 iAchievement) = 0;
// Friends stats & achievements
@ -156,46 +149,46 @@ 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
STEAM_CALL_RESULT( UserStatsReceived_t )
virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0;
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()
STEAM_FLAT_NAME( GetUserStatInt32 )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0;
STEAM_FLAT_NAME(GetUserStatInt32)
virtual bool GetUserStat(CSteamID steamIDUser, const char* pchName, int32* pData) = 0;
STEAM_FLAT_NAME( GetUserStatFloat )
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0;
STEAM_FLAT_NAME(GetUserStatFloat)
virtual bool GetUserStat(CSteamID steamIDUser, const char* pchName, float* pData) = 0;
virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0;
virtual bool GetUserAchievement(CSteamID steamIDUser, const char* pchName, bool* pbAchieved) = 0;
// See notes for GetAchievementAndUnlockTime above
virtual bool GetUserAchievementAndUnlockTime( CSteamID steamIDUser, const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0;
virtual bool GetUserAchievementAndUnlockTime(CSteamID steamIDUser, const char* pchName, bool* pbAchieved, uint32* punUnlockTime) = 0;
// Reset stats
virtual bool ResetAllStats( bool bAchievementsToo ) = 0;
virtual bool ResetAllStats(bool bAchievementsToo) = 0;
// Leaderboard functions
// 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
STEAM_CALL_RESULT(LeaderboardFindResult_t)
virtual SteamAPICall_t FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType ) = 0;
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
STEAM_CALL_RESULT( LeaderboardFindResult_t )
virtual SteamAPICall_t FindLeaderboard( const char *pchLeaderboardName ) = 0;
STEAM_CALL_RESULT(LeaderboardFindResult_t)
virtual SteamAPICall_t FindLeaderboard(const char* pchLeaderboardName) = 0;
// returns the name of a leaderboard
virtual const char *GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard ) = 0;
virtual const char* GetLeaderboardName(SteamLeaderboard_t hSteamLeaderboard) = 0;
// returns the total number of entries in a leaderboard, as of the last request
virtual int GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard ) = 0;
virtual int GetLeaderboardEntryCount(SteamLeaderboard_t hSteamLeaderboard) = 0;
// returns the sort method of the leaderboard
virtual ELeaderboardSortMethod GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard ) = 0;
virtual ELeaderboardSortMethod GetLeaderboardSortMethod(SteamLeaderboard_t hSteamLeaderboard) = 0;
// returns the display type of the leaderboard
virtual ELeaderboardDisplayType GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard ) = 0;
virtual ELeaderboardDisplayType GetLeaderboardDisplayType(SteamLeaderboard_t hSteamLeaderboard) = 0;
// Asks the Steam back-end for a set of rows in the leaderboard.
// This call is asynchronous, with the result returned in LeaderboardScoresDownloaded_t
@ -205,15 +198,16 @@ 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
STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
virtual SteamAPICall_t DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd ) = 0;
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
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,
STEAM_ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers ) = 0;
STEAM_CALL_RESULT(LeaderboardScoresDownloaded_t)
virtual SteamAPICall_t DownloadLeaderboardEntriesForUsers(SteamLeaderboard_t hSteamLeaderboard,
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
@ -229,92 +223,91 @@ public:
// ...
// }
// once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid
virtual bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t *pLeaderboardEntry, int32 *pDetails, int cDetailsMax ) = 0;
virtual bool GetDownloadedLeaderboardEntry(SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t* pLeaderboardEntry, int32* pDetails, int cDetailsMax) = 0;
// Uploads a user score to the Steam back-end.
// 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
STEAM_CALL_RESULT( LeaderboardScoreUploaded_t )
virtual SteamAPICall_t UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount ) = 0;
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.
STEAM_CALL_RESULT( LeaderboardUGCSet_t )
virtual SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC ) = 0;
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
STEAM_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.
STEAM_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
// the next most achieved afterwards. Will return -1 if there is no data on achievement
// percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback).
virtual int GetMostAchievedAchievementInfo( char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0;
virtual int GetMostAchievedAchievementInfo(char* pchName, uint32 unNameBufLen, float* pflPercent, bool* pbAchieved) = 0;
// Get the info on the next most achieved achievement for the game. Call this after GetMostAchievedAchievementInfo or another
// GetNextMostAchievedAchievementInfo call passing the iterator from the previous call. Returns -1 after the last
// achievement has been iterated.
virtual int GetNextMostAchievedAchievementInfo( int iIteratorPrevious, char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0;
virtual int GetNextMostAchievedAchievementInfo(int iIteratorPrevious, char* pchName, uint32 unNameBufLen, float* pflPercent, bool* pbAchieved) = 0;
// Returns the percentage of users who have achieved the specified achievement.
virtual bool GetAchievementAchievedPercent( const char *pchName, float *pflPercent ) = 0;
virtual bool GetAchievementAchievedPercent(const char* pchName, float* pflPercent) = 0;
// Requests global stats data, which is available for stats marked as "aggregated".
// 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.
STEAM_CALL_RESULT( GlobalStatsReceived_t )
virtual SteamAPICall_t RequestGlobalStats( int nHistoryDays ) = 0;
STEAM_CALL_RESULT(GlobalStatsReceived_t)
virtual SteamAPICall_t RequestGlobalStats(int nHistoryDays) = 0;
// Gets the lifetime totals for an aggregated stat
STEAM_FLAT_NAME( GetGlobalStatInt64 )
virtual bool GetGlobalStat( const char *pchStatName, int64 *pData ) = 0;
STEAM_FLAT_NAME(GetGlobalStatInt64)
virtual bool GetGlobalStat(const char* pchStatName, int64* pData) = 0;
STEAM_FLAT_NAME( GetGlobalStatDouble )
virtual bool GetGlobalStat( const char *pchStatName, double *pData ) = 0;
STEAM_FLAT_NAME(GetGlobalStatDouble)
virtual bool GetGlobalStat(const char* pchStatName, double* pData) = 0;
// Gets history for an aggregated stat. pData will be filled with daily values, starting with today.
// 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.
STEAM_FLAT_NAME( GetGlobalStatHistoryInt64 )
virtual int32 GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) int64 *pData, uint32 cubData ) = 0;
STEAM_FLAT_NAME(GetGlobalStatHistoryInt64)
virtual int32 GetGlobalStatHistory(const char* pchStatName, STEAM_ARRAY_COUNT(cubData) int64* pData, uint32 cubData) = 0;
STEAM_FLAT_NAME( GetGlobalStatHistoryDouble )
virtual int32 GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) double *pData, uint32 cubData ) = 0;
STEAM_FLAT_NAME(GetGlobalStatHistoryDouble)
virtual int32 GetGlobalStatHistory(const char* pchStatName, STEAM_ARRAY_COUNT(cubData) double* pData, uint32 cubData) = 0;
// For achievements that have related Progress stats, use this to query what the bounds of that progress are.
// You may want this info to selectively call IndicateAchievementProgress when appropriate milestones of progress
// have been made, to show a progress notification to the user.
STEAM_FLAT_NAME( GetAchievementProgressLimitsInt32 )
virtual bool GetAchievementProgressLimits( const char *pchName, int32 *pnMinProgress, int32 *pnMaxProgress ) = 0;
STEAM_FLAT_NAME( GetAchievementProgressLimitsFloat )
virtual bool GetAchievementProgressLimits( const char *pchName, float *pfMinProgress, float *pfMaxProgress ) = 0;
STEAM_FLAT_NAME(GetAchievementProgressLimitsInt32)
virtual bool GetAchievementProgressLimits(const char* pchName, int32* pnMinProgress, int32* pnMaxProgress) = 0;
STEAM_FLAT_NAME(GetAchievementProgressLimitsFloat)
virtual bool GetAchievementProgressLimits(const char* pchName, float* pfMinProgress, float* pfMaxProgress) = 0;
};
#define STEAMUSERSTATS_INTERFACE_VERSION "STEAMUSERSTATS_INTERFACE_VERSION012"
// Global interface accessor
inline ISteamUserStats *SteamUserStats();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUserStats *, SteamUserStats, STEAMUSERSTATS_INTERFACE_VERSION );
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 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -323,33 +316,28 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUserStats *, SteamUserStats, STEAMUS
// Purpose: called when the latests stats and achievements have been received
// from the server
//-----------------------------------------------------------------------------
struct UserStatsReceived_t
{
struct UserStatsReceived_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 1 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // Success / error fetching the stats
CSteamID m_steamIDUser; // The user for whom the stats are retrieved for
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the user stats for a game
//-----------------------------------------------------------------------------
struct UserStatsStored_t
{
struct UserStatsStored_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 2 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // success / error
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the achievements for a game, or an
// "indicate progress" call. If both m_nCurProgress and m_nMaxProgress
// are zero, that means the achievement has been fully unlocked.
//-----------------------------------------------------------------------------
struct UserAchievementStored_t
{
struct UserAchievementStored_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 3 };
uint64 m_nGameID; // Game this is for
@ -359,38 +347,32 @@ struct UserAchievementStored_t
uint32 m_nMaxProgress; // "out of" this many
};
//-----------------------------------------------------------------------------
// Purpose: call result for finding a leaderboard, returned as a result of FindOrCreateLeaderboard() or FindLeaderboard()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardFindResult_t
{
struct LeaderboardFindResult_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 4 };
SteamLeaderboard_t m_hSteamLeaderboard; // handle to the leaderboard serarched for, 0 if no leaderboard found
uint8 m_bLeaderboardFound; // 0 if no leaderboard found
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating scores for a leaderboard have been downloaded and are ready to be retrieved, returned as a result of DownloadLeaderboardEntries()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardScoresDownloaded_t
{
struct LeaderboardScoresDownloaded_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 5 };
SteamLeaderboard_t m_hSteamLeaderboard;
SteamLeaderboardEntries_t m_hSteamLeaderboardEntries; // the handle to pass into GetDownloadedLeaderboardEntries()
int m_cEntryCount; // the number of entries downloaded
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating scores has been uploaded, returned as a result of UploadLeaderboardScore()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardScoreUploaded_t
{
struct LeaderboardScoreUploaded_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 6 };
uint8 m_bSuccess; // 1 if the call was successful
SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was
@ -400,32 +382,25 @@ struct LeaderboardScoreUploaded_t
int m_nGlobalRankPrevious; // the previous global rank of the user in this leaderboard; 0 if the user had no existing entry in the leaderboard
};
struct NumberOfCurrentPlayers_t
{
struct NumberOfCurrentPlayers_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 7 };
uint8 m_bSuccess; // 1 if the call was successful
int32 m_cPlayers; // Number of players currently playing
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that a user's stats have been unloaded.
// Call RequestUserStats again to access stats for this user
//-----------------------------------------------------------------------------
struct UserStatsUnloaded_t
{
struct UserStatsUnloaded_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 };
CSteamID m_steamIDUser; // User whose stats have been unloaded
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that an achievement icon has been fetched
//-----------------------------------------------------------------------------
struct UserAchievementIconFetched_t
{
struct UserAchievementIconFetched_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 9 };
CGameID m_nGameID; // Game this is for
@ -434,55 +409,45 @@ struct UserAchievementIconFetched_t
int m_nIconHandle; // Handle to the image, which can be used in SteamUtils()->GetImageRGBA(), 0 means no image is set for the achievement
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that global achievement percentages are fetched
//-----------------------------------------------------------------------------
struct GlobalAchievementPercentagesReady_t
{
struct GlobalAchievementPercentagesReady_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 10 };
uint64 m_nGameID; // Game this is for
EResult m_eResult; // Result of the operation
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating UGC has been uploaded, returned as a result of SetLeaderboardUGC()
//-----------------------------------------------------------------------------
struct LeaderboardUGCSet_t
{
struct LeaderboardUGCSet_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 11 };
EResult m_eResult; // The result of the operation
SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating that PS3 trophies have been installed
//-----------------------------------------------------------------------------
struct PS3TrophiesInstalled_t
{
struct PS3TrophiesInstalled_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // The result of the operation
uint64 m_ulRequiredDiskSpace; // If m_eResult is k_EResultDiskFull, will contain the amount of space needed to install trophies
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating global stats have been received.
// Returned as a result of RequestGlobalStats()
//-----------------------------------------------------------------------------
struct GlobalStatsReceived_t
{
struct GlobalStatsReceived_t {
enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 };
uint64 m_nGameID; // Game global stats were requested for
EResult m_eResult; // The result of the request
};
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMUSER_H

View File

@ -12,57 +12,47 @@
#include "steam_api_common.h"
// Steam API call failure results
enum ESteamAPICallFailure
{
enum ESteamAPICallFailure {
k_ESteamAPICallFailureNone = -1, // no failure
k_ESteamAPICallFailureSteamGone = 0, // the local Steam process has gone away
k_ESteamAPICallFailureNetworkFailure = 1, // the network connection to Steam has been broken, or was already broken
// SteamServersDisconnected_t callback will be sent around the same time
// SteamServersConnected_t will be sent when the client is able to talk to the Steam servers again
k_ESteamAPICallFailureInvalidHandle = 2, // the SteamAPICall_t handle passed in no longer exists
k_ESteamAPICallFailureMismatchedCallback = 3,// GetAPICallResult() was called with the wrong callback type for this API call
k_ESteamAPICallFailureMismatchedCallback = 3, // GetAPICallResult() was called with the wrong callback type for this API call
};
// Input modes for the Big Picture gamepad text entry
enum EGamepadTextInputMode
{
enum EGamepadTextInputMode {
k_EGamepadTextInputModeNormal = 0,
k_EGamepadTextInputModePassword = 1
};
// Controls number of allowed lines for the Big Picture gamepad text entry
enum EGamepadTextInputLineMode
{
enum EGamepadTextInputLineMode {
k_EGamepadTextInputLineModeSingleLine = 0,
k_EGamepadTextInputLineModeMultipleLines = 1
};
// The context where text filtering is being done
enum ETextFilteringContext
{
enum ETextFilteringContext {
k_ETextFilteringContextUnknown = 0, // Unknown context
k_ETextFilteringContextGameContent = 1, // Game content, only legally required filtering is performed
k_ETextFilteringContextChat = 2, // Chat from another player
k_ETextFilteringContextName = 3, // Character or item name
};
// function prototype for warning message hook
#if defined( POSIX )
#if defined(POSIX)
#define __cdecl
#endif
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
extern "C" typedef void(__cdecl* SteamAPIWarningMessageHook_t)(int, const char*);
//-----------------------------------------------------------------------------
// Purpose: interface to user independent utility functions
//-----------------------------------------------------------------------------
class ISteamUtils
{
class ISteamUtils {
public:
// return the number of seconds since the user
virtual uint32 GetSecondsSinceAppActive() = 0;
@ -76,18 +66,18 @@ public:
// returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database)
// e.g "US" or "UK".
virtual const char *GetIPCountry() = 0;
virtual const char* GetIPCountry() = 0;
// returns true if the image exists, and valid sizes were filled out
virtual bool GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight ) = 0;
virtual bool GetImageSize(int iImage, uint32* pnWidth, uint32* pnHeight) = 0;
// returns true if the image exists, and the buffer was successfully filled out
// results are returned in RGBA format
// the destination buffer size should be 4 * height * width * sizeof(char)
virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0;
virtual bool GetImageRGBA(int iImage, uint8* pubDest, int nDestBufferSize) = 0;
// Deprecated. Do not call this.
STEAM_PRIVATE_API( virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0; )
STEAM_PRIVATE_API(virtual bool GetCSERIPPort(uint32* unIP, uint16* usPort) = 0;)
// return the amount of battery power left in the current system in % [0..100], 255 for being on AC power
virtual uint8 GetCurrentBatteryPower() = 0;
@ -97,16 +87,16 @@ public:
// Sets the position where the overlay instance for the currently calling game should show notifications.
// This position is per-game and if this function is called from outside of a game context it will do nothing.
virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0;
virtual void SetOverlayNotificationPosition(ENotificationPosition eNotificationPosition) = 0;
// API asynchronous call results
// can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)
virtual bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed ) = 0;
virtual ESteamAPICallFailure GetAPICallFailureReason( SteamAPICall_t hSteamAPICall ) = 0;
virtual bool GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) = 0;
virtual bool IsAPICallCompleted(SteamAPICall_t hSteamAPICall, bool* pbFailed) = 0;
virtual ESteamAPICallFailure GetAPICallFailureReason(SteamAPICall_t hSteamAPICall) = 0;
virtual bool GetAPICallResult(SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed) = 0;
// Deprecated. Applications should use SteamAPI_RunCallbacks() instead. Game servers do not need to call this function.
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
STEAM_PRIVATE_API(virtual void RunFrame() = 0;)
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
@ -118,7 +108,7 @@ public:
// 'int' is the severity; 0 for msg, 1 for warning
// 'const char *' is the text of the message
// callbacks will occur directly after the API function is called that generated the warning or message
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
virtual void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) = 0;
// Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to
// start & hook the game process, so this function will initially return false while the overlay is loading.
@ -143,24 +133,24 @@ 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.
STEAM_CALL_RESULT( CheckFileSignature_t )
virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0;
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
virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0;
virtual bool ShowGamepadTextInput(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char* pchDescription, uint32 unCharMax, const char* pchExistingText) = 0;
// Returns previously entered text & length
virtual uint32 GetEnteredGamepadTextLength() = 0;
virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0;
virtual bool GetEnteredGamepadTextInput(char* pchText, uint32 cchText) = 0;
// returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases
virtual const char *GetSteamUILanguage() = 0;
virtual const char* GetSteamUILanguage() = 0;
// returns true if Steam itself is running in VR mode
virtual bool IsSteamRunningInVR() = 0;
// Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.
virtual void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset ) = 0;
virtual void SetOverlayNotificationInset(int nHorizontalInset, int nVerticalInset) = 0;
// returns true if Steam & the Steam Overlay are running in Big Picture mode
// Games much be launched through the Steam client to enable the Big Picture overlay. During development,
@ -178,7 +168,7 @@ public:
// If this is set to false, then the application window will be streamed instead, and remote input will be allowed.
// The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game.
// (this is useful for games that have asymmetric multiplayer gameplay)
virtual void SetVRHeadsetStreamingEnabled( bool bEnabled ) = 0;
virtual void SetVRHeadsetStreamingEnabled(bool bEnabled) = 0;
// Returns whether this steam client is a Steam China specific client, vs the global client.
virtual bool IsSteamChinaLauncher() = 0;
@ -189,7 +179,7 @@ public:
//
// Users can customize the text filter behavior in their Steam Account preferences:
// https://store.steampowered.com/account/preferences#CommunityContentPreferences
virtual bool InitFilterText( uint32 unFilterOptions = 0 ) = 0;
virtual bool InitFilterText(uint32 unFilterOptions = 0) = 0;
// Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings
// eContext is the type of content in the input string
@ -198,28 +188,28 @@ public:
// pchOutFilteredText is where the output will be placed, even if no filtering is performed
// nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText, should be at least strlen(pchInputText)+1
// Returns the number of characters (not bytes) filtered
virtual int FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText ) = 0;
virtual int FilterText(ETextFilteringContext eContext, CSteamID sourceSteamID, const char* pchInputMessage, char* pchOutFilteredText, uint32 nByteSizeOutFilteredText) = 0;
// Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol.
// This does NOT tell you if the Steam client is currently connected to Steam via ipv6.
virtual ESteamIPv6ConnectivityState GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol ) = 0;
virtual ESteamIPv6ConnectivityState GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol eProtocol) = 0;
};
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils010"
// Global interface accessor
inline ISteamUtils *SteamUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamUtils, SteamInternal_FindOrCreateUserInterface( 0, STEAMUTILS_INTERFACE_VERSION ), "user", STEAMUTILS_INTERFACE_VERSION );
inline ISteamUtils* SteamUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR(ISteamUtils*, SteamUtils, SteamInternal_FindOrCreateUserInterface(0, STEAMUTILS_INTERFACE_VERSION), "user", STEAMUTILS_INTERFACE_VERSION);
// Global accessor for the gameserver client
inline ISteamUtils *SteamGameServerUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamGameServerUtils, SteamInternal_FindOrCreateGameServerInterface( 0, STEAMUTILS_INTERFACE_VERSION ), "gameserver", STEAMUTILS_INTERFACE_VERSION );
inline ISteamUtils* SteamGameServerUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR(ISteamUtils*, SteamGameServerUtils, SteamInternal_FindOrCreateGameServerInterface(0, STEAMUTILS_INTERFACE_VERSION), "gameserver", STEAMUTILS_INTERFACE_VERSION);
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -227,47 +217,39 @@ STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamGameServerUtils, SteamInter
//-----------------------------------------------------------------------------
// Purpose: The country of the user changed
//-----------------------------------------------------------------------------
struct IPCountry_t
{
struct IPCountry_t {
enum { k_iCallback = k_iSteamUtilsCallbacks + 1 };
};
//-----------------------------------------------------------------------------
// Purpose: Fired when running on a laptop and less than 10 minutes of battery is left, fires then every minute
//-----------------------------------------------------------------------------
struct LowBatteryPower_t
{
struct LowBatteryPower_t {
enum { k_iCallback = k_iSteamUtilsCallbacks + 2 };
uint8 m_nMinutesBatteryLeft;
};
//-----------------------------------------------------------------------------
// Purpose: called when a SteamAsyncCall_t has completed (or failed)
//-----------------------------------------------------------------------------
struct SteamAPICallCompleted_t
{
struct SteamAPICallCompleted_t {
enum { k_iCallback = k_iSteamUtilsCallbacks + 3 };
SteamAPICall_t m_hAsyncCall;
int m_iCallback;
uint32 m_cubParam;
};
//-----------------------------------------------------------------------------
// called when Steam wants to shutdown
//-----------------------------------------------------------------------------
struct SteamShutdown_t
{
struct SteamShutdown_t {
enum { k_iCallback = k_iSteamUtilsCallbacks + 4 };
};
//-----------------------------------------------------------------------------
// results for CheckFileSignature
//-----------------------------------------------------------------------------
enum ECheckFileSignature
{
enum ECheckFileSignature {
k_ECheckFileSignatureInvalidSignature = 0,
k_ECheckFileSignatureValidSignature = 1,
k_ECheckFileSignatureFileNotFound = 2,
@ -278,21 +260,17 @@ enum ECheckFileSignature
//-----------------------------------------------------------------------------
// callback for CheckFileSignature
//-----------------------------------------------------------------------------
struct CheckFileSignature_t
{
struct CheckFileSignature_t {
enum { k_iCallback = k_iSteamUtilsCallbacks + 5 };
ECheckFileSignature m_eCheckFileSignature;
};
// k_iSteamUtilsCallbacks + 13 is taken
//-----------------------------------------------------------------------------
// Big Picture gamepad text input has been closed
//-----------------------------------------------------------------------------
struct GamepadTextInputDismissed_t
{
struct GamepadTextInputDismissed_t {
enum { k_iCallback = k_iSteamUtilsCallbacks + 14 };
bool m_bSubmitted; // true if user entered & accepted text (Call ISteamUtils::GetEnteredGamepadTextInput() for text), false if canceled input
uint32 m_unSubmittedText;
@ -300,6 +278,6 @@ struct GamepadTextInputDismissed_t
// k_iSteamUtilsCallbacks + 15 is taken
#pragma pack( pop )
#pragma pack(pop)
#endif // ISTEAMUTILS_H

View File

@ -13,56 +13,48 @@
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: Steam Video API
//-----------------------------------------------------------------------------
class ISteamVideo
{
class ISteamVideo {
public:
// Get a URL suitable for streaming the given Video app ID's video
virtual void GetVideoURL( AppId_t unVideoAppID ) = 0;
virtual void GetVideoURL(AppId_t unVideoAppID) = 0;
// returns true if user is uploading a live broadcast
virtual bool IsBroadcasting( int *pnNumViewers ) = 0;
virtual bool IsBroadcasting(int* pnNumViewers) = 0;
// Get the OPF Details for 360 Video Playback
STEAM_CALL_BACK( GetOPFSettingsResult_t )
virtual void GetOPFSettings( AppId_t unVideoAppID ) = 0;
virtual bool GetOPFStringForApp( AppId_t unVideoAppID, char *pchBuffer, int32 *pnBufferSize ) = 0;
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"
// Global interface accessor
inline ISteamVideo *SteamVideo();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamVideo *, SteamVideo, STEAMVIDEO_INTERFACE_VERSION );
inline ISteamVideo* SteamVideo();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR(ISteamVideo*, SteamVideo, STEAMVIDEO_INTERFACE_VERSION);
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_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)
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_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 )
#pragma pack(pop)
#endif // ISTEAMVIDEO_H

View File

@ -37,23 +37,20 @@ const int k_cbMaxGameServerGameData = 2048;
/// Actually, the name Key/Value is a bit misleading. The "key" is better
/// understood as "filter operation code" and the "value" is the operand to this
/// filter operation. The meaning of the operand depends upon the filter.
struct MatchMakingKeyValuePair_t
{
struct MatchMakingKeyValuePair_t {
MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; }
MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue )
MatchMakingKeyValuePair_t(const char* pchKey, const char* pchValue)
{
strncpy( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only!
m_szKey[ sizeof( m_szKey ) - 1 ] = '\0';
strncpy( m_szValue, pchValue, sizeof(m_szValue) );
m_szValue[ sizeof( m_szValue ) - 1 ] = '\0';
strncpy(m_szKey, pchKey, sizeof(m_szKey)); // this is a public header, use basic c library string funcs only!
m_szKey[sizeof(m_szKey) - 1] = '\0';
strncpy(m_szValue, pchValue, sizeof(m_szValue));
m_szValue[sizeof(m_szValue) - 1] = '\0';
}
char m_szKey[ 256 ];
char m_szValue[ 256 ];
char m_szKey[256];
char m_szValue[256];
};
enum EMatchMakingServerResponse
{
enum EMatchMakingServerResponse {
eServerResponded = 0,
eServerFailedToRespond,
eNoServersListedOnMasterServer // for the Internet query type, returned in response callback if no servers of this type match
@ -61,52 +58,53 @@ enum EMatchMakingServerResponse
// servernetadr_t is all the addressing info the serverbrowser needs to know about a game server,
// namely: its IP, its connection port, and its query port.
class servernetadr_t
{
class servernetadr_t {
public:
servernetadr_t()
: m_usConnectionPort(0)
, m_usQueryPort(0)
, m_unIP(0)
{
}
servernetadr_t() : m_usConnectionPort( 0 ), m_usQueryPort( 0 ), m_unIP( 0 ) {}
void Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort );
void Init(unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort);
#ifdef NETADR_H
netadr_t GetIPAndQueryPort();
#endif
// Access the query port.
uint16 GetQueryPort() const;
void SetQueryPort( uint16 usPort );
void SetQueryPort(uint16 usPort);
// Access the connection port.
uint16 GetConnectionPort() const;
void SetConnectionPort( uint16 usPort );
void SetConnectionPort(uint16 usPort);
// Access the IP
uint32 GetIP() const;
void SetIP( uint32 unIP );
void SetIP(uint32 unIP);
// This gets the 'a.b.c.d:port' string with the connection port (instead of the query port).
const char *GetConnectionAddressString() const;
const char *GetQueryAddressString() const;
const char* GetConnectionAddressString() const;
const char* GetQueryAddressString() const;
// Comparison operators and functions.
bool operator<(const servernetadr_t &netadr) const;
void operator=( const servernetadr_t &that )
bool operator<(const servernetadr_t& netadr) const;
void operator=(const servernetadr_t& that)
{
m_usConnectionPort = that.m_usConnectionPort;
m_usQueryPort = that.m_usQueryPort;
m_unIP = that.m_unIP;
}
private:
const char *ToString( uint32 unIP, uint16 usPort ) const;
const char* ToString(uint32 unIP, uint16 usPort) const;
uint16 m_usConnectionPort; // (in HOST byte order)
uint16 m_usQueryPort;
uint32 m_unIP;
};
inline void servernetadr_t::Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort )
inline void servernetadr_t::Init(unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort)
{
m_unIP = ip;
m_usQueryPort = usQueryPort;
@ -116,7 +114,7 @@ inline void servernetadr_t::Init( unsigned int ip, uint16 usQueryPort, uint16 us
#ifdef NETADR_H
inline netadr_t servernetadr_t::GetIPAndQueryPort()
{
return netadr_t( m_unIP, m_usQueryPort );
return netadr_t(m_unIP, m_usQueryPort);
}
#endif
@ -125,7 +123,7 @@ inline uint16 servernetadr_t::GetQueryPort() const
return m_usQueryPort;
}
inline void servernetadr_t::SetQueryPort( uint16 usPort )
inline void servernetadr_t::SetQueryPort(uint16 usPort)
{
m_usQueryPort = usPort;
}
@ -135,7 +133,7 @@ inline uint16 servernetadr_t::GetConnectionPort() const
return m_usConnectionPort;
}
inline void servernetadr_t::SetConnectionPort( uint16 usPort )
inline void servernetadr_t::SetConnectionPort(uint16 usPort)
{
m_usConnectionPort = usPort;
}
@ -145,52 +143,51 @@ inline uint32 servernetadr_t::GetIP() const
return m_unIP;
}
inline void servernetadr_t::SetIP( uint32 unIP )
inline void servernetadr_t::SetIP(uint32 unIP)
{
m_unIP = unIP;
}
inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const
inline const char* servernetadr_t::ToString(uint32 unIP, uint16 usPort) const
{
static char s[4][64];
static int nBuf = 0;
unsigned char *ipByte = (unsigned char *)&unIP;
unsigned char* ipByte = (unsigned char*)&unIP;
#ifdef VALVE_BIG_ENDIAN
_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort );
_snprintf(s[nBuf], sizeof(s[nBuf]), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort);
#else
_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort );
_snprintf(s[nBuf], sizeof(s[nBuf]), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort);
#endif
const char *pchRet = s[nBuf];
const char* pchRet = s[nBuf];
++nBuf;
nBuf %= ( (sizeof(s)/sizeof(s[0])) );
nBuf %= ((sizeof(s) / sizeof(s[0])));
return pchRet;
}
inline const char* servernetadr_t::GetConnectionAddressString() const
{
return ToString( m_unIP, m_usConnectionPort );
return ToString(m_unIP, m_usConnectionPort);
}
inline const char* servernetadr_t::GetQueryAddressString() const
{
return ToString( m_unIP, m_usQueryPort );
return ToString(m_unIP, m_usQueryPort);
}
inline bool servernetadr_t::operator<(const servernetadr_t &netadr) const
inline bool servernetadr_t::operator<(const servernetadr_t& netadr) const
{
return ( m_unIP < netadr.m_unIP ) || ( m_unIP == netadr.m_unIP && m_usQueryPort < netadr.m_usQueryPort );
return (m_unIP < netadr.m_unIP) || (m_unIP == netadr.m_unIP && m_usQueryPort < netadr.m_usQueryPort);
}
//-----------------------------------------------------------------------------
// Purpose: Data describing a single server
//-----------------------------------------------------------------------------
class gameserveritem_t
{
class gameserveritem_t {
public:
gameserveritem_t();
const char* GetName() const;
void SetName( const char *pName );
void SetName(const char* pName);
public:
servernetadr_t m_NetAdr; ///< IP/Query Port/Connection Port for this server
@ -210,7 +207,6 @@ public:
int m_nServerVersion; ///< server version as reported to Steam
private:
/// Game server name
char m_szServerName[k_cbMaxGameServerName];
@ -223,7 +219,6 @@ public:
CSteamID m_steamID;
};
inline gameserveritem_t::gameserveritem_t()
{
m_szGameDir[0] = m_szMap[0] = m_szGameDescription[0] = m_szServerName[0] = 0;
@ -235,17 +230,16 @@ inline gameserveritem_t::gameserveritem_t()
inline const char* gameserveritem_t::GetName() const
{
// Use the IP address as the name if nothing is set yet.
if ( m_szServerName[0] == 0 )
if (m_szServerName[0] == 0)
return m_NetAdr.GetConnectionAddressString();
else
return m_szServerName;
}
inline void gameserveritem_t::SetName( const char *pName )
inline void gameserveritem_t::SetName(const char* pName)
{
strncpy( m_szServerName, pName, sizeof( m_szServerName ) );
m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0';
strncpy(m_szServerName, pName, sizeof(m_szServerName));
m_szServerName[sizeof(m_szServerName) - 1] = '\0';
}
#endif // MATCHMAKINGTYPES_H

View File

@ -21,32 +21,31 @@
#include "steam_api_common.h"
// All of the interfaces
#include "isteamclient.h"
#include "isteamuser.h"
#include "isteamfriends.h"
#include "isteamutils.h"
#include "isteammatchmaking.h"
#include "isteamuserstats.h"
#include "isteamapplist.h"
#include "isteamapps.h"
#include "isteamnetworking.h"
#include "isteamremotestorage.h"
#include "isteamscreenshots.h"
#include "isteamclient.h"
#include "isteamcontroller.h"
#include "isteamfriends.h"
#include "isteamhtmlsurface.h"
#include "isteamhttp.h"
#include "isteaminput.h"
#include "isteaminventory.h"
#include "isteammatchmaking.h"
#include "isteammusic.h"
#include "isteammusicremote.h"
#include "isteamhttp.h"
#include "isteamcontroller.h"
#include "isteamugc.h"
#include "isteamapplist.h"
#include "isteamhtmlsurface.h"
#include "isteaminventory.h"
#include "isteamvideo.h"
#include "isteamparentalsettings.h"
#include "isteaminput.h"
#include "isteamremoteplay.h"
#include "isteamnetworking.h"
#include "isteamnetworkingmessages.h"
#include "isteamnetworkingsockets.h"
#include "isteamnetworkingutils.h"
#include "isteamparentalsettings.h"
#include "isteamremoteplay.h"
#include "isteamremotestorage.h"
#include "isteamscreenshots.h"
#include "isteamugc.h"
#include "isteamuser.h"
#include "isteamuserstats.h"
#include "isteamutils.h"
#include "isteamvideo.h"
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Steam API setup & shutdown
@ -55,7 +54,6 @@
//
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// SteamAPI_Init must be called before using any other API functions. If it fails, an
// error message will be output to the debugger (or stderr) with further information.
S_API bool S_CALLTYPE SteamAPI_Init();
@ -73,7 +71,7 @@ S_API void S_CALLTYPE SteamAPI_Shutdown();
//
// NOTE: If you use the Steam DRM wrapper on your primary executable file, this check is unnecessary
// since the DRM wrapper will ensure that your application was launched properly through Steam.
S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID );
S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary(uint32 unOwnAppID);
// Many Steam API functions allocate a small amount of thread-local memory for parameter storage.
// SteamAPI_ReleaseCurrentThreadMemory() will free API memory associated with the calling thread.
@ -81,10 +79,9 @@ S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID );
// program never needs to explicitly call this function.
S_API void S_CALLTYPE SteamAPI_ReleaseCurrentThreadMemory();
// crash dump recording functions
S_API void S_CALLTYPE SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID );
S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg );
S_API void S_CALLTYPE SteamAPI_WriteMiniDump(uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID);
S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment(const char* pchMsg);
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steamclient.dll private wrapper functions
@ -97,13 +94,13 @@ S_API bool S_CALLTYPE SteamAPI_IsSteamRunning();
// returns the filename path of the current running Steam process, used if you need to load an explicit steam dll by name.
// 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();
S_API const char* SteamAPI_GetSteamInstallPath();
// sets whether or not Steam_RunCallbacks() should do a try {} catch (...) {} around calls to issuing callbacks
// This is ignored if you are using the manual callback dispatch method
S_API void SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks );
S_API void SteamAPI_SetTryCatchCallbacks(bool bTryCatchCallbacks);
#if defined( VERSION_SAFE_STEAM_API_INTERFACES )
#if defined(VERSION_SAFE_STEAM_API_INTERFACES)
// exists only for backwards compat with code written against older SDKs
S_API bool S_CALLTYPE SteamAPI_InitSafe();
#endif
@ -115,8 +112,8 @@ S_API bool S_CALLTYPE SteamAPI_InitSafe();
// 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 );
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
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
@ -167,19 +164,19 @@ S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID );
S_API void S_CALLTYPE SteamAPI_ManualDispatch_Init();
/// Perform certain periodic actions that need to be performed.
S_API void S_CALLTYPE SteamAPI_ManualDispatch_RunFrame( HSteamPipe hSteamPipe );
S_API void S_CALLTYPE SteamAPI_ManualDispatch_RunFrame(HSteamPipe hSteamPipe);
/// Fetch the next pending callback on the given pipe, if any. If a callback is available, true is returned
/// and the structure is populated. In this case, you MUST call SteamAPI_ManualDispatch_FreeLastCallback
/// (after dispatching the callback) before calling SteamAPI_ManualDispatch_GetNextCallback again.
S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg );
S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback(HSteamPipe hSteamPipe, CallbackMsg_t* pCallbackMsg);
/// You must call this after dispatching the callback, if SteamAPI_ManualDispatch_GetNextCallback returns true.
S_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback( HSteamPipe hSteamPipe );
S_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback(HSteamPipe hSteamPipe);
/// Return the call result for the specified call on the specified pipe. You really should
/// only call this in a handler for SteamAPICallCompleted_t callback.
S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed );
S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult(HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed);
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
//
@ -194,99 +191,99 @@ S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hStea
inline bool CSteamAPIContext::Init()
{
m_pSteamClient = ::SteamClient();
if ( !m_pSteamClient )
if (!m_pSteamClient)
return false;
m_pSteamUser = ::SteamUser();
if ( !m_pSteamUser )
if (!m_pSteamUser)
return false;
m_pSteamFriends = ::SteamFriends();
if ( !m_pSteamFriends )
if (!m_pSteamFriends)
return false;
m_pSteamUtils = ::SteamUtils();
if ( !m_pSteamUtils )
if (!m_pSteamUtils)
return false;
m_pSteamMatchmaking = ::SteamMatchmaking();
if ( !m_pSteamMatchmaking )
if (!m_pSteamMatchmaking)
return false;
m_pSteamGameSearch = ::SteamGameSearch();
if ( !m_pSteamGameSearch )
if (!m_pSteamGameSearch)
return false;
#if !defined( IOSALL) // Not yet supported on iOS.
#if !defined(IOSALL) // Not yet supported on iOS.
m_pSteamMatchmakingServers = ::SteamMatchmakingServers();
if ( !m_pSteamMatchmakingServers )
if (!m_pSteamMatchmakingServers)
return false;
#endif
m_pSteamUserStats = ::SteamUserStats();
if ( !m_pSteamUserStats )
if (!m_pSteamUserStats)
return false;
m_pSteamApps = ::SteamApps();
if ( !m_pSteamApps )
if (!m_pSteamApps)
return false;
m_pSteamNetworking = ::SteamNetworking();
if ( !m_pSteamNetworking )
if (!m_pSteamNetworking)
return false;
m_pSteamRemoteStorage = ::SteamRemoteStorage();
if ( !m_pSteamRemoteStorage )
if (!m_pSteamRemoteStorage)
return false;
m_pSteamScreenshots = ::SteamScreenshots();
if ( !m_pSteamScreenshots )
if (!m_pSteamScreenshots)
return false;
m_pSteamHTTP = ::SteamHTTP();
if ( !m_pSteamHTTP )
if (!m_pSteamHTTP)
return false;
m_pController = ::SteamController();
if ( !m_pController )
if (!m_pController)
return false;
m_pSteamUGC = ::SteamUGC();
if ( !m_pSteamUGC )
if (!m_pSteamUGC)
return false;
m_pSteamAppList = ::SteamAppList();
if ( !m_pSteamAppList )
if (!m_pSteamAppList)
return false;
m_pSteamMusic = ::SteamMusic();
if ( !m_pSteamMusic )
if (!m_pSteamMusic)
return false;
m_pSteamMusicRemote = ::SteamMusicRemote();
if ( !m_pSteamMusicRemote )
if (!m_pSteamMusicRemote)
return false;
#if !defined( ANDROID ) && !defined( IOSALL) // Not yet supported on Android or ios.
#if !defined(ANDROID) && !defined(IOSALL) // Not yet supported on Android or ios.
m_pSteamHTMLSurface = ::SteamHTMLSurface();
if ( !m_pSteamHTMLSurface )
if (!m_pSteamHTMLSurface)
return false;
#endif
m_pSteamInventory = ::SteamInventory();
if ( !m_pSteamInventory )
if (!m_pSteamInventory)
return false;
m_pSteamVideo = ::SteamVideo();
if ( !m_pSteamVideo )
if (!m_pSteamVideo)
return false;
m_pSteamParentalSettings = ::SteamParentalSettings();
if ( !m_pSteamParentalSettings )
if (!m_pSteamParentalSettings)
return false;
m_pSteamInput = ::SteamInput();
if ( !m_pSteamInput )
if (!m_pSteamInput)
return false;
return true;

View File

@ -13,38 +13,40 @@
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
#include "steamtypes.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
#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
#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__
#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( ... )
#define STEAM_PRIVATE_API(...)
#else
#define STEAM_PRIVATE_API( ... ) protected: __VA_ARGS__ public:
#define STEAM_PRIVATE_API(...) \
protected: \
__VA_ARGS__ public:
#endif
// handle to a communication pipe to the Steam client
@ -52,13 +54,13 @@ typedef int32 HSteamPipe;
// handle to single instance of a steam user
typedef int32 HSteamUser;
// function prototype
#if defined( POSIX )
#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
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
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
@ -98,13 +100,14 @@ S_API void S_CALLTYPE SteamAPI_RunCallbacks();
// 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__ ) )
#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 )
#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.
@ -113,118 +116,123 @@ 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 )
#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
{
class CCallbackBase {
public:
CCallbackBase() { m_nCallbackFlags = 0; m_iCallback = 0; }
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;
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 };
enum { k_ECallbackFlagsRegistered = 0x01,
k_ECallbackFlagsGameServer = 0x02 };
uint8 m_nCallbackFlags;
int m_iCallback;
friend class CCallbackMgr;
private:
CCallbackBase( const CCallbackBase& );
CCallbackBase& operator=( const CCallbackBase& );
CCallbackBase(const CCallbackBase&);
CCallbackBase& operator=(const CCallbackBase&);
};
//-----------------------------------------------------------------------------
// Purpose: templated base for callbacks - internal implementation detail
//-----------------------------------------------------------------------------
template< int sizeof_P >
class CCallbackImpl : protected CCallbackBase
{
template <int sizeof_P>
class CCallbackImpl : protected CCallbackBase {
public:
virtual ~CCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) SteamAPI_UnregisterCallback( this ); }
virtual ~CCallbackImpl()
{
if (m_nCallbackFlags & k_ECallbackFlagsRegistered)
SteamAPI_UnregisterCallback(this);
}
void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; }
protected:
friend class CCallbackMgr;
virtual void Run( void *pvParam ) = 0;
virtual void Run( void *pvParam, bool /*bIOFailure*/, SteamAPICall_t /*hSteamAPICall*/ ) { Run( pvParam ); }
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
{
template <class T, class P>
class CCallResult : private CCallbackBase {
public:
typedef void (T::*func_t)( P*, bool );
typedef void (T::*func_t)(P*, bool);
CCallResult();
~CCallResult();
void Set( SteamAPICall_t hAPICall, T *p, func_t func );
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 ); }
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;
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 ) >
{
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 );
CCallback(T* pObj, func_t func);
void Register( T *pObj, func_t func );
void Register(T* pObj, func_t func);
void Unregister();
protected:
virtual void Run( void *pvParam );
virtual void Run(void* pvParam);
T *m_pObj;
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 >
{
template <class T, class P, bool bGameServer = false>
class CCallbackManual : public CCallback<T, P, bGameServer> {
public:
CCallbackManual() : CCallback< T, P, bGameServer >( nullptr, nullptr ) {}
CCallbackManual()
: CCallback<T, P, bGameServer>(nullptr, nullptr)
{
}
// Inherits public Register and Unregister functions from base class
};

File diff suppressed because it is too large Load Diff

View File

@ -18,10 +18,10 @@ 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 );
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);
// 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
@ -30,57 +30,65 @@ S_API void *S_CALLTYPE SteamInternal_FindOrCreateGameServerInterface( HSteamUser
// SteamInternal_ContextInit takes a base pointer for the equivalent of
// struct { void (*pFn)(void* pCtx); uintptr_t counter; void *ptr; }
// Do not change layout or add non-pointer aligned data!
#define STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, expr, kind, version ) \
inline void S_CALLTYPE SteamInternal_Init_ ## name( type *p ) { *p = (type)( expr ); } \
STEAM_CLANG_ATTR( "interface_accessor_kind:" kind ";interface_accessor_version:" version ";" ) \
inline type name() { \
static void* s_CallbackCounterAndContext[ 3 ] = { (void*)&SteamInternal_Init_ ## name, 0, 0 }; \
return *(type*)SteamInternal_ContextInit( s_CallbackCounterAndContext ); \
#define STEAM_DEFINE_INTERFACE_ACCESSOR(type, name, expr, kind, version) \
inline void S_CALLTYPE SteamInternal_Init_##name(type* p) { *p = (type)(expr); } \
STEAM_CLANG_ATTR("interface_accessor_kind:" kind ";interface_accessor_version:" version ";") \
inline type name() \
{ \
static void* s_CallbackCounterAndContext[3] = { (void*)&SteamInternal_Init_##name, 0, 0 }; \
return *(type*)SteamInternal_ContextInit(s_CallbackCounterAndContext); \
}
#define STEAM_DEFINE_USER_INTERFACE_ACCESSOR( type, name, version ) \
STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, SteamInternal_FindOrCreateUserInterface( SteamAPI_GetHSteamUser(), version ), "user", version )
#define STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( type, name, version ) \
STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, SteamInternal_FindOrCreateGameServerInterface( SteamGameServer_GetHSteamUser(), version ), "gameserver", version )
#define STEAM_DEFINE_USER_INTERFACE_ACCESSOR(type, name, version) \
STEAM_DEFINE_INTERFACE_ACCESSOR(type, name, SteamInternal_FindOrCreateUserInterface(SteamAPI_GetHSteamUser(), version), "user", version)
#define STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(type, name, version) \
STEAM_DEFINE_INTERFACE_ACCESSOR(type, name, SteamInternal_FindOrCreateGameServerInterface(SteamGameServer_GetHSteamUser(), version), "gameserver", version)
//
// Internal stuff used for the standard, higher-level callback mechanism
//
// 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 );
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 void S_CALLTYPE SteamAPI_RegisterCallResult(class CCallbackBase* pCallback, SteamAPICall_t hAPICall);
S_API void S_CALLTYPE SteamAPI_UnregisterCallResult(class CCallbackBase* pCallback, SteamAPICall_t hAPICall);
// 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
#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
#define _STEAM_CALLBACK_3( extra_code, thisclass, func, param ) \
struct CCallbackInternal_ ## func : private CCallbackImpl< sizeof( param ) > { \
CCallbackInternal_ ## func () { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \
CCallbackInternal_ ## func ( const CCallbackInternal_ ## func & ) { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \
CCallbackInternal_ ## func & operator=( const CCallbackInternal_ ## func & ) { return *this; } \
private: virtual void Run( void *pvParam ) { _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) \
thisclass *pOuter = reinterpret_cast<thisclass*>( reinterpret_cast<char*>(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \
pOuter->func( reinterpret_cast<param*>( pvParam ) ); \
#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
#define _STEAM_CALLBACK_3(extra_code, thisclass, func, param) \
struct CCallbackInternal_##func : private CCallbackImpl<sizeof(param)> { \
CCallbackInternal_##func() { extra_code SteamAPI_RegisterCallback(this, param::k_iCallback); } \
CCallbackInternal_##func(const CCallbackInternal_##func&) { extra_code SteamAPI_RegisterCallback(this, param::k_iCallback); } \
CCallbackInternal_##func& operator=(const CCallbackInternal_##func&) { return *this; } \
\
private: \
virtual void Run(void* pvParam) \
{ \
_STEAM_CALLBACK_AUTO_HOOK(thisclass, func, param) \
thisclass* pOuter = reinterpret_cast<thisclass*>(reinterpret_cast<char*>(this) - offsetof(thisclass, m_steamcallback_##func)); \
pOuter->func(reinterpret_cast<param*>(pvParam)); \
} \
} 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 )
} 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)
#ifndef API_GEN
template< class T, class P >
template <class T, class P>
inline CCallResult<T, P>::CCallResult()
{
m_hAPICall = k_uAPICallInvalid;
@ -89,128 +97,129 @@ inline CCallResult<T, P>::CCallResult()
m_iCallback = P::k_iCallback;
}
template< class T, class P >
inline void CCallResult<T, P>::Set( SteamAPICall_t hAPICall, T *p, func_t func )
template <class T, class P>
inline void CCallResult<T, P>::Set(SteamAPICall_t hAPICall, T* p, func_t func)
{
if ( m_hAPICall )
SteamAPI_UnregisterCallResult( this, m_hAPICall );
if (m_hAPICall)
SteamAPI_UnregisterCallResult(this, m_hAPICall);
m_hAPICall = hAPICall;
m_pObj = p;
m_Func = func;
if ( hAPICall )
SteamAPI_RegisterCallResult( this, hAPICall );
if (hAPICall)
SteamAPI_RegisterCallResult(this, hAPICall);
}
template< class T, class P >
template <class T, class P>
inline bool CCallResult<T, P>::IsActive() const
{
return (m_hAPICall != k_uAPICallInvalid);
}
template< class T, class P >
template <class T, class P>
inline void CCallResult<T, P>::Cancel()
{
if ( m_hAPICall != k_uAPICallInvalid )
{
SteamAPI_UnregisterCallResult( this, m_hAPICall );
if (m_hAPICall != k_uAPICallInvalid) {
SteamAPI_UnregisterCallResult(this, m_hAPICall);
m_hAPICall = k_uAPICallInvalid;
}
}
template< class T, class P >
template <class T, class P>
inline CCallResult<T, P>::~CCallResult()
{
Cancel();
}
template< class T, class P >
inline void CCallResult<T, P>::Run( void *pvParam )
template <class T, class P>
inline void CCallResult<T, P>::Run(void* pvParam)
{
m_hAPICall = k_uAPICallInvalid; // caller unregisters for us
(m_pObj->*m_Func)((P *)pvParam, false);
(m_pObj->*m_Func)((P*)pvParam, false);
}
template< class T, class P >
inline void CCallResult<T, P>::Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall )
template <class T, class P>
inline void CCallResult<T, P>::Run(void* pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall)
{
if ( hSteamAPICall == m_hAPICall )
{
if (hSteamAPICall == m_hAPICall) {
m_hAPICall = k_uAPICallInvalid; // caller unregisters for us
(m_pObj->*m_Func)((P *)pvParam, bIOFailure);
(m_pObj->*m_Func)((P*)pvParam, bIOFailure);
}
}
template< class T, class P, bool bGameserver >
inline CCallback< T, P, bGameserver >::CCallback( T *pObj, func_t func )
: m_pObj( nullptr ), m_Func( nullptr )
template <class T, class P, bool bGameserver>
inline CCallback<T, P, bGameserver>::CCallback(T* pObj, func_t func)
: m_pObj(nullptr)
, m_Func(nullptr)
{
if ( bGameserver )
{
if (bGameserver) {
this->SetGameserverFlag();
}
Register( pObj, func );
Register(pObj, func);
}
template< class T, class P, bool bGameserver >
inline void CCallback< T, P, bGameserver >::Register( T *pObj, func_t func )
template <class T, class P, bool bGameserver>
inline void CCallback<T, P, bGameserver>::Register(T* pObj, func_t func)
{
if ( !pObj || !func )
if (!pObj || !func)
return;
if ( this->m_nCallbackFlags & CCallbackBase::k_ECallbackFlagsRegistered )
if (this->m_nCallbackFlags & CCallbackBase::k_ECallbackFlagsRegistered)
Unregister();
m_pObj = pObj;
m_Func = func;
// SteamAPI_RegisterCallback sets k_ECallbackFlagsRegistered
SteamAPI_RegisterCallback( this, P::k_iCallback );
SteamAPI_RegisterCallback(this, P::k_iCallback);
}
template< class T, class P, bool bGameserver >
inline void CCallback< T, P, bGameserver >::Unregister()
template <class T, class P, bool bGameserver>
inline void CCallback<T, P, bGameserver>::Unregister()
{
// SteamAPI_UnregisterCallback removes k_ECallbackFlagsRegistered
SteamAPI_UnregisterCallback( this );
SteamAPI_UnregisterCallback(this);
}
template< class T, class P, bool bGameserver >
inline void CCallback< T, P, bGameserver >::Run( void *pvParam )
template <class T, class P, bool bGameserver>
inline void CCallback<T, P, bGameserver>::Run(void* pvParam)
{
(m_pObj->*m_Func)((P *)pvParam);
(m_pObj->*m_Func)((P*)pvParam);
}
#endif // #ifndef API_GEN
// structure that contains client callback data
// see callbacks documentation for more details
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#if defined(VALVE_CALLBACK_PACK_SMALL)
#pragma pack(push, 4)
#elif defined(VALVE_CALLBACK_PACK_LARGE)
#pragma pack(push, 8)
#else
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
/// Internal structure used in manual callback dispatch
struct CallbackMsg_t
{
struct CallbackMsg_t {
HSteamUser m_hSteamUser; // Specific user to whom this callback applies.
int m_iCallback; // Callback identifier. (Corresponds to the k_iCallback enum in the callback structure.)
uint8 *m_pubParam; // Points to the callback structure
uint8* m_pubParam; // Points to the callback structure
int m_cubParam; // Size of the data pointed to by m_pubParam
};
#pragma pack( pop )
#pragma pack(pop)
// Macros to define steam callback structures. Used internally for debugging
#ifdef STEAM_CALLBACK_INSPECTION_ENABLED
#include "../../clientdll/steam_api_callback_inspection.h"
#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) };
#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?)
@ -312,7 +321,7 @@ enum { k_iClientCompatCallbacks = 5800 };
enum { k_iSteamChatCallbacks = 5900 };
#ifdef _MSVC_VER
#pragma warning( pop )
#pragma warning(pop)
#endif
// CSteamAPIContext encapsulates the Steamworks API global accessors into
@ -321,11 +330,10 @@ enum { k_iSteamChatCallbacks = 5900 };
// DEPRECATED: Used the global interface accessors instead!
//
// This will be removed in a future iteration of the SDK
class CSteamAPIContext
{
class CSteamAPIContext {
public:
CSteamAPIContext() { Clear(); }
inline void Clear() { memset( this, 0, sizeof(*this) ); }
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; }
@ -350,59 +358,57 @@ public:
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;
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
{
class CSteamGameServerAPIContext {
public:
CSteamGameServerAPIContext() { Clear(); }
inline void Clear() { memset( this, 0, sizeof(*this) ); }
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; }
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;
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;
};

View File

@ -10,12 +10,11 @@
#pragma once
#endif
#include "steam_api.h"
#include "isteamgameserver.h"
#include "isteamgameserverstats.h"
#include "steam_api.h"
enum EServerMode
{
enum EServerMode {
eServerModeInvalid = 0, // DO NOT USE
eServerModeNoAuthentication = 1, // Don't authenticate user logins and don't list on the server list
eServerModeAuthentication = 2, // Authenticate users, list on the server list, don't run VAC on clients that connect
@ -44,7 +43,7 @@ enum EServerMode
// UDP packets for the master server updater. See references to GameSocketShare in isteamgameserver.h.
// - The version string should be 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 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString );
inline bool SteamGameServer_Init(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char* pchVersionString);
// Shutdown SteamGameSeverXxx interfaces, log out, and free resources.
S_API void SteamGameServer_Shutdown();
@ -79,7 +78,7 @@ S_API uint64 SteamGameServer_GetSteamID();
inline bool CSteamGameServerAPIContext::Init()
{
m_pSteamClient = ::SteamGameServerClient();
if ( !m_pSteamClient )
if (!m_pSteamClient)
return false;
m_pSteamGameServer = ::SteamGameServer();
@ -90,18 +89,18 @@ inline bool CSteamGameServerAPIContext::Init()
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 )
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 usLegacySteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString );
inline bool SteamGameServer_Init( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString )
S_API bool S_CALLTYPE SteamInternal_GameServer_Init(uint32 unIP, uint16 usLegacySteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char* pchVersionString);
inline bool SteamGameServer_Init(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char* pchVersionString)
{
if ( !SteamInternal_GameServer_Init( unIP, 0, usGamePort, usQueryPort, eServerMode, pchVersionString ) )
if (!SteamInternal_GameServer_Init(unIP, 0, usGamePort, usQueryPort, eServerMode, pchVersionString))
return false;
return true;

File diff suppressed because it is too large Load Diff

View File

@ -12,16 +12,16 @@
#endif
#ifndef assert
#include <assert.h>
#include <assert.h>
#endif
#include <string.h>
#include "steamnetworkingtypes.h"
#include <string.h>
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#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
@ -36,37 +36,36 @@ const size_t k_cbSteamDatagramMaxSerializedTicket = 512;
/// 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.)
struct SteamDatagramHostedAddress
{
struct SteamDatagramHostedAddress {
// Size of data blob.
int m_cbSize;
// Opaque data
char m_data[ 128 ];
char m_data[128];
// Reset to empty state
void Clear() { memset( this, 0, sizeof(*this) ); }
void Clear() { memset(this, 0, sizeof(*this)); }
// Parse the data center out of the blob.
SteamNetworkingPOPID GetPopID() const { return CalculateSteamNetworkingPOPIDFromString( m_data ); }
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 )
void SetDevAddress(uint32 nIP, uint16 nPort, SteamNetworkingPOPID popid = 0)
{
GetSteamNetworkingLocationPOPStringFromID( popid, m_data );
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(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);
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).
@ -74,30 +73,34 @@ struct SteamDatagramHostedAddress
/// mainly so that we don't have to include <string> in the header.
/// Note: by "string", we don't mean that it's text. It'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) )
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 );
memcpy(m_data, str.c_str(), m_cbSize);
return true;
}
template <typename T> void GetAsStdString( T *str ) const
template <typename T>
void GetAsStdString(T* str) const
{
str->assign( m_data, m_cbSize );
str->assign(m_data, m_cbSize);
}
};
/// Ticket used to gain access to the relay network.
struct SteamDatagramRelayAuthTicket
{
struct SteamDatagramRelayAuthTicket {
SteamDatagramRelayAuthTicket() { Clear(); }
/// Reset all fields
void Clear() { memset( this, 0, sizeof(*this) ); m_nRestrictToVirtualPort = -1; }
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;
@ -172,10 +175,8 @@ struct SteamDatagramRelayAuthTicket
// get visibility into network conditions.)
//
struct ExtraField
{
enum EType
{
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.
@ -191,49 +192,47 @@ struct SteamDatagramRelayAuthTicket
};
enum { k_nMaxExtraFields = 16 };
int m_nExtraFields;
ExtraField m_vecExtraFields[ k_nMaxExtraFields ];
ExtraField m_vecExtraFields[k_nMaxExtraFields];
/// Helper to add an extra field in a single call
void AddExtraField_Int( const char *pszName, int64 val )
void AddExtraField_Int(const char* pszName, int64 val)
{
ExtraField *p = AddExtraField( pszName, ExtraField::k_EType_Int );
if ( p )
ExtraField* p = AddExtraField(pszName, ExtraField::k_EType_Int);
if (p)
p->m_nIntValue = val;
}
void AddExtraField_Fixed64( const char *pszName, uint64 val )
void AddExtraField_Fixed64(const char* pszName, uint64 val)
{
ExtraField *p = AddExtraField( pszName, ExtraField::k_EType_Fixed64 );
if ( p )
ExtraField* p = AddExtraField(pszName, ExtraField::k_EType_Fixed64);
if (p)
p->m_nFixed64Value = val;
}
void AddExtraField_String( const char *pszName, const char *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 );
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 )
ExtraField* AddExtraField(const char* pszName, ExtraField::EType eType)
{
if ( m_nExtraFields >= k_nMaxExtraFields )
{
assert( false );
if (m_nExtraFields >= k_nMaxExtraFields) {
assert(false);
return NULL;
}
ExtraField *p = &m_vecExtraFields[ m_nExtraFields++ ];
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 );
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;
}
@ -260,8 +259,7 @@ const size_t k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized = 4096;
/// whitelists or tables of IP addresses.
///
/// See ISteamNetworkingSockets::GetGameCoordinatorServerLogin
struct SteamDatagramGameCoordinatorServerLogin
{
struct SteamDatagramGameCoordinatorServerLogin {
/// Server's identity
SteamNetworkingIdentity m_identity;
@ -280,7 +278,7 @@ struct SteamDatagramGameCoordinatorServerLogin
/// Application data. This is any additional information
/// that you need to identify the server not contained above.
/// (E.g. perhaps a public IP as seen by the coordinator service.)
char m_appData[ k_cbMaxSteamDatagramGameCoordinatorServerLoginAppData ];
char m_appData[k_cbMaxSteamDatagramGameCoordinatorServerLoginAppData];
};
#endif // STEAMDATAGRAM_TICKETS_H

View File

@ -12,29 +12,28 @@
static const int k_nSteamEncryptedAppTicketSymmetricKeyLen = 32;
S_API bool SteamEncryptedAppTicket_BDecryptTicket(const uint8* rgubTicketEncrypted, uint32 cubTicketEncrypted,
uint8* rgubTicketDecrypted, uint32* pcubTicketDecrypted,
const uint8 rgubKey[k_nSteamEncryptedAppTicketSymmetricKeyLen], int cubKey);
S_API bool SteamEncryptedAppTicket_BDecryptTicket( const uint8 *rgubTicketEncrypted, uint32 cubTicketEncrypted,
uint8 *rgubTicketDecrypted, uint32 *pcubTicketDecrypted,
const uint8 rgubKey[k_nSteamEncryptedAppTicketSymmetricKeyLen], int cubKey );
S_API bool SteamEncryptedAppTicket_BIsTicketForApp(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID);
S_API bool SteamEncryptedAppTicket_BIsTicketForApp( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID );
S_API RTime32 SteamEncryptedAppTicket_GetTicketIssueTime(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted);
S_API RTime32 SteamEncryptedAppTicket_GetTicketIssueTime( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
S_API void SteamEncryptedAppTicket_GetTicketSteamID(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted, CSteamID* psteamID);
S_API void SteamEncryptedAppTicket_GetTicketSteamID( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, CSteamID *psteamID );
S_API AppId_t SteamEncryptedAppTicket_GetTicketAppID(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted);
S_API AppId_t SteamEncryptedAppTicket_GetTicketAppID( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
S_API bool SteamEncryptedAppTicket_BUserOwnsAppInTicket(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID);
S_API bool SteamEncryptedAppTicket_BUserOwnsAppInTicket( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID );
S_API bool SteamEncryptedAppTicket_BUserIsVacBanned(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted);
S_API bool SteamEncryptedAppTicket_BUserIsVacBanned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
S_API bool SteamEncryptedAppTicket_BGetAppDefinedValue(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32* pValue);
S_API bool SteamEncryptedAppTicket_BGetAppDefinedValue( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32 *pValue );
S_API const uint8* SteamEncryptedAppTicket_GetUserVariableData(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32* pcubUserData);
S_API const uint8 *SteamEncryptedAppTicket_GetUserVariableData( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32 *pcubUserData );
S_API bool SteamEncryptedAppTicket_BIsTicketSigned(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted, const uint8* pubRSAKey, uint32 cubRSAKey);
S_API bool SteamEncryptedAppTicket_BIsTicketSigned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, const uint8 *pubRSAKey, uint32 cubRSAKey );
S_API bool SteamEncryptedAppTicket_BIsLicenseBorrowed(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted);
S_API bool SteamEncryptedAppTicket_BIsLicenseBorrowed( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
S_API bool SteamEncryptedAppTicket_BIsLicenseTemporary( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
S_API bool SteamEncryptedAppTicket_BIsLicenseTemporary(uint8* rgubTicketDecrypted, uint32 cubTicketDecrypted);

View File

@ -14,8 +14,7 @@
// HTTP related types
// This enum is used in client API methods, do not re-number existing values.
enum EHTTPMethod
{
enum EHTTPMethod {
k_EHTTPMethodInvalid = 0,
k_EHTTPMethodGET,
k_EHTTPMethodHEAD,
@ -32,11 +31,9 @@ enum EHTTPMethod
// k_EHTTPMethodCONNECT
};
// HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions
// of each of these.
enum EHTTPStatusCode
{
enum EHTTPStatusCode {
// Invalid status code (this isn't defined in HTTP, used to indicate unset in our code)
k_EHTTPStatusCodeInvalid = 0,

View File

@ -8,10 +8,10 @@
#define STEAMNETWORKINGTYPES
#pragma once
#include <string.h>
#include <stdint.h>
#include "steamtypes.h"
#include "steamclientpublic.h"
#include "steamtypes.h"
#include <stdint.h>
#include <string.h>
//-----------------------------------------------------------------------------
// SteamNetworkingSockets config.
@ -19,32 +19,32 @@
#define STEAMNETWORKINGSOCKETS_STEAMAPI // Compiling/link with steam_api.h and Steamworks SDK
//-----------------------------------------------------------------------------
#if !defined( STEAMNETWORKINGSOCKETS_OPENSOURCE ) && !defined( STEAMNETWORKINGSOCKETS_STREAMINGCLIENT )
#define STEAMNETWORKINGSOCKETS_STEAM
#if !defined(STEAMNETWORKINGSOCKETS_OPENSOURCE) && !defined(STEAMNETWORKINGSOCKETS_STREAMINGCLIENT)
#define STEAMNETWORKINGSOCKETS_STEAM
#endif
#ifdef NN_NINTENDO_SDK // We always static link on Nintendo
#define STEAMNETWORKINGSOCKETS_STATIC_LINK
#define STEAMNETWORKINGSOCKETS_STATIC_LINK
#endif
#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK )
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
#elif defined( STEAMNETWORKINGSOCKETS_FOREXPORT )
#ifdef _WIN32
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec( dllexport )
#else
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __attribute__((visibility("default")))
#endif
#if defined(STEAMNETWORKINGSOCKETS_STATIC_LINK)
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
#elif defined(STEAMNETWORKINGSOCKETS_FOREXPORT)
#ifdef _WIN32
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec(dllexport)
#else
#ifdef _WIN32
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec( dllimport )
#else
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
#endif
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __attribute__((visibility("default")))
#endif
#else
#ifdef _WIN32
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec(dllimport)
#else
#define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
#endif
#endif
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#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
@ -58,11 +58,11 @@ struct SteamRelayNetworkStatus_t;
struct SteamNetworkingMessagesSessionRequest_t;
struct SteamNetworkingMessagesSessionFailed_t;
typedef void (*FnSteamNetConnectionStatusChanged)( SteamNetConnectionStatusChangedCallback_t * );
typedef void (*FnSteamNetAuthenticationStatusChanged)( SteamNetAuthenticationStatus_t * );
typedef void (*FnSteamRelayNetworkStatusChanged)(SteamRelayNetworkStatus_t *);
typedef void (*FnSteamNetworkingMessagesSessionRequest)(SteamNetworkingMessagesSessionRequest_t *);
typedef void (*FnSteamNetworkingMessagesSessionFailed)(SteamNetworkingMessagesSessionFailed_t *);
typedef void (*FnSteamNetConnectionStatusChanged)(SteamNetConnectionStatusChangedCallback_t*);
typedef void (*FnSteamNetAuthenticationStatusChanged)(SteamNetAuthenticationStatus_t*);
typedef void (*FnSteamRelayNetworkStatusChanged)(SteamRelayNetworkStatus_t*);
typedef void (*FnSteamNetworkingMessagesSessionRequest)(SteamNetworkingMessagesSessionRequest_t*);
typedef void (*FnSteamNetworkingMessagesSessionFailed)(SteamNetworkingMessagesSessionFailed_t*);
/// Handle used to identify a connection to a remote host.
typedef uint32 HSteamNetConnection;
@ -84,7 +84,7 @@ const int k_cchMaxSteamNetworkingErrMsg = 1024;
/// Used to return English-language diagnostic error messages to caller.
/// (For debugging or spewing to a console, etc. Not intended for UI.)
typedef char SteamNetworkingErrMsg[ k_cchMaxSteamNetworkingErrMsg ];
typedef char SteamNetworkingErrMsg[k_cchMaxSteamNetworkingErrMsg];
/// Identifier used for a network location point of presence. (E.g. a Valve data center.)
/// Typically you won't need to directly manipulate these.
@ -98,8 +98,7 @@ typedef uint32 SteamNetworkingPOPID;
typedef int64 SteamNetworkingMicroseconds;
/// Describe the status of a particular network resource
enum ESteamNetworkingAvailability
{
enum ESteamNetworkingAvailability {
// Negative values indicate a problem.
//
// In general, we will not automatically retry unless you take some action that
@ -119,7 +118,6 @@ enum ESteamNetworkingAvailability
k_ESteamNetworkingAvailability_Current = 100, // Resource is online/available
k_ESteamNetworkingAvailability_Unknown = 0, // Internal dummy/sentinel, or value is not applicable in this context
k_ESteamNetworkingAvailability__Force32bit = 0x7fffffff,
};
@ -129,8 +127,7 @@ enum ESteamNetworkingAvailability
//
/// Different methods of describing the identity of a network host
enum ESteamNetworkingIdentityType
{
enum ESteamNetworkingIdentityType {
// Dummy/empty/invalid.
// Plese note that if we parse a string that we don't recognize
// but that appears reasonable, we will NOT use this type. Instead
@ -176,20 +173,19 @@ enum ESteamNetworkingIdentityType
k_ESteamNetworkingIdentityType__Force32bit = 0x7fffffff,
};
#pragma pack(push,1)
#pragma pack(push, 1)
/// Store an IP and port. IPv6 is always used; IPv4 is represented using
/// "IPv4-mapped" addresses: IPv4 aa.bb.cc.dd => IPv6 ::ffff:aabb:ccdd
/// (RFC 4291 section 2.5.5.2.)
struct SteamNetworkingIPAddr
{
struct SteamNetworkingIPAddr {
void Clear(); // Set everything to zero. E.g. [::]:0
bool IsIPv6AllZeros() const; // Return true if the IP is ::0. (Doesn't check port.)
void SetIPv6( const uint8 *ipv6, uint16 nPort ); // Set IPv6 address. IP is interpreted as bytes, so there are no endian issues. (Same as inaddr_in6.) The IP can be a mapped IPv4 address
void SetIPv4( uint32 nIP, uint16 nPort ); // Sets to IPv4 mapped address. IP and port are in host byte order.
void SetIPv6(const uint8* ipv6, uint16 nPort); // Set IPv6 address. IP is interpreted as bytes, so there are no endian issues. (Same as inaddr_in6.) The IP can be a mapped IPv4 address
void SetIPv4(uint32 nIP, uint16 nPort); // Sets to IPv4 mapped address. IP and port are in host byte order.
bool IsIPv4() const; // Return true if IP is mapped IPv4
uint32 GetIPv4() const; // Returns IP in host byte order (e.g. aa.bb.cc.dd as 0xaabbccdd). Returns 0 if IP is not mapped IPv4.
void SetIPv6LocalHost( uint16 nPort = 0); // Set to the IPv6 localhost address ::1, and the specified port.
void SetIPv6LocalHost(uint16 nPort = 0); // Set to the IPv6 localhost address ::1, and the specified port.
bool IsLocalHost() const; // Return true if this identity is localhost. (Either IPv6 ::1, or IPv4 127.0.0.1)
// Max length of the buffer needed to hold IP formatted using ToString, including '\0'
@ -203,29 +199,28 @@ struct SteamNetworkingIPAddr
/// to avoid truncation
///
/// See also SteamNetworkingIdentityRender
inline void ToString( char *buf, size_t cbBuf, bool bWithPort ) const;
inline void ToString(char* buf, size_t cbBuf, bool bWithPort) const;
/// Parse an IP address and optional port. If a port is not present, it is set to 0.
/// (This means that you cannot tell if a zero port was explicitly specified.)
inline bool ParseString( const char *pszStr );
inline bool ParseString(const char* pszStr);
/// RFC4038, section 4.2
struct IPv4MappedAddress {
uint64 m_8zeros;
uint16 m_0000;
uint16 m_ffff;
uint8 m_ip[ 4 ]; // NOTE: As bytes, i.e. network byte order
uint8 m_ip[4]; // NOTE: As bytes, i.e. network byte order
};
union
{
uint8 m_ipv6[ 16 ];
union {
uint8 m_ipv6[16];
IPv4MappedAddress m_ipv4;
};
uint16 m_port; // Host byte order
/// See if two addresses are identical
bool operator==(const SteamNetworkingIPAddr &x ) const;
bool operator==(const SteamNetworkingIPAddr& x) const;
};
/// An abstract way to represent the identity of a network host. All identities can
@ -233,8 +228,7 @@ struct SteamNetworkingIPAddr
/// used on the wire in several places, even though it is less efficient, in order to
/// facilitate forward compatibility. (Old client code can handle an identity type that
/// it doesn't understand.)
struct SteamNetworkingIdentity
{
struct SteamNetworkingIdentity {
/// Type of identity.
ESteamNetworkingIdentityType m_eType;
@ -245,27 +239,27 @@ struct SteamNetworkingIdentity
void Clear();
bool IsInvalid() const; // Return true if we are the invalid type. Does not make any other validity checks (e.g. is SteamID actually valid)
void SetSteamID( CSteamID steamID );
void SetSteamID(CSteamID steamID);
CSteamID GetSteamID() const; // Return black CSteamID (!IsValid()) if identity is not a SteamID
void SetSteamID64( uint64 steamID ); // Takes SteamID as raw 64-bit number
void SetSteamID64(uint64 steamID); // Takes SteamID as raw 64-bit number
uint64 GetSteamID64() const; // Returns 0 if identity is not SteamID
void SetIPAddr( const SteamNetworkingIPAddr &addr ); // Set to specified IP:port
const SteamNetworkingIPAddr *GetIPAddr() const; // returns null if we are not an IP address.
void SetIPAddr(const SteamNetworkingIPAddr& addr); // Set to specified IP:port
const SteamNetworkingIPAddr* GetIPAddr() const; // returns null if we are not an IP address.
// "localhost" is equivalent for many purposes to "anonymous." Our remote
// will identify us by the network address we use.
void SetLocalHost(); // Set to localhost. (We always use IPv6 ::1 for this, not 127.0.0.1)
bool IsLocalHost() const; // Return true if this identity is localhost.
bool SetGenericString( const char *pszString ); // Returns false if invalid length
const char *GetGenericString() const; // Returns nullptr if not generic string type
bool SetGenericString(const char* pszString); // Returns false if invalid length
const char* GetGenericString() const; // Returns nullptr if not generic string type
bool SetGenericBytes( const void *data, size_t cbLen ); // Returns false if invalid size.
const uint8 *GetGenericBytes( int &cbLen ) const; // Returns null if not generic bytes type
bool SetGenericBytes(const void* data, size_t cbLen); // Returns false if invalid size.
const uint8* GetGenericBytes(int& cbLen) const; // Returns null if not generic bytes type
/// See if two identities are identical
bool operator==(const SteamNetworkingIdentity &x ) const;
bool operator==(const SteamNetworkingIdentity& x) const;
/// Print to a human-readable string. This is suitable for debug messages
/// or any other time you need to encode the identity as a string. It has a
@ -273,14 +267,14 @@ struct SteamNetworkingIdentity
/// k_cchMaxString bytes big to avoid truncation.
///
/// See also SteamNetworkingIPAddrRender
void ToString( char *buf, size_t cbBuf ) const;
void ToString(char* buf, size_t cbBuf) const;
/// Parse back a string that was generated using ToString. If we don't understand the
/// string, but it looks "reasonable" (it matches the pattern type:<type-data> and doesn't
/// have any funky characters, etc), then we will return true, and the type is set to
/// k_ESteamNetworkingIdentityType_UnknownType. false will only be returned if the string
/// looks invalid.
bool ParseString( const char *pszStr );
bool ParseString(const char* pszStr);
// Max sizes
enum {
@ -298,11 +292,11 @@ struct SteamNetworkingIdentity
int m_cbSize;
union {
uint64 m_steamID64;
char m_szGenericString[ k_cchMaxGenericString ];
uint8 m_genericBytes[ k_cbMaxGenericBytes ];
char m_szUnknownRawString[ k_cchMaxString ];
char m_szGenericString[k_cchMaxGenericString];
uint8 m_genericBytes[k_cbMaxGenericBytes];
char m_szUnknownRawString[k_cchMaxString];
SteamNetworkingIPAddr m_ip;
uint32 m_reserved[ 32 ]; // Pad structure to leave easy room for future expansion
uint32 m_reserved[32]; // Pad structure to leave easy room for future expansion
};
};
#pragma pack(pop)
@ -312,8 +306,7 @@ struct SteamNetworkingIdentity
//
/// High level connection status
enum ESteamNetworkingConnectionState
{
enum ESteamNetworkingConnectionState {
/// Dummy value used to indicate an error condition in the API.
/// Specified connection doesn't exist or has already been closed.
@ -379,11 +372,11 @@ enum ESteamNetworkingConnectionState
/// in the queue are available.
k_ESteamNetworkingConnectionState_ProblemDetectedLocally = 5,
//
// The following values are used internally and will not be returned by any API.
// We document them here to provide a little insight into the state machine that is used
// under the hood.
//
//
// The following values are used internally and will not be returned by any API.
// We document them here to provide a little insight into the state machine that is used
// under the hood.
//
/// We've disconnected on our side, and from an API perspective the connection is closed.
/// No more data may be sent or received. All reliable data has been flushed, or else
@ -419,8 +412,7 @@ enum ESteamNetworkingConnectionState
/// Enumerate various causes of connection termination. These are designed to work similar
/// to HTTP error codes: the numeric range gives you a rough classification as to the source
/// of the problem.
enum ESteamNetConnectionEnd
{
enum ESteamNetConnectionEnd {
// Invalid/sentinel value
k_ESteamNetConnectionEnd_Invalid = 0,
@ -632,8 +624,7 @@ const int k_cchSteamNetworkingMaxConnectionCloseReason = 128;
const int k_cchSteamNetworkingMaxConnectionDescription = 128;
/// Describe the state of a connection.
struct SteamNetConnectionInfo_t
{
struct SteamNetConnectionInfo_t {
/// Who is on the other end? Depending on the connection type and phase of the connection, we might not know
SteamNetworkingIdentity m_identityRemote;
@ -667,7 +658,7 @@ struct SteamNetConnectionInfo_t
/// termination or problem. This is intended for debugging /
/// diagnostic purposes only, not to display to users. It might
/// have some details specific to the issue.
char m_szEndDebug[ k_cchSteamNetworkingMaxConnectionCloseReason ];
char m_szEndDebug[k_cchSteamNetworkingMaxConnectionCloseReason];
/// Debug description. This includes the internal connection ID,
/// connection type (and peer information), and any name
@ -676,7 +667,7 @@ struct SteamNetConnectionInfo_t
///
/// Note that the connection ID *usually* matches the HSteamNetConnection
/// handle, but in certain cases with symmetric connections it might not.
char m_szConnectionDescription[ k_cchSteamNetworkingMaxConnectionDescription ];
char m_szConnectionDescription[k_cchSteamNetworkingMaxConnectionDescription];
/// Internal stuff, room to change API easily
uint32 reserved[64];
@ -684,8 +675,7 @@ struct SteamNetConnectionInfo_t
/// Quick connection state, pared down to something you could call
/// more frequently without it being too big of a perf hit.
struct SteamNetworkingQuickConnectionStatus
{
struct SteamNetworkingQuickConnectionStatus {
/// High level state of the connection
ESteamNetworkingConnectionState m_eState;
@ -755,7 +745,7 @@ struct SteamNetworkingQuickConnectionStatus
uint32 reserved[16];
};
#pragma pack( pop )
#pragma pack(pop)
//
// Network messages
@ -767,11 +757,10 @@ struct SteamNetworkingQuickConnectionStatus
const int k_cbMaxSteamNetworkingSocketsMessageSizeSend = 512 * 1024;
/// A message that has been received.
struct SteamNetworkingMessage_t
{
struct SteamNetworkingMessage_t {
/// Message payload
void *m_pData;
void* m_pData;
/// Size of the payload.
int m_cbSize;
@ -818,12 +807,12 @@ struct SteamNetworkingMessage_t
/// usually be something like:
///
/// free( pMsg->m_pData );
void (*m_pfnFreeData)( SteamNetworkingMessage_t *pMsg );
void (*m_pfnFreeData)(SteamNetworkingMessage_t* pMsg);
/// Function to used to decrement the internal reference count and, if
/// it's zero, release the message. You should not set this function pointer,
/// or need to access this directly! Use the Release() function instead!
void (*m_pfnRelease)( SteamNetworkingMessage_t *pMsg );
void (*m_pfnRelease)(SteamNetworkingMessage_t* pMsg);
/// When using ISteamNetworkingMessages, the channel number the message was received on
/// (Not used for messages sent or received on "connections")
@ -847,8 +836,11 @@ struct SteamNetworkingMessage_t
// For code compatibility, some accessors
#ifndef API_GEN
inline uint32 GetSize() const { return m_cbSize; }
inline const void *GetData() const { return m_pData; }
inline uint32 GetSize() const
{
return m_cbSize;
}
inline const void* GetData() const { return m_pData; }
inline int GetChannel() const { return m_nChannel; }
inline HSteamNetConnection GetConnection() const { return m_conn; }
inline int64 GetConnectionUserData() const { return m_nConnUserData; }
@ -861,7 +853,7 @@ protected:
// - You will receive a pointer to a message object when you receive messages (e.g. ISteamNetworkingSockets::ReceiveMessagesOnConnection)
// - You can allocate a message object for efficient sending using ISteamNetworkingUtils::AllocateMessage
// - Call Release() to free the object
inline ~SteamNetworkingMessage_t() {}
inline ~SteamNetworkingMessage_t() { }
};
//
@ -903,7 +895,7 @@ const int k_nSteamNetworkingSend_NoNagle = 1;
// and then immediately flushing the messages using ISteamNetworkingSockets::FlushMessagesOnConnection
// or ISteamNetworkingMessages::FlushMessagesToUser. (But using this flag is more efficient since you
// only make one API call.)
const int k_nSteamNetworkingSend_UnreliableNoNagle = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoNagle;
const int k_nSteamNetworkingSend_UnreliableNoNagle = k_nSteamNetworkingSend_Unreliable | k_nSteamNetworkingSend_NoNagle;
// If the message cannot be sent very soon (because the connection is still doing some initial
// handshaking, route negotiations, etc), then just drop it. This is only applicable for unreliable
@ -921,7 +913,7 @@ const int k_nSteamNetworkingSend_NoDelay = 4;
// will not be placed on the wire in the next ~200ms or so.
//
// If a message is dropped for these reasons, k_EResultIgnored will be returned.
const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoDelay|k_nSteamNetworkingSend_NoNagle;
const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable | k_nSteamNetworkingSend_NoDelay | k_nSteamNetworkingSend_NoNagle;
// Reliable message send. Can send up to k_cbMaxSteamNetworkingSocketsMessageSizeSend bytes in a single message.
// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for
@ -937,7 +929,7 @@ const int k_nSteamNetworkingSend_Reliable = 8;
// Send a message reliably, but bypass Nagle's algorithm.
//
// Migration note: This is equivalent to k_EP2PSendReliable
const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable|k_nSteamNetworkingSend_NoNagle;
const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable | k_nSteamNetworkingSend_NoNagle;
// By default, message sending is queued, and the work of encryption and talking to
// the operating system sockets, etc is done on a service thread. This is usually a
@ -992,9 +984,8 @@ const int k_nSteamNetworkingSend_AutoRestartBrokenSession = 32;
/// send it over the wire, or persist it in a file or database! If you need
/// to do that, convert it to a string representation using the methods in
/// ISteamNetworkingUtils().
struct SteamNetworkPingLocation_t
{
uint8 m_data[ 512 ];
struct SteamNetworkPingLocation_t {
uint8 m_data[512];
};
/// Max possible length of a ping location, in string format. This is
@ -1013,8 +1004,7 @@ const int k_nSteamNetworkingPing_Unknown = -2;
//
/// Configuration values can be applied to different types of objects.
enum ESteamNetworkingConfigScope
{
enum ESteamNetworkingConfigScope {
/// Get/set global option, or defaults. Even options that apply to more specific scopes
/// have global scope, and you may be able to just change the global defaults. If you
@ -1041,8 +1031,7 @@ enum ESteamNetworkingConfigScope
};
// Different configuration values have different data types
enum ESteamNetworkingConfigDataType
{
enum ESteamNetworkingConfigDataType {
k_ESteamNetworkingConfig_Int32 = 1,
k_ESteamNetworkingConfig_Int64 = 2,
k_ESteamNetworkingConfig_Float = 3,
@ -1053,8 +1042,7 @@ enum ESteamNetworkingConfigDataType
};
/// Configuration options
enum ESteamNetworkingConfigValue
{
enum ESteamNetworkingConfigValue {
k_ESteamNetworkingConfig_Invalid = 0,
/// [global float, 0--100] Randomly discard N pct of packets instead of sending/recv
@ -1324,16 +1312,16 @@ enum ESteamNetworkingConfigValue
// P2P settings
//
// /// [listen socket int32] When you create a P2P listen socket, we will automatically
// /// open up a UDP port to listen for LAN connections. LAN connections can be made
// /// without any signaling: both sides can be disconnected from the Internet.
// ///
// /// This value can be set to zero to disable the feature.
// k_ESteamNetworkingConfig_P2P_Discovery_Server_LocalPort = 101,
//
// /// [connection int32] P2P connections can perform broadcasts looking for the peer
// /// on the LAN.
// k_ESteamNetworkingConfig_P2P_Discovery_Client_RemotePort = 102,
// /// [listen socket int32] When you create a P2P listen socket, we will automatically
// /// open up a UDP port to listen for LAN connections. LAN connections can be made
// /// without any signaling: both sides can be disconnected from the Internet.
// ///
// /// This value can be set to zero to disable the feature.
// k_ESteamNetworkingConfig_P2P_Discovery_Server_LocalPort = 101,
//
// /// [connection int32] P2P connections can perform broadcasts looking for the peer
// /// on the LAN.
// k_ESteamNetworkingConfig_P2P_Discovery_Client_RemotePort = 102,
/// [connection string] Comma-separated list of STUN servers that can be used
/// for NAT piercing. If you set this to an empty string, NAT piercing will
@ -1439,8 +1427,7 @@ const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_All = 0x7fffffff;
/// when the object is created, we just iterate over the list of options and call
/// ISteamNetworkingUtils::SetConfigValueStruct, where the scope arguments are supplied by the
/// object being created.
struct SteamNetworkingConfigValue_t
{
struct SteamNetworkingConfigValue_t {
/// Which option is being set
ESteamNetworkingConfigValue m_eValue;
@ -1448,43 +1435,42 @@ struct SteamNetworkingConfigValue_t
ESteamNetworkingConfigDataType m_eDataType;
/// Option value
union
{
union {
int32_t m_int32;
int64_t m_int64;
float m_float;
const char *m_string; // Points to your '\0'-terminated buffer
void *m_ptr;
const char* m_string; // Points to your '\0'-terminated buffer
void* m_ptr;
} m_val;
//
// Shortcut helpers to set the type and value in a single call
//
inline void SetInt32( ESteamNetworkingConfigValue eVal, int32_t data )
inline void SetInt32(ESteamNetworkingConfigValue eVal, int32_t data)
{
m_eValue = eVal;
m_eDataType = k_ESteamNetworkingConfig_Int32;
m_val.m_int32 = data;
}
inline void SetInt64( ESteamNetworkingConfigValue eVal, int64_t data )
inline void SetInt64(ESteamNetworkingConfigValue eVal, int64_t data)
{
m_eValue = eVal;
m_eDataType = k_ESteamNetworkingConfig_Int64;
m_val.m_int64 = data;
}
inline void SetFloat( ESteamNetworkingConfigValue eVal, float data )
inline void SetFloat(ESteamNetworkingConfigValue eVal, float data)
{
m_eValue = eVal;
m_eDataType = k_ESteamNetworkingConfig_Float;
m_val.m_float = data;
}
inline void SetPtr( ESteamNetworkingConfigValue eVal, void *data )
inline void SetPtr(ESteamNetworkingConfigValue eVal, void* data)
{
m_eValue = eVal;
m_eDataType = k_ESteamNetworkingConfig_Ptr;
m_val.m_ptr = data;
}
inline void SetString( ESteamNetworkingConfigValue eVal, const char *data ) // WARNING - Just saves your pointer. Does NOT make a copy of the string
inline void SetString(ESteamNetworkingConfigValue eVal, const char* data) // WARNING - Just saves your pointer. Does NOT make a copy of the string
{
m_eValue = eVal;
m_eDataType = k_ESteamNetworkingConfig_Ptr;
@ -1493,8 +1479,7 @@ struct SteamNetworkingConfigValue_t
};
/// Return value of ISteamNetworkintgUtils::GetConfigValue
enum ESteamNetworkingGetConfigValueResult
{
enum ESteamNetworkingGetConfigValueResult {
k_ESteamNetworkingGetConfigValue_BadValue = -1, // No such configuration value
k_ESteamNetworkingGetConfigValue_BadScopeObj = -2, // Bad connection handle, etc
k_ESteamNetworkingGetConfigValue_BufferTooSmall = -3, // Couldn't fit the result in your buffer
@ -1510,8 +1495,7 @@ enum ESteamNetworkingGetConfigValueResult
/// Detail level for diagnostic output callback.
/// See ISteamNetworkingUtils::SetDebugOutputFunction
enum ESteamNetworkingSocketsDebugOutputType
{
enum ESteamNetworkingSocketsDebugOutputType {
k_ESteamNetworkingSocketsDebugOutputType_None = 0,
k_ESteamNetworkingSocketsDebugOutputType_Bug = 1, // You used the API incorrectly, or an internal error happened
k_ESteamNetworkingSocketsDebugOutputType_Error = 2, // Run-time error condition that isn't the result of a bug. (E.g. we are offline, cannot bind a port, etc)
@ -1526,14 +1510,14 @@ enum ESteamNetworkingSocketsDebugOutputType
};
/// Setup callback for debug output, and the desired verbosity you want.
typedef void (*FSteamNetworkingSocketsDebugOutput)( ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg );
typedef void (*FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType, const char* pszMsg);
//
// Valve data centers
//
/// Convert 3- or 4-character ID to 32-bit int.
inline SteamNetworkingPOPID CalculateSteamNetworkingPOPIDFromString( const char *pszCode )
inline SteamNetworkingPOPID CalculateSteamNetworkingPOPIDFromString(const char* pszCode)
{
// OK we made a bad decision when we decided how to pack 3-character codes into a uint32. We'd like to support
// 4-character codes, but we don't want to break compatibility. The migration path has some subtleties that make
@ -1546,12 +1530,10 @@ inline SteamNetworkingPOPID CalculateSteamNetworkingPOPIDFromString( const char
//
// There is also extra paranoia to make sure the bytes are not treated as signed.
SteamNetworkingPOPID result = (uint32)(uint8)pszCode[0] << 16U;
if ( pszCode[1] )
{
result |= ( (uint32)(uint8)pszCode[1] << 8U );
if ( pszCode[2] )
{
result |= (uint32)(uint8)pszCode[2] | ( (uint32)(uint8)pszCode[3] << 24U );
if (pszCode[1]) {
result |= ((uint32)(uint8)pszCode[1] << 8U);
if (pszCode[2]) {
result |= (uint32)(uint8)pszCode[2] | ((uint32)(uint8)pszCode[3] << 24U);
}
}
return result;
@ -1561,28 +1543,27 @@ inline SteamNetworkingPOPID CalculateSteamNetworkingPOPIDFromString( const char
///
/// See also SteamNetworkingPOPIDRender
template <int N>
inline void GetSteamNetworkingLocationPOPStringFromID( SteamNetworkingPOPID id, char (&szCode)[N] )
inline void GetSteamNetworkingLocationPOPStringFromID(SteamNetworkingPOPID id, char (&szCode)[N])
{
static_assert( N >= 5, "Fixed-size buffer not big enough to hold SDR POP ID" );
szCode[0] = char( id >> 16U );
szCode[1] = char( id >> 8U );
szCode[2] = char( id );
szCode[3] = char( id >> 24U ); // See comment above about deep regret and sadness
static_assert(N >= 5, "Fixed-size buffer not big enough to hold SDR POP ID");
szCode[0] = char(id >> 16U);
szCode[1] = char(id >> 8U);
szCode[2] = char(id);
szCode[3] = char(id >> 24U); // See comment above about deep regret and sadness
szCode[4] = 0;
}
/// The POPID "dev" is used in non-production environments for testing.
const SteamNetworkingPOPID k_SteamDatagramPOPID_dev = ( (uint32)'d' << 16U ) | ( (uint32)'e' << 8U ) | (uint32)'v';
const SteamNetworkingPOPID k_SteamDatagramPOPID_dev = ((uint32)'d' << 16U) | ((uint32)'e' << 8U) | (uint32)'v';
/// Utility class for printing a SteamNetworkingPOPID.
struct SteamNetworkingPOPIDRender
{
SteamNetworkingPOPIDRender( SteamNetworkingPOPID x ) { GetSteamNetworkingLocationPOPStringFromID( x, buf ); }
inline const char *c_str() const { return buf; }
private:
char buf[ 8 ];
};
struct SteamNetworkingPOPIDRender {
SteamNetworkingPOPIDRender(SteamNetworkingPOPID x) { GetSteamNetworkingLocationPOPStringFromID(x, buf); }
inline const char* c_str() const { return buf; }
private:
char buf[8];
};
///////////////////////////////////////////////////////////////////////////////
//
@ -1593,35 +1574,98 @@ private:
typedef SteamNetworkingMessage_t ISteamNetworkingMessage;
typedef SteamNetworkingErrMsg SteamDatagramErrMsg;
inline void SteamNetworkingIPAddr::Clear() { memset( this, 0, sizeof(*this) ); }
inline bool SteamNetworkingIPAddr::IsIPv6AllZeros() const { const uint64 *q = (const uint64 *)m_ipv6; return q[0] == 0 && q[1] == 0; }
inline void SteamNetworkingIPAddr::SetIPv6( const uint8 *ipv6, uint16 nPort ) { memcpy( m_ipv6, ipv6, 16 ); m_port = nPort; }
inline void SteamNetworkingIPAddr::SetIPv4( uint32 nIP, uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0xffff; m_ipv4.m_ip[0] = uint8(nIP>>24); m_ipv4.m_ip[1] = uint8(nIP>>16); m_ipv4.m_ip[2] = uint8(nIP>>8); m_ipv4.m_ip[3] = uint8(nIP); m_port = nPort; }
inline void SteamNetworkingIPAddr::Clear() { memset(this, 0, sizeof(*this)); }
inline bool SteamNetworkingIPAddr::IsIPv6AllZeros() const
{
const uint64* q = (const uint64*)m_ipv6;
return q[0] == 0 && q[1] == 0;
}
inline void SteamNetworkingIPAddr::SetIPv6(const uint8* ipv6, uint16 nPort)
{
memcpy(m_ipv6, ipv6, 16);
m_port = nPort;
}
inline void SteamNetworkingIPAddr::SetIPv4(uint32 nIP, uint16 nPort)
{
m_ipv4.m_8zeros = 0;
m_ipv4.m_0000 = 0;
m_ipv4.m_ffff = 0xffff;
m_ipv4.m_ip[0] = uint8(nIP >> 24);
m_ipv4.m_ip[1] = uint8(nIP >> 16);
m_ipv4.m_ip[2] = uint8(nIP >> 8);
m_ipv4.m_ip[3] = uint8(nIP);
m_port = nPort;
}
inline bool SteamNetworkingIPAddr::IsIPv4() const { return m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0xffff; }
inline uint32 SteamNetworkingIPAddr::GetIPv4() const { return IsIPv4() ? ( (uint32(m_ipv4.m_ip[0])<<24) | (uint32(m_ipv4.m_ip[1])<<16) | (uint32(m_ipv4.m_ip[2])<<8) | uint32(m_ipv4.m_ip[3]) ) : 0; }
inline void SteamNetworkingIPAddr::SetIPv6LocalHost( uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0; m_ipv6[12] = 0; m_ipv6[13] = 0; m_ipv6[14] = 0; m_ipv6[15] = 1; m_port = nPort; }
inline bool SteamNetworkingIPAddr::IsLocalHost() const { return ( m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0 && m_ipv6[12] == 0 && m_ipv6[13] == 0 && m_ipv6[14] == 0 && m_ipv6[15] == 1 ) || ( GetIPv4() == 0x7f000001 ); }
inline bool SteamNetworkingIPAddr::operator==(const SteamNetworkingIPAddr &x ) const { return memcmp( this, &x, sizeof(SteamNetworkingIPAddr) ) == 0; }
inline uint32 SteamNetworkingIPAddr::GetIPv4() const { return IsIPv4() ? ((uint32(m_ipv4.m_ip[0]) << 24) | (uint32(m_ipv4.m_ip[1]) << 16) | (uint32(m_ipv4.m_ip[2]) << 8) | uint32(m_ipv4.m_ip[3])) : 0; }
inline void SteamNetworkingIPAddr::SetIPv6LocalHost(uint16 nPort)
{
m_ipv4.m_8zeros = 0;
m_ipv4.m_0000 = 0;
m_ipv4.m_ffff = 0;
m_ipv6[12] = 0;
m_ipv6[13] = 0;
m_ipv6[14] = 0;
m_ipv6[15] = 1;
m_port = nPort;
}
inline bool SteamNetworkingIPAddr::IsLocalHost() const { return (m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0 && m_ipv6[12] == 0 && m_ipv6[13] == 0 && m_ipv6[14] == 0 && m_ipv6[15] == 1) || (GetIPv4() == 0x7f000001); }
inline bool SteamNetworkingIPAddr::operator==(const SteamNetworkingIPAddr& x) const { return memcmp(this, &x, sizeof(SteamNetworkingIPAddr)) == 0; }
inline void SteamNetworkingIdentity::Clear() { memset( this, 0, sizeof(*this) ); }
inline void SteamNetworkingIdentity::Clear() { memset(this, 0, sizeof(*this)); }
inline bool SteamNetworkingIdentity::IsInvalid() const { return m_eType == k_ESteamNetworkingIdentityType_Invalid; }
inline void SteamNetworkingIdentity::SetSteamID( CSteamID steamID ) { SetSteamID64( steamID.ConvertToUint64() ); }
inline CSteamID SteamNetworkingIdentity::GetSteamID() const { return CSteamID( GetSteamID64() ); }
inline void SteamNetworkingIdentity::SetSteamID64( uint64 steamID ) { m_eType = k_ESteamNetworkingIdentityType_SteamID; m_cbSize = sizeof( m_steamID64 ); m_steamID64 = steamID; }
inline void SteamNetworkingIdentity::SetSteamID(CSteamID steamID) { SetSteamID64(steamID.ConvertToUint64()); }
inline CSteamID SteamNetworkingIdentity::GetSteamID() const { return CSteamID(GetSteamID64()); }
inline void SteamNetworkingIdentity::SetSteamID64(uint64 steamID)
{
m_eType = k_ESteamNetworkingIdentityType_SteamID;
m_cbSize = sizeof(m_steamID64);
m_steamID64 = steamID;
}
inline uint64 SteamNetworkingIdentity::GetSteamID64() const { return m_eType == k_ESteamNetworkingIdentityType_SteamID ? m_steamID64 : 0; }
inline void SteamNetworkingIdentity::SetIPAddr( const SteamNetworkingIPAddr &addr ) { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip = addr; }
inline const SteamNetworkingIPAddr *SteamNetworkingIdentity::GetIPAddr() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? &m_ip : NULL; }
inline void SteamNetworkingIdentity::SetLocalHost() { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv6LocalHost(); }
inline void SteamNetworkingIdentity::SetIPAddr(const SteamNetworkingIPAddr& addr)
{
m_eType = k_ESteamNetworkingIdentityType_IPAddress;
m_cbSize = (int)sizeof(m_ip);
m_ip = addr;
}
inline const SteamNetworkingIPAddr* SteamNetworkingIdentity::GetIPAddr() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? &m_ip : NULL; }
inline void SteamNetworkingIdentity::SetLocalHost()
{
m_eType = k_ESteamNetworkingIdentityType_IPAddress;
m_cbSize = (int)sizeof(m_ip);
m_ip.SetIPv6LocalHost();
}
inline bool SteamNetworkingIdentity::IsLocalHost() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress && m_ip.IsLocalHost(); }
inline bool SteamNetworkingIdentity::SetGenericString( const char *pszString ) { size_t l = strlen( pszString ); if ( l >= sizeof(m_szGenericString) ) return false;
m_eType = k_ESteamNetworkingIdentityType_GenericString; m_cbSize = int(l+1); memcpy( m_szGenericString, pszString, m_cbSize ); return true; }
inline const char *SteamNetworkingIdentity::GetGenericString() const { return m_eType == k_ESteamNetworkingIdentityType_GenericString ? m_szGenericString : NULL; }
inline bool SteamNetworkingIdentity::SetGenericBytes( const void *data, size_t cbLen ) { if ( cbLen > sizeof(m_genericBytes) ) return false;
m_eType = k_ESteamNetworkingIdentityType_GenericBytes; m_cbSize = int(cbLen); memcpy( m_genericBytes, data, m_cbSize ); return true; }
inline const uint8 *SteamNetworkingIdentity::GetGenericBytes( int &cbLen ) const { if ( m_eType != k_ESteamNetworkingIdentityType_GenericBytes ) return NULL;
cbLen = m_cbSize; return m_genericBytes; }
inline bool SteamNetworkingIdentity::operator==(const SteamNetworkingIdentity &x ) const { return m_eType == x.m_eType && m_cbSize == x.m_cbSize && memcmp( m_genericBytes, x.m_genericBytes, m_cbSize ) == 0; }
inline void SteamNetworkingMessage_t::Release() { (*m_pfnRelease)( this ); }
inline bool SteamNetworkingIdentity::SetGenericString(const char* pszString)
{
size_t l = strlen(pszString);
if (l >= sizeof(m_szGenericString))
return false;
m_eType = k_ESteamNetworkingIdentityType_GenericString;
m_cbSize = int(l + 1);
memcpy(m_szGenericString, pszString, m_cbSize);
return true;
}
inline const char* SteamNetworkingIdentity::GetGenericString() const { return m_eType == k_ESteamNetworkingIdentityType_GenericString ? m_szGenericString : NULL; }
inline bool SteamNetworkingIdentity::SetGenericBytes(const void* data, size_t cbLen)
{
if (cbLen > sizeof(m_genericBytes))
return false;
m_eType = k_ESteamNetworkingIdentityType_GenericBytes;
m_cbSize = int(cbLen);
memcpy(m_genericBytes, data, m_cbSize);
return true;
}
inline const uint8* SteamNetworkingIdentity::GetGenericBytes(int& cbLen) const
{
if (m_eType != k_ESteamNetworkingIdentityType_GenericBytes)
return NULL;
cbLen = m_cbSize;
return m_genericBytes;
}
inline bool SteamNetworkingIdentity::operator==(const SteamNetworkingIdentity& x) const { return m_eType == x.m_eType && m_cbSize == x.m_cbSize && memcmp(m_genericBytes, x.m_genericBytes, m_cbSize) == 0; }
inline void SteamNetworkingMessage_t::Release() { (*m_pfnRelease)(this); }
#endif // #ifndef API_GEN

View File

@ -22,19 +22,18 @@
#define STEAM_PS3_LANGUAGE_MAX 64
#define STEAM_PS3_REGION_CODE_MAX 16
#define STEAM_PS3_CURRENT_PARAMS_VER 2
struct SteamPS3Params_t
{
struct SteamPS3Params_t {
uint32 m_unVersion; // set to STEAM_PS3_CURRENT_PARAMS_VER
void *pReserved;
void* pReserved;
uint32 m_nAppId; // set to your game's appid
char m_rgchInstallationPath[ STEAM_PS3_PATH_MAX ]; // directory containing latest steam prx's and sdata. Can be read only (BDVD)
char m_rgchSystemCache[ STEAM_PS3_PATH_MAX ]; // temp working cache, not persistent
char m_rgchGameData[ STEAM_PS3_PATH_MAX ]; // persistent game data path for storing user data
char m_rgchNpServiceID[ STEAM_PS3_SERVICE_ID_MAX ];
char m_rgchNpCommunicationID[ STEAM_PS3_COMMUNICATION_ID_MAX ];
char m_rgchNpCommunicationSig[ STEAM_PS3_COMMUNICATION_SIG_MAX ];
char m_rgchInstallationPath[STEAM_PS3_PATH_MAX]; // directory containing latest steam prx's and sdata. Can be read only (BDVD)
char m_rgchSystemCache[STEAM_PS3_PATH_MAX]; // temp working cache, not persistent
char m_rgchGameData[STEAM_PS3_PATH_MAX]; // persistent game data path for storing user data
char m_rgchNpServiceID[STEAM_PS3_SERVICE_ID_MAX];
char m_rgchNpCommunicationID[STEAM_PS3_COMMUNICATION_ID_MAX];
char m_rgchNpCommunicationSig[STEAM_PS3_COMMUNICATION_SIG_MAX];
// Language should be one of the following. must be zero terminated
// danish
@ -53,60 +52,53 @@ struct SteamPS3Params_t
// spanish
// swedish
// tchinese
char m_rgchSteamLanguage[ STEAM_PS3_LANGUAGE_MAX ];
char m_rgchSteamLanguage[STEAM_PS3_LANGUAGE_MAX];
// region codes are "SCEA", "SCEE", "SCEJ". must be zero terminated
char m_rgchRegionCode[ STEAM_PS3_REGION_CODE_MAX ];
char m_rgchRegionCode[STEAM_PS3_REGION_CODE_MAX];
// Should be SYS_TTYP3 through SYS_TTYP10, if it's 0 then Steam won't spawn a
// thread to read console input at all. Using this let's you use Steam console commands
// like: profile_on, profile_off, profile_dump, mem_stats, mem_validate.
unsigned int m_cSteamInputTTY;
struct Ps3netInit_t
{
struct Ps3netInit_t {
bool m_bNeedInit;
void *m_pMemory;
void* m_pMemory;
int m_nMemorySize;
int m_flags;
} m_sysNetInitInfo;
struct Ps3jpgInit_t
{
struct Ps3jpgInit_t {
bool m_bNeedInit;
} m_sysJpgInitInfo;
struct Ps3pngInit_t
{
struct Ps3pngInit_t {
bool m_bNeedInit;
} m_sysPngInitInfo;
struct Ps3sysutilUserInfo_t
{
struct Ps3sysutilUserInfo_t {
bool m_bNeedInit;
} m_sysSysUtilUserInfo;
bool m_bIncludeNewsPage;
};
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// PlayStation 3 memory structure
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
#define STEAMPS3_MALLOC_INUSE 0x53D04A51
#define STEAMPS3_MALLOC_SYSTEM 0x0D102C48
#define STEAMPS3_MALLOC_OK 0xFFD04A51
struct SteamPS3Memory_t
{
struct SteamPS3Memory_t {
bool m_bSingleAllocation; // If true, Steam will request one 6MB allocation and use the returned memory for all future allocations
// If false, Steam will make call malloc for each allocation
// required function pointers
void* (*m_pfMalloc)(size_t);
void* (*m_pfRealloc)(void *, size_t);
void (*m_pfFree)(void *);
void* (*m_pfRealloc)(void*, size_t);
void (*m_pfFree)(void*);
size_t (*m_pUsable_size)(void*);
};
#endif // STEAMPS3PARAMS_H

View File

@ -17,11 +17,11 @@
typedef unsigned char uint8;
#endif
#if defined( __GNUC__ ) && !defined(POSIX)
#if __GNUC__ < 4
#error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)"
#endif
#define POSIX 1
#if defined(__GNUC__) && !defined(POSIX)
#if __GNUC__ < 4
#error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)"
#endif
#define POSIX 1
#endif
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
@ -36,7 +36,7 @@ typedef unsigned char uint8;
typedef unsigned char uint8;
typedef signed char int8;
#if defined( _WIN32 )
#if defined(_WIN32)
typedef __int16 int16;
typedef unsigned __int16 uint16;
@ -85,29 +85,29 @@ typedef unsigned int uintp;
#endif // else _WIN32
#ifdef API_GEN
# define STEAM_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR )))
#define STEAM_CLANG_ATTR(ATTR) __attribute__((annotate(ATTR)))
#else
# define STEAM_CLANG_ATTR(ATTR)
#define STEAM_CLANG_ATTR(ATTR)
#endif
#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_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 ";")
#define STEAM_FLAT_NAME(NAME) STEAM_CLANG_ATTR("flat_name:" #NAME ";")
const int k_cubSaltSize = 8;
typedef uint8 Salt_t[ k_cubSaltSize ];
typedef uint8 Salt_t[k_cubSaltSize];
//-----------------------------------------------------------------------------
// GID (GlobalID) stuff
@ -147,7 +147,6 @@ const AssetClassId_t k_ulAssetClassIdInvalid = 0x0;
typedef uint32 PhysicalItemId_t;
const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0;
// this is baked into client messages and interfaces as an int,
// make sure we never break this. AppIds and DepotIDs also presently
// share the same namespace, but since we'd like to change that in the future
@ -184,16 +183,14 @@ const SiteId_t k_ulSiteIdInvalid = 0;
typedef uint64 PartyBeaconID_t;
const PartyBeaconID_t k_ulPartyBeaconIdInvalid = 0;
enum ESteamIPType
{
enum ESteamIPType {
k_ESteamIPTypeIPv4 = 0,
k_ESteamIPTypeIPv6 = 1,
};
#pragma pack( push, 1 )
#pragma pack(push, 1)
struct SteamIPAddress_t
{
struct SteamIPAddress_t {
union {
uint32 m_unIPv4; // Host order
@ -207,13 +204,10 @@ struct SteamIPAddress_t
bool IsSet() const
{
if ( k_ESteamIPTypeIPv4 == m_eType )
{
if (k_ESteamIPTypeIPv4 == m_eType) {
return m_unIPv4 != 0;
}
else
{
return m_ipv6Qword[0] !=0 || m_ipv6Qword[1] != 0;
} else {
return m_ipv6Qword[0] != 0 || m_ipv6Qword[1] != 0;
}
}
@ -257,7 +251,6 @@ struct SteamIPAddress_t
}
};
#pragma pack( pop )
#pragma pack(pop)
#endif // STEAMTYPES_H

View File

@ -10,10 +10,8 @@
#pragma once
#endif
// Steam universes. Each universe is a self-contained Steam instance.
enum EUniverse
{
enum EUniverse {
k_EUniverseInvalid = 0,
k_EUniversePublic = 1,
k_EUniverseBeta = 2,
@ -23,5 +21,4 @@ enum EUniverse
k_EUniverseMax
};
#endif // STEAMUNIVERSE_H

View File

@ -69,7 +69,6 @@ void SteamAccount::onAvatarImageLoaded(AvatarImageLoaded_t* avatarImage)
return;
}
QImage avatar {
imageData.data(),
static_cast<int>(width),

View File

@ -24,5 +24,4 @@ bool setItemTags(const QVariant& updateHandle, const QStringList tags)
return SteamUGC()->SetItemTags(updateHandle.toULongLong(), pTags);
}
}

View File

@ -17,8 +17,8 @@ struct ItemUpdateData {
QString m_preview;
QMap<QString, QString> m_keyValueTag; //add new key-value tags for the item. Note that there can be multiple values for a tag.
QString m_changeNote;
QPair<QString,ScreenPlayWorkshopSteamEnums::EItemPreviewType> m_previewFile;
QPair<QString,ScreenPlayWorkshopSteamEnums::EItemPreviewType> m_previewVideo;
QPair<QString, ScreenPlayWorkshopSteamEnums::EItemPreviewType> m_previewFile;
QPair<QString, ScreenPlayWorkshopSteamEnums::EItemPreviewType> m_previewVideo;
const char* title() const { return m_title.toUtf8().data(); }
const char* description() const { return m_description.toUtf8().data(); }

View File

@ -26,14 +26,15 @@ public:
SteamWorkshop* steamWorkshop() const { return m_steamWorkshop.get(); }
public slots:
void aaa(){
void aaa()
{
qDebug() << "aaaaaaaaaaaaaaaaaaaa";
}
bool init()
{
qInfo() << "steamWorkshop init";
if(!steamWorkshop()){
if (!steamWorkshop()) {
qInfo() << "steamWorkshop NOT VALID!";
}