mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 14:45:51 +03:00
Steamworks 1.48
This commit is contained in:
parent
cfa77bc9e2
commit
85339a079a
@ -56,7 +56,7 @@ public:
|
||||
|
||||
// set the local IP and Port to bind to
|
||||
// this must be set before CreateLocalUser()
|
||||
virtual void SetLocalIPBinding( uint32 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;
|
||||
@ -156,14 +156,19 @@ public:
|
||||
// Steam Parties interface
|
||||
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; )
|
||||
|
||||
};
|
||||
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient018"
|
||||
#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 ) );
|
||||
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.)
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#define STEAM_CONTROLLER_MAX_ORIGINS 8
|
||||
|
||||
#define STEAM_CONTROLLER_MAX_ACTIVE_LAYERS 16
|
||||
|
||||
// When sending an option to a specific controller handle, you can send to all controllers via this command
|
||||
#define STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS UINT64_MAX
|
||||
|
||||
@ -41,49 +43,6 @@ enum ESteamControllerPad
|
||||
};
|
||||
#endif
|
||||
|
||||
enum EControllerSource
|
||||
{
|
||||
k_EControllerSource_None,
|
||||
k_EControllerSource_LeftTrackpad,
|
||||
k_EControllerSource_RightTrackpad,
|
||||
k_EControllerSource_Joystick,
|
||||
k_EControllerSource_ABXY,
|
||||
k_EControllerSource_Switch,
|
||||
k_EControllerSource_LeftTrigger,
|
||||
k_EControllerSource_RightTrigger,
|
||||
k_EControllerSource_LeftBumper,
|
||||
k_EControllerSource_RightBumper,
|
||||
k_EControllerSource_Gyro,
|
||||
k_EControllerSource_CenterTrackpad, // PS4
|
||||
k_EControllerSource_RightJoystick, // Traditional Controllers
|
||||
k_EControllerSource_DPad, // Traditional Controllers
|
||||
k_EControllerSource_Key, // Keyboards with scan codes - Unused
|
||||
k_EControllerSource_Mouse, // Traditional mouse - Unused
|
||||
k_EControllerSource_LeftGyro, // Secondary Gyro - Switch - Unused
|
||||
k_EControllerSource_Count
|
||||
};
|
||||
|
||||
enum EControllerSourceMode
|
||||
{
|
||||
k_EControllerSourceMode_None,
|
||||
k_EControllerSourceMode_Dpad,
|
||||
k_EControllerSourceMode_Buttons,
|
||||
k_EControllerSourceMode_FourButtons,
|
||||
k_EControllerSourceMode_AbsoluteMouse,
|
||||
k_EControllerSourceMode_RelativeMouse,
|
||||
k_EControllerSourceMode_JoystickMove,
|
||||
k_EControllerSourceMode_JoystickMouse,
|
||||
k_EControllerSourceMode_JoystickCamera,
|
||||
k_EControllerSourceMode_ScrollWheel,
|
||||
k_EControllerSourceMode_Trigger,
|
||||
k_EControllerSourceMode_TouchMenu,
|
||||
k_EControllerSourceMode_MouseJoystick,
|
||||
k_EControllerSourceMode_MouseRegion,
|
||||
k_EControllerSourceMode_RadialMenu,
|
||||
k_EControllerSourceMode_SingleButton,
|
||||
k_EControllerSourceMode_Switches
|
||||
};
|
||||
|
||||
// Note: Please do not use action origins as a way to identify controller types. There is no
|
||||
// guarantee that they will be added in a contiguous manner - use GetInputTypeForHandle instead
|
||||
// Versions of Steam that add new controller types in the future will extend this enum if you're
|
||||
@ -345,6 +304,12 @@ enum EControllerActionOrigin
|
||||
k_EControllerActionOrigin_Switch_RightGrip_Lower, // Right JoyCon SL Button
|
||||
k_EControllerActionOrigin_Switch_RightGrip_Upper, // Right JoyCon SR Button
|
||||
|
||||
// Added in SDK 1.45
|
||||
k_EControllerActionOrigin_PS4_DPad_Move,
|
||||
k_EControllerActionOrigin_XBoxOne_DPad_Move,
|
||||
k_EControllerActionOrigin_XBox360_DPad_Move,
|
||||
k_EControllerActionOrigin_Switch_DPad_Move,
|
||||
|
||||
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.
|
||||
};
|
||||
@ -489,7 +454,7 @@ 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( 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
|
||||
@ -508,7 +473,10 @@ public:
|
||||
virtual void ActivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
|
||||
virtual void DeactivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
|
||||
virtual void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle ) = 0;
|
||||
virtual int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t *handlesOut ) = 0;
|
||||
// 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;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ACTIONS
|
||||
@ -523,7 +491,7 @@ public:
|
||||
// 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, 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;
|
||||
@ -534,7 +502,7 @@ public:
|
||||
// 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, 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;
|
||||
@ -582,10 +550,10 @@ public:
|
||||
// Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index
|
||||
virtual int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle ) = 0;
|
||||
|
||||
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin. This function is cheap.
|
||||
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin.
|
||||
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
|
||||
|
||||
// Get a local path to art for on-screen glyph for a particular Xbox controller origin. This function is serialized.
|
||||
// Get a local path to art for on-screen glyph for a particular Xbox controller origin.
|
||||
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
|
||||
@ -594,6 +562,9 @@ public:
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController007"
|
||||
|
@ -254,7 +254,9 @@ public:
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
// iterators for getting users in a chat room, lobby, game server or clan
|
||||
@ -344,9 +346,15 @@ public:
|
||||
// Rich Presence data is automatically shared between friends who are in the same game
|
||||
// Each user has a set of Key/Value pairs
|
||||
// Note the following limits: k_cchMaxRichPresenceKeys, k_cchMaxRichPresenceKeyLength, k_cchMaxRichPresenceValueLength
|
||||
// There are two magic keys:
|
||||
// There are five magic keys:
|
||||
// "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list
|
||||
// "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game
|
||||
// "steam_display" - Names a rich presence localization token that will be displayed in the viewing user's selected language
|
||||
// in the Steam client UI. For more info: https://partner.steamgames.com/doc/api/ISteamFriends#richpresencelocalization
|
||||
// "steam_player_group" - When set, indicates to the Steam client that the player is a member of a particular group. Players in the same group
|
||||
// may be organized together in various places in the Steam UI.
|
||||
// "steam_player_group_size" - When set, indicates the total number of players in the steam_player_group. The Steam client may use this number to
|
||||
// display additional information about a group when all of the members are not part of a user's friends list.
|
||||
// GetFriendRichPresence() returns an empty string "" if no value is set
|
||||
// SetRichPresence() to a NULL or an empty string deletes the key
|
||||
// You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount()
|
||||
@ -362,7 +370,6 @@ public:
|
||||
// Rich invite support.
|
||||
// If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string.
|
||||
// (Or you can configure yout game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.)
|
||||
// Invites can only be sent to friends.
|
||||
virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0;
|
||||
|
||||
// recently-played-with friends iteration
|
||||
@ -415,6 +422,9 @@ public:
|
||||
/// You can register for UnreadChatMessagesChanged_t callbacks to know when this
|
||||
/// has potentially changed.
|
||||
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;
|
||||
};
|
||||
|
||||
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends017"
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
//
|
||||
|
||||
/// This is called by SteamGameServer_Init, and you will usually not need to call it directly
|
||||
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.
|
||||
@ -199,7 +199,7 @@ public:
|
||||
// Returns the public IP of the server according to Steam, useful when the server is
|
||||
// behind NAT and you want to advertise its IP in a lobby for other clients to directly
|
||||
// connect to
|
||||
virtual uint32 GetPublicIP() = 0;
|
||||
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
|
||||
@ -250,7 +250,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012"
|
||||
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer013"
|
||||
|
||||
// Global accessor
|
||||
inline ISteamGameServer *SteamGameServer();
|
||||
|
@ -27,16 +27,25 @@ public:
|
||||
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( GetUserStatFloat )
|
||||
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 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( 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 SetUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0;
|
||||
|
@ -23,34 +23,14 @@
|
||||
|
||||
#define STEAM_INPUT_MAX_ORIGINS 8
|
||||
|
||||
#define STEAM_INPUT_MAX_ACTIVE_LAYERS 16
|
||||
|
||||
// When sending an option to a specific controller handle, you can send to all devices via this command
|
||||
#define STEAM_INPUT_HANDLE_ALL_CONTROLLERS UINT64_MAX
|
||||
|
||||
#define STEAM_INPUT_MIN_ANALOG_ACTION_DATA -1.0f
|
||||
#define STEAM_INPUT_MAX_ANALOG_ACTION_DATA 1.0f
|
||||
|
||||
enum EInputSource
|
||||
{
|
||||
k_EInputSource_None,
|
||||
k_EInputSource_LeftTrackpad,
|
||||
k_EInputSource_RightTrackpad,
|
||||
k_EInputSource_Joystick,
|
||||
k_EInputSource_ABXY,
|
||||
k_EInputSource_Switch,
|
||||
k_EInputSource_LeftTrigger,
|
||||
k_EInputSource_RightTrigger,
|
||||
k_EInputSource_LeftBumper,
|
||||
k_EInputSource_RightBumper,
|
||||
k_EInputSource_Gyro,
|
||||
k_EInputSource_CenterTrackpad, // PS4
|
||||
k_EInputSource_RightJoystick, // Traditional Controllers
|
||||
k_EInputSource_DPad, // Traditional Controllers
|
||||
k_EInputSource_Key, // Keyboards with scan codes - Unused
|
||||
k_EInputSource_Mouse, // Traditional mouse - Unused
|
||||
k_EInputSource_LeftGyro, // Secondary Gyro - Switch - Unused
|
||||
k_EInputSource_Count
|
||||
};
|
||||
|
||||
enum EInputSourceMode
|
||||
{
|
||||
k_EInputSourceMode_None,
|
||||
@ -184,7 +164,7 @@ enum EInputActionOrigin
|
||||
k_EInputActionOrigin_PS4_Gyro_Pitch,
|
||||
k_EInputActionOrigin_PS4_Gyro_Yaw,
|
||||
k_EInputActionOrigin_PS4_Gyro_Roll,
|
||||
k_EInputActionOrigin_PS4_Reserved0,
|
||||
k_EInputActionOrigin_PS4_DPad_Move,
|
||||
k_EInputActionOrigin_PS4_Reserved1,
|
||||
k_EInputActionOrigin_PS4_Reserved2,
|
||||
k_EInputActionOrigin_PS4_Reserved3,
|
||||
@ -225,7 +205,7 @@ enum EInputActionOrigin
|
||||
k_EInputActionOrigin_XBoxOne_DPad_South,
|
||||
k_EInputActionOrigin_XBoxOne_DPad_West,
|
||||
k_EInputActionOrigin_XBoxOne_DPad_East,
|
||||
k_EInputActionOrigin_XBoxOne_Reserved0,
|
||||
k_EInputActionOrigin_XBoxOne_DPad_Move,
|
||||
k_EInputActionOrigin_XBoxOne_Reserved1,
|
||||
k_EInputActionOrigin_XBoxOne_Reserved2,
|
||||
k_EInputActionOrigin_XBoxOne_Reserved3,
|
||||
@ -266,7 +246,7 @@ enum EInputActionOrigin
|
||||
k_EInputActionOrigin_XBox360_DPad_South,
|
||||
k_EInputActionOrigin_XBox360_DPad_West,
|
||||
k_EInputActionOrigin_XBox360_DPad_East,
|
||||
k_EInputActionOrigin_XBox360_Reserved0,
|
||||
k_EInputActionOrigin_XBox360_DPad_Move,
|
||||
k_EInputActionOrigin_XBox360_Reserved1,
|
||||
k_EInputActionOrigin_XBox360_Reserved2,
|
||||
k_EInputActionOrigin_XBox360_Reserved3,
|
||||
@ -314,7 +294,7 @@ enum EInputActionOrigin
|
||||
k_EInputActionOrigin_Switch_ProGyro_Pitch, // Primary Gyro in Pro Controller, or Right JoyCon
|
||||
k_EInputActionOrigin_Switch_ProGyro_Yaw, // Primary Gyro in Pro Controller, or Right JoyCon
|
||||
k_EInputActionOrigin_Switch_ProGyro_Roll, // Primary Gyro in Pro Controller, or Right JoyCon
|
||||
k_EInputActionOrigin_Switch_Reserved0,
|
||||
k_EInputActionOrigin_Switch_DPad_Move,
|
||||
k_EInputActionOrigin_Switch_Reserved1,
|
||||
k_EInputActionOrigin_Switch_Reserved2,
|
||||
k_EInputActionOrigin_Switch_Reserved3,
|
||||
@ -498,7 +478,7 @@ 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( 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
|
||||
@ -517,7 +497,10 @@ public:
|
||||
virtual void ActivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle ) = 0;
|
||||
virtual void DeactivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle ) = 0;
|
||||
virtual void DeactivateAllActionSetLayers( InputHandle_t inputHandle ) = 0;
|
||||
virtual int GetActiveActionSetLayers( InputHandle_t inputHandle, InputActionSetHandle_t *handlesOut ) = 0;
|
||||
// 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;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ACTIONS
|
||||
@ -532,7 +515,7 @@ public:
|
||||
// Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
|
||||
// originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to
|
||||
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
|
||||
virtual int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin *originsOut ) = 0;
|
||||
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;
|
||||
@ -543,12 +526,12 @@ public:
|
||||
// Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
|
||||
// originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to
|
||||
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
|
||||
virtual int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin *originsOut ) = 0;
|
||||
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 - this call is cheap
|
||||
// Get a local path to art for on-screen glyph for a particular origin
|
||||
virtual const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) = 0;
|
||||
|
||||
// Returns a localized string (from Steam's language setting) for the specified origin - this call is serialized
|
||||
// Returns a localized string (from Steam's language setting) for the specified origin.
|
||||
virtual const char *GetStringForActionOrigin( EInputActionOrigin eOrigin ) = 0;
|
||||
|
||||
// Stop analog momentum for the action if it is a mouse action in trackball mode
|
||||
@ -594,10 +577,10 @@ public:
|
||||
// Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index
|
||||
virtual int GetGamepadIndexForController( InputHandle_t ulinputHandle ) = 0;
|
||||
|
||||
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin. This function is cheap.
|
||||
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin.
|
||||
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
|
||||
|
||||
// Get a local path to art for on-screen glyph for a particular Xbox controller origin. This function is serialized.
|
||||
// Get a local path to art for on-screen glyph for a particular Xbox controller origin
|
||||
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
|
||||
@ -605,9 +588,16 @@ public:
|
||||
virtual EInputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, EXboxOrigin eOrigin ) = 0;
|
||||
|
||||
// Convert an origin to another controller type - for inputs not present on the other controller type this will return k_EInputActionOrigin_None
|
||||
// When a new input type is added you will be able to pass in k_ESteamInputType_Unknown amd the closest origin that your version of the SDK regonized will be returned
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
#define STEAMINPUT_INTERFACE_VERSION "SteamInput001"
|
||||
|
@ -350,10 +350,19 @@ public:
|
||||
// Remove the property on the item
|
||||
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( 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( 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;
|
||||
|
||||
|
@ -23,6 +23,8 @@ enum ELobbyType
|
||||
k_ELobbyTypeInvisible = 3, // returned by search, but not visible to other friends
|
||||
// useful if you want a user in two lobbies, for example matching groups together
|
||||
// a user can be in only one regular lobby, and up to two invisible lobbies
|
||||
k_ELobbyTypePrivateUnique = 4, // private, unique and does not delete when empty - only one of these may exist per unique keypair set
|
||||
// can only create from webapi
|
||||
};
|
||||
|
||||
// lobby search filter tools
|
||||
@ -254,7 +256,6 @@ public:
|
||||
// after completion, the local user will no longer be the owner
|
||||
virtual void CheckForPSNGameBootInvite( unsigned int iGameBootAttributes ) = 0;
|
||||
#endif
|
||||
STEAM_CALL_BACK( LobbyChatUpdate_t )
|
||||
};
|
||||
#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking009"
|
||||
|
||||
|
@ -209,14 +209,14 @@ 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, uint32 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( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 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
|
||||
@ -258,11 +258,11 @@ public:
|
||||
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, uint32 *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, uint32 *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;
|
||||
@ -270,7 +270,7 @@ public:
|
||||
// max packet size, in bytes
|
||||
virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0;
|
||||
};
|
||||
#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking005"
|
||||
#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking006"
|
||||
|
||||
// Global interface accessor
|
||||
inline ISteamNetworking *SteamNetworking();
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include "steamnetworkingtypes.h"
|
||||
|
||||
class ISteamNetworkingSocketsCallbacks;
|
||||
struct SteamNetAuthenticationStatus_t;
|
||||
class ISteamNetworkingConnectionCustomSignaling;
|
||||
class ISteamNetworkingCustomSignalingRecvContext;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Lower level networking interface that more closely mirrors the standard
|
||||
@ -45,15 +48,20 @@ public:
|
||||
/// You must select a specific local port to listen on and set it
|
||||
/// the port field of the local address.
|
||||
///
|
||||
/// Usually you wil set the IP portion of the address to zero, (SteamNetworkingIPAddr::Clear()).
|
||||
/// This means that you will not bind to any particular local interface. In addition,
|
||||
/// if possible the socket will be bound in "dual stack" mode, which means that it can
|
||||
/// accept both IPv4 and IPv6 clients. If you wish to bind a particular interface, then
|
||||
/// set the local address to the appropriate IPv4 or IPv6 IP.
|
||||
/// Usually you will set the IP portion of the address to zero (SteamNetworkingIPAddr::Clear()).
|
||||
/// This means that you will not bind to any particular local interface (i.e. the same
|
||||
/// as INADDR_ANY in plain socket code). Furthermore, if possible the socket will be bound
|
||||
/// in "dual stack" mode, which means that it can accept both IPv4 and IPv6 client connections.
|
||||
/// If you really do wish to bind a particular interface, then set the local address to the
|
||||
/// appropriate IPv4 or IPv6 IP.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
|
||||
/// will be posted. The connection will be in the connecting state.
|
||||
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) = 0;
|
||||
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
|
||||
@ -73,7 +81,11 @@ public:
|
||||
/// distributed through some other out-of-band mechanism), you don't have any
|
||||
/// way of knowing who is actually on the other end, and thus are vulnerable to
|
||||
/// man-in-the-middle attacks.
|
||||
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) = 0;
|
||||
///
|
||||
/// 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;
|
||||
|
||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P
|
||||
@ -84,22 +96,26 @@ public:
|
||||
/// be able to connect to one or the other, then nVirtualPort should be a small integer (<1000)
|
||||
/// unique to each listen socket you create.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
virtual HSteamListenSocket CreateListenSocketP2P( int nVirtualPort ) = 0;
|
||||
///
|
||||
/// 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 nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// Begin connecting to a server that is identified using a platform-specific identifier.
|
||||
/// This requires some sort of third party rendezvous service, and will depend on the
|
||||
/// platform and what other libraries and services you are integrating with.
|
||||
/// This uses the default rendezvous service, which depends on the platform and library
|
||||
/// configuration. (E.g. on Steam, it goes through the steam backend.) The traffic is relayed
|
||||
/// over the Steam Datagram Relay network.
|
||||
///
|
||||
/// At the time of this writing, there is only one supported rendezvous service: Steam.
|
||||
/// Set the SteamID (whether "user" or "gameserver") and Steam will determine if the
|
||||
/// client is online and facilitate a relay connection. Note that all P2P connections on
|
||||
/// Steam are currently relayed.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) = 0;
|
||||
///
|
||||
/// 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 ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
#endif
|
||||
|
||||
/// Accept an incoming connection that has been received on a listen socket.
|
||||
@ -135,6 +151,12 @@ public:
|
||||
/// Returns k_EResultInvalidState if the connection is not in the appropriate state.
|
||||
/// (Remember that the connection state could change in between the time that the
|
||||
/// notification being posted to the queue and when it is received by the application.)
|
||||
///
|
||||
/// A note about connection configuration options. If you need to set any configuration
|
||||
/// options that are common to all connections accepted through a particular listen
|
||||
/// 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;
|
||||
|
||||
/// Disconnects from the remote host and invalidates the connection handle.
|
||||
@ -207,6 +229,9 @@ public:
|
||||
/// sockets that does not write excessively small chunks will
|
||||
/// work without any changes.
|
||||
///
|
||||
/// The pOutMessageNumber is an optional pointer to receive the
|
||||
/// message number assigned to the message, if sending was successful.
|
||||
///
|
||||
/// Returns:
|
||||
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
|
||||
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
|
||||
@ -216,7 +241,41 @@ 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 ) = 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
|
||||
/// function, you must first allocate a message object using
|
||||
/// ISteamNetworkingUtils::AllocateMessage. (Do not declare one
|
||||
/// on the stack or allocate your own.)
|
||||
///
|
||||
/// You should fill in the message payload. You can either let
|
||||
/// it allocate the buffer for you and then fill in the payload,
|
||||
/// or if you already have a buffer allocated, you can just point
|
||||
/// m_pData at your buffer and set the callback to the appropriate function
|
||||
/// to free it. Note that if you use your own buffer, it MUST remain valid
|
||||
/// until the callback is executed. And also note that your callback can be
|
||||
/// invoked at ant time from any thread (perhaps even before SendMessages
|
||||
/// returns!), so it MUST be fast and threadsafe.
|
||||
///
|
||||
/// You MUST also fill in:
|
||||
/// - m_conn - the handle of the connection to send the message to
|
||||
/// - m_nFlags - bitmask of k_nSteamNetworkingSend_xxx flags.
|
||||
///
|
||||
/// All other fields are currently reserved and should not be modified.
|
||||
///
|
||||
/// The library will take ownership of the message structures. They may
|
||||
/// be modified or become invalid at any time, so you must not read them
|
||||
/// after passing them to this function.
|
||||
///
|
||||
/// pOutMessageNumberOrResult is an optional array that will receive,
|
||||
/// for each message, the message number that was assigned to the message
|
||||
/// if sending was successful. If sending failed, then a negative EResult
|
||||
/// value is placed into the array. For example, the array will hold
|
||||
/// -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;
|
||||
|
||||
/// Flush any messages waiting on the Nagle timer and send them
|
||||
/// at the next transmission opportunity (often that means right now).
|
||||
@ -241,7 +300,7 @@ public:
|
||||
/// Reliable messages will be received in the order they were sent (and with the
|
||||
/// same sizes --- see SendMessageToConnection for on this subtle difference from a stream socket).
|
||||
///
|
||||
/// Unreliable messages may be dropped, or delivered out of order withrespect to
|
||||
/// Unreliable messages may be dropped, or delivered out of order with respect to
|
||||
/// each other or with respect to reliable messages. The same unreliable message
|
||||
/// may be received multiple times.
|
||||
///
|
||||
@ -250,16 +309,6 @@ public:
|
||||
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
|
||||
virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
/// Same as ReceiveMessagesOnConnection, but will return the next message available
|
||||
/// on any connection that was accepted through the specified listen socket. Examine
|
||||
/// SteamNetworkingMessage_t::m_conn to know which client connection.
|
||||
///
|
||||
/// Delivery order of messages among different clients is not defined. They may
|
||||
/// be returned in an order different from what they were actually received. (Delivery
|
||||
/// order of messages from the same client is well defined, and thus the order of the
|
||||
/// messages is relevant!)
|
||||
virtual int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
/// Returns basic information about the high-level state of the connection.
|
||||
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
|
||||
|
||||
@ -312,6 +361,91 @@ public:
|
||||
/// even if they are not signed into Steam.)
|
||||
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
|
||||
/// certificates. (This includes a certificate for us, as well as any CA certificates
|
||||
/// needed to authenticate peers.)
|
||||
///
|
||||
/// You can call this at program init time if you know that you are going to
|
||||
/// be making authenticated connections, so that we will be ready immediately when
|
||||
/// those connections are attempted. (Note that essentially all connections require
|
||||
/// authentication, with the exception of ordinary UDP connections with authentication
|
||||
/// disabled using k_ESteamNetworkingConfig_IP_AllowWithoutAuth.) If you don't call
|
||||
/// this function, we will wait until a feature is utilized that that necessitates
|
||||
/// these resources.
|
||||
///
|
||||
/// You can also call this function to force a retry, if failure has occurred.
|
||||
/// Once we make an attempt and fail, we will not automatically retry.
|
||||
/// In this respect, the behavior of the system after trying and failing is the same
|
||||
/// as before the first attempt: attempting authenticated communication or calling
|
||||
/// this function will call the system to attempt to acquire the necessary resources.
|
||||
///
|
||||
/// You can use GetAuthenticationStatus or listen for SteamNetAuthenticationStatus_t
|
||||
/// to monitor the status.
|
||||
///
|
||||
/// Returns the current value that would be returned from GetAuthenticationStatus.
|
||||
virtual ESteamNetworkingAvailability InitAuthentication() = 0;
|
||||
|
||||
/// Query our readiness to participate in authenticated communications. A
|
||||
/// SteamNetAuthenticationStatus_t callback is posted any time this status changes,
|
||||
/// but you can use this function to query it at any time.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
//
|
||||
// Poll groups. A poll group is a set of connections that can be polled efficiently.
|
||||
// (In our API, to "poll" a connection means to retrieve all pending messages. We
|
||||
// actually don't have an API to "poll" the connection *state*, like BSD sockets.)
|
||||
//
|
||||
|
||||
/// Create a new poll group.
|
||||
///
|
||||
/// You should destroy the poll group when you are done using DestroyPollGroup
|
||||
virtual HSteamNetPollGroup CreatePollGroup() = 0;
|
||||
|
||||
/// Destroy a poll group created with CreatePollGroup().
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// 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
|
||||
/// any other poll group it is in.
|
||||
///
|
||||
/// You can pass k_HSteamNetPollGroup_Invalid to remove a connection from its current
|
||||
/// poll group without adding it to a new poll group.
|
||||
///
|
||||
/// If there are received messages currently pending on the connection, an attempt
|
||||
/// is made to add them to the queue of messages for the poll group in approximately
|
||||
/// the order that would have applied if the connection was already part of the poll
|
||||
/// group at the time that the messages were received.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// Same as ReceiveMessagesOnConnection, but will return the next messages available
|
||||
/// on any connection in the poll group. Examine SteamNetworkingMessage_t::m_conn
|
||||
/// to know which connection. (SteamNetworkingMessage_t::m_nConnUserData might also
|
||||
/// be useful.)
|
||||
///
|
||||
/// Delivery order of messages among different connections will usually match the
|
||||
/// order that the last packet was received which completed the message. But this
|
||||
/// is not a strong guarantee, especially for packets received right as a connection
|
||||
/// is being assigned to poll group.
|
||||
///
|
||||
/// Delivery order of messages on the same connection is well defined and the
|
||||
/// same guarantees are present as mentioned in ReceiveMessagesOnConnection.
|
||||
/// (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;
|
||||
|
||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
|
||||
//
|
||||
@ -340,53 +474,194 @@ public:
|
||||
/// here. The reason is to make reconnection to a gameserver robust, even if the client computer loses
|
||||
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) = 0;
|
||||
///
|
||||
/// 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 nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
//
|
||||
// Servers hosted in Valve data centers
|
||||
// Servers hosted in data centers known to the Valve relay network
|
||||
//
|
||||
|
||||
/// Returns the value of the SDR_LISTEN_PORT environment variable. This
|
||||
/// is the UDP server your server will be listening on. This will
|
||||
/// configured automatically for you in production environments. (You
|
||||
/// should set it yourself for testing.)
|
||||
/// configured automatically for you in production environments.
|
||||
///
|
||||
/// In development, you'll need to set it yourself. See
|
||||
/// https://partner.steamgames.com/doc/api/ISteamNetworkingSockets
|
||||
/// for more information on how to configure dev environments.
|
||||
virtual uint16 GetHostedDedicatedServerPort() = 0;
|
||||
|
||||
/// If you are running in a production data center, this will return the data
|
||||
/// center code. Returns 0 otherwise.
|
||||
/// Returns 0 if SDR_LISTEN_PORT is not set. Otherwise, returns the data center the server
|
||||
/// is running in. This will be k_SteamDatagramPOPID_dev in non-production environment.
|
||||
virtual SteamNetworkingPOPID GetHostedDedicatedServerPOPID() = 0;
|
||||
|
||||
/// Return info about the hosted server. You will need to send this information to your
|
||||
/// backend, and put it in tickets, so that the relays will know how to forward traffic from
|
||||
/// Return info about the hosted server. This contains the PoPID of the server,
|
||||
/// and opaque routing information that can be used by the relays to send traffic
|
||||
/// to your server.
|
||||
///
|
||||
/// You will need to send this information to your backend, and put it in tickets,
|
||||
/// so that the relays will know how to forward traffic from
|
||||
/// clients to your server. See SteamDatagramRelayAuthTicket for more info.
|
||||
///
|
||||
/// NOTE ABOUT DEVELOPMENT ENVIRONMENTS:
|
||||
/// In production in our data centers, these parameters are configured via environment variables.
|
||||
/// In development, the only one you need to set is SDR_LISTEN_PORT, which is the local port you
|
||||
/// want to listen on. Furthermore, if you are running your server behind a corporate firewall,
|
||||
/// you probably will not be able to put the routing information returned by this function into
|
||||
/// tickets. Instead, it should be a public internet address that the relays can use to send
|
||||
/// data to your server. So you might just end up hardcoding a public address and setup port
|
||||
/// forwarding on your corporate firewall. In that case, the port you put into the ticket
|
||||
/// needs to be the public-facing port opened on your firewall, if it is different from the
|
||||
/// actual server port.
|
||||
/// Also, note that the routing information is contained in SteamDatagramGameCoordinatorServerLogin,
|
||||
/// so if possible, it's preferred to use GetGameCoordinatorServerLogin to send this info
|
||||
/// to your game coordinator service, and also login securely at the same time.
|
||||
///
|
||||
/// This function will fail if SteamDatagramServer_Init has not been called.
|
||||
/// On a successful exit, k_EResultOK is returned
|
||||
///
|
||||
/// Returns false if the SDR_LISTEN_PORT environment variable is not set.
|
||||
virtual bool GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) = 0;
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultInvalidState: We are not configured to listen for SDR (SDR_LISTEN_SOCKET
|
||||
/// is not set.)
|
||||
/// - k_EResultPending: we do not (yet) have the authentication information needed.
|
||||
/// (See GetAuthenticationStatus.) If you use environment variables to pre-fetch
|
||||
/// the network config, this data should always be available immediately.
|
||||
/// - A non-localized diagnostic debug message will be placed in m_data that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// Create a listen socket on the specified virtual port. The physical UDP port to use
|
||||
/// will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not
|
||||
/// configured, this call will fail.
|
||||
///
|
||||
/// Note that this call MUST be made through the SteamGameServerNetworkingSockets() interface
|
||||
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) = 0;
|
||||
///
|
||||
/// 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 nVirtualPort, 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
|
||||
/// steamdatagram_gamecoordinator.h)
|
||||
///
|
||||
/// Before calling the function:
|
||||
/// - Populate the app data in pLoginInfo (m_cbAppData and m_appData). You can leave
|
||||
/// all other fields uninitialized.
|
||||
/// - *pcbSignedBlob contains the size of the buffer at pBlob. (It should be
|
||||
/// at least k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized.)
|
||||
///
|
||||
/// On a successful exit:
|
||||
/// - k_EResultOK is returned
|
||||
/// - All of the remaining fields of pLoginInfo will be filled out.
|
||||
/// - *pcbSignedBlob contains the size of the serialized blob that has been
|
||||
/// placed into pBlob.
|
||||
///
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultNotLoggedOn: you are not logged in (yet)
|
||||
/// - See GetHostedDedicatedServerAddress for more potential failure return values.
|
||||
/// - A non-localized diagnostic debug message will be placed in pBlob that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// This works by signing the contents of the SteamDatagramGameCoordinatorServerLogin
|
||||
/// with the cert that is issued to this server. In dev environments, it's OK if you do
|
||||
/// not have a cert. (You will need to enable insecure dev login in SteamDatagram_ParseHostedServerLogin.)
|
||||
/// Otherwise, you will need a signed cert.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
|
||||
//
|
||||
// Relayed connections using custom signaling protocol
|
||||
//
|
||||
// This is used if you have your own method of sending out-of-band
|
||||
// signaling / rendezvous messages through a mutually trusted channel.
|
||||
//
|
||||
|
||||
/// Create a P2P "client" connection that does signaling over a custom
|
||||
/// rendezvous/signaling channel.
|
||||
///
|
||||
/// pSignaling points to a new object that you create just for this connection.
|
||||
/// It must stay valid until Release() is called. Once you pass the
|
||||
/// object to this function, it assumes ownership. Release() will be called
|
||||
/// from within the function call if the call fails. Furthermore, until Release()
|
||||
/// is called, you should be prepared for methods to be invoked on your
|
||||
/// object from any thread! You need to make sure your object is threadsafe!
|
||||
/// Furthermore, you should make sure that dispatching the methods is done
|
||||
/// as quickly as possible.
|
||||
///
|
||||
/// This function will immediately construct a connection in the "connecting"
|
||||
/// state. Soon after (perhaps before this function returns, perhaps in another thread),
|
||||
/// the connection will begin sending signaling messages by calling
|
||||
/// ISteamNetworkingConnectionCustomSignaling::SendSignal.
|
||||
///
|
||||
/// When the remote peer accepts the connection (See
|
||||
/// ISteamNetworkingCustomSignalingRecvContext::OnConnectRequest),
|
||||
/// it will begin sending signaling messages. When these messages are received,
|
||||
/// you can pass them to the connection using ReceivedP2PCustomSignal.
|
||||
///
|
||||
/// If you know the identity of the peer that you expect to be on the other end,
|
||||
/// you can pass their identity to improve debug output or just detect bugs.
|
||||
/// If you don't know their identity yet, you can pass NULL, and their
|
||||
/// identity will be established in the connection handshake.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
///
|
||||
/// 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( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, 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
|
||||
/// routing information was in the envelope into the context object,
|
||||
/// and then pass the payload to this function.
|
||||
///
|
||||
/// A few different things can happen next, depending on the message:
|
||||
///
|
||||
/// - If the signal is associated with existing connection, it is dealt
|
||||
/// with immediately. If any replies need to be sent, they will be
|
||||
/// dispatched using the ISteamNetworkingConnectionCustomSignaling
|
||||
/// associated with the connection.
|
||||
/// - If the message represents a connection request (and the request
|
||||
/// is not redundant for an existing connection), a new connection
|
||||
/// will be created, and ReceivedConnectRequest will be called on your
|
||||
/// context object to determine how to proceed.
|
||||
/// - Otherwise, the message is for a connection that does not
|
||||
/// exist (anymore). In this case, we *may* call SendRejectionReply
|
||||
/// on your context object.
|
||||
///
|
||||
/// In any case, we will not save off pContext or access it after this
|
||||
/// function returns.
|
||||
///
|
||||
/// Returns true if the message was parsed and dispatched without anything
|
||||
/// unusual or suspicious happening. Returns false if there was some problem
|
||||
/// with the message that prevented ordinary handling. (Debug output will
|
||||
/// usually have more information.)
|
||||
///
|
||||
/// 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, ISteamNetworkingCustomSignalingRecvContext *pContext ) = 0;
|
||||
#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
|
||||
//
|
||||
// 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
|
||||
/// return the number of bytes that were populated. You can pass pBlob=NULL to query for the required
|
||||
/// 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;
|
||||
|
||||
/// Set the certificate. The certificate blob should be the output of
|
||||
/// SteamDatagram_CreateCert.
|
||||
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
|
||||
|
||||
// Invoke all callbacks queued for this interface.
|
||||
// On Steam, callbacks are dispatched via the ordinary Steamworks callbacks mechanism.
|
||||
// So if you have code that is also targeting Steam, you should call this at about the
|
||||
@ -397,9 +672,84 @@ public:
|
||||
protected:
|
||||
~ISteamNetworkingSockets(); // Silence some warnings
|
||||
};
|
||||
#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets002"
|
||||
#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets008"
|
||||
|
||||
/// Interface used to send signaling messages for a particular connection.
|
||||
/// You will need to construct one of these per connection.
|
||||
///
|
||||
/// - For connections initiated locally, you will construct it and pass
|
||||
/// it to ISteamNetworkingSockets::ConnectP2PCustomSignaling.
|
||||
/// - For connections initiated remotely and "accepted" locally, you
|
||||
/// will return it from ISteamNetworkingCustomSignalingRecvContext::OnConnectRequest
|
||||
class ISteamNetworkingConnectionCustomSignaling
|
||||
{
|
||||
public:
|
||||
/// Called to send a rendezvous message to the remote peer. This may be called
|
||||
/// from any thread, at any time, so you need to be thread-safe! Don't take
|
||||
/// any locks that might hold while calling into SteamNetworkingSockets functions,
|
||||
/// because this could lead to deadlocks.
|
||||
///
|
||||
/// Note that when initiating a connection, we may not know the identity
|
||||
/// of the peer, if you did not specify it in ConnectP2PCustomSignaling.
|
||||
///
|
||||
/// Return true if a best-effort attempt was made to deliver the message.
|
||||
/// If you return false, it is assumed that the situation is fatal;
|
||||
/// the connection will be closed, and Release() will be called
|
||||
/// eventually.
|
||||
///
|
||||
/// Signaling objects will not be shared between connections.
|
||||
/// You can assume that the same value of hConn will be used
|
||||
/// every time.
|
||||
virtual bool SendSignal( HSteamNetConnection hConn, const SteamNetConnectionInfo_t &info, const void *pMsg, int cbMsg ) = 0;
|
||||
|
||||
/// Called when the connection no longer needs to send signals.
|
||||
/// Note that this happens eventually (but not immediately) after
|
||||
/// the connection is closed. Signals may need to be sent for a brief
|
||||
/// time after the connection is closed, to clean up the connection.
|
||||
virtual void Release() = 0;
|
||||
};
|
||||
|
||||
/// Interface used when a custom signal is received.
|
||||
/// See ISteamNetworkingSockets::ReceivedP2PCustomSignal
|
||||
class ISteamNetworkingCustomSignalingRecvContext
|
||||
{
|
||||
public:
|
||||
|
||||
/// Called when the signal represents a request for a new connection.
|
||||
///
|
||||
/// If you want to ignore the request, just return NULL. In this case,
|
||||
/// the peer will NOT receive any reply. You should consider ignoring
|
||||
/// requests rather than actively rejecting them, as a security measure.
|
||||
/// If you actively reject requests, then this makes it possible to detect
|
||||
/// if a user is online or not, just by sending them a request.
|
||||
///
|
||||
/// If you wish to send back a rejection, then use
|
||||
/// ISteamNetworkingSockets::CloseConnection() and then return NULL.
|
||||
/// We will marshal a properly formatted rejection signal and
|
||||
/// call SendRejectionSignal() so you can send it to them.
|
||||
///
|
||||
/// If you return a signaling object, the connection is NOT immediately
|
||||
/// accepted by default. Instead, it stays in the "connecting" state,
|
||||
/// and the usual callback is posted, and your app can accept the
|
||||
/// connection using ISteamNetworkingSockets::AcceptConnection. This
|
||||
/// may be useful so that these sorts of connections can be more similar
|
||||
/// to your application code as other types of connections accepted on
|
||||
/// a listen socket. If this is not useful and you want to skip this
|
||||
/// callback process and immediately accept the connection, call
|
||||
/// ISteamNetworkingSockets::AcceptConnection before returning the
|
||||
/// signaling object.
|
||||
///
|
||||
/// After accepting a connection (through either means), the connection
|
||||
/// will transition into the "finding route" state.
|
||||
virtual ISteamNetworkingConnectionCustomSignaling *OnConnectRequest( HSteamNetConnection hConn, const SteamNetworkingIdentity &identityPeer ) = 0;
|
||||
|
||||
/// This is called actively communication rejection or failure
|
||||
/// to the incoming message. If you intend to ignore all incoming requests
|
||||
/// that you do not wish to accept, then it's not strictly necessary to
|
||||
/// implement this.
|
||||
virtual void SendRejectionSignal( const SteamNetworkingIdentity &identityPeer, const void *pMsg, int cbMsg ) = 0;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
// Global accessor.
|
||||
#if defined( STEAMNETWORKINGSOCKETS_PARTNER )
|
||||
@ -411,7 +761,7 @@ extern "C" {
|
||||
inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_Lib(); }
|
||||
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_Lib(); }
|
||||
|
||||
#elif defined( STEAMNETWORKINGSOCKETS_OPENSOURCE )
|
||||
#elif defined( STEAMNETWORKINGSOCKETS_OPENSOURCE ) || defined( STEAMNETWORKINGSOCKETS_STREAMINGCLIENT )
|
||||
|
||||
// Opensource GameNetworkingSockets
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets();
|
||||
@ -482,8 +832,27 @@ struct SteamNetConnectionStatusChangedCallback_t
|
||||
/// Previous state. (Current state is in m_info.m_eState)
|
||||
ESteamNetworkingConnectionState m_eOldState;
|
||||
};
|
||||
|
||||
/// A struct used to describe our readiness to participate in authenticated,
|
||||
/// encrypted communication. In order to do this we need:
|
||||
///
|
||||
/// - The list of trusted CA certificates that might be relevant for this
|
||||
/// app.
|
||||
/// - A valid certificate issued by a CA.
|
||||
///
|
||||
/// This callback is posted whenever the state of our readiness changes.
|
||||
struct SteamNetAuthenticationStatus_t
|
||||
{
|
||||
enum { k_iCallback = k_iSteamNetworkingSocketsCallbacks + 2 };
|
||||
|
||||
/// Status
|
||||
ESteamNetworkingAvailability m_eAvail;
|
||||
|
||||
/// Non-localized English language status. For diagnostic/debugging
|
||||
/// purposes only.
|
||||
char m_debugMsg[ 256 ];
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
}
|
||||
|
||||
#endif // ISTEAMNETWORKINGSOCKETS
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "steamnetworkingtypes.h"
|
||||
struct SteamDatagramRelayAuthTicket;
|
||||
struct SteamRelayNetworkStatus_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Misc networking utilities for checking the local networking environment
|
||||
@ -21,28 +22,67 @@ struct SteamDatagramRelayAuthTicket;
|
||||
class ISteamNetworkingUtils
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Efficient message sending
|
||||
//
|
||||
|
||||
/// Allocate and initialize a message object. Usually the reason
|
||||
/// you call this is to pass it to ISteamNetworkingSockets::SendMessages.
|
||||
/// The returned object will have all of the relevant fields cleared to zero.
|
||||
///
|
||||
/// Optionally you can also request that this system allocate space to
|
||||
/// hold the payload itself. If cbAllocateBuffer is nonzero, the system
|
||||
/// will allocate memory to hold a payload of at least cbAllocateBuffer bytes.
|
||||
/// m_pData will point to the allocated buffer, m_cbSize will be set to the
|
||||
/// size, and m_pfnFreeData will be set to the proper function to free up
|
||||
/// the buffer.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
//
|
||||
// Access to Steam Datagram Relay (SDR) network
|
||||
//
|
||||
|
||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
|
||||
//
|
||||
// Initialization
|
||||
// Initialization and status check
|
||||
//
|
||||
|
||||
/// If you know that you are going to be using the relay network, call
|
||||
/// this to initialize the relay network or check if that initialization
|
||||
/// has completed. If you do not call this, the initialization will
|
||||
/// happen the first time you use a feature that requires access to the
|
||||
/// relay network, and that use will be delayed.
|
||||
/// If you know that you are going to be using the relay network (for example,
|
||||
/// because you anticipate making P2P connections), call this to initialize the
|
||||
/// relay network. If you do not call this, the initialization will
|
||||
/// be delayed until the first time you use a feature that requires access
|
||||
/// to the relay network, which will delay that first access.
|
||||
///
|
||||
/// Returns true if initialization has completed successfully.
|
||||
/// (It will probably return false on the first call.)
|
||||
/// You can also call this to force a retry if the previous attempt has failed.
|
||||
/// Performing any action that requires access to the relay network will also
|
||||
/// trigger a retry, and so calling this function is never strictly necessary,
|
||||
/// but it can be useful to call it a program launch time, if access to the
|
||||
/// relay network is anticipated.
|
||||
///
|
||||
/// Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
|
||||
/// callbacks to know when initialization has completed.
|
||||
/// Typically initialization completes in a few seconds.
|
||||
///
|
||||
/// Note: dedicated servers hosted with Valve do *not* need to call
|
||||
/// this, since they do not make routing decisions. However, if the
|
||||
/// dedicated server will be using P2P functionality, it will act as
|
||||
/// Note: dedicated servers hosted in known data centers do *not* need
|
||||
/// to call this, since they do not make routing decisions. However, if
|
||||
/// the dedicated server will be using P2P functionality, it will act as
|
||||
/// a "client" and this should be called.
|
||||
inline bool InitializeRelayNetworkAccess();
|
||||
inline void InitRelayNetworkAccess();
|
||||
|
||||
/// Fetch current status of the relay network.
|
||||
///
|
||||
/// SteamRelayNetworkStatus_t is also a callback. It will be triggered on
|
||||
/// both the user and gameserver interfaces any time the status changes, or
|
||||
/// ping measurement starts or stops.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
//
|
||||
// "Ping location" functions
|
||||
@ -59,14 +99,14 @@ public:
|
||||
// This is extremely useful to select peers for matchmaking!
|
||||
//
|
||||
// The markers can also be converted to a string, so they can be transmitted.
|
||||
// We have a separate library you can use on your backend to manipulate
|
||||
// these objects. (See steamdatagram_ticketgen.h)
|
||||
// We have a separate library you can use on your app's matchmaking/coordinating
|
||||
// server to manipulate these objects. (See steamdatagram_gamecoordinator.h)
|
||||
|
||||
/// Return location info for the current host. Returns the approximate
|
||||
/// age of the data, in seconds, or -1 if no data is available.
|
||||
///
|
||||
/// It takes a few seconds to initialize access to the relay network. If
|
||||
/// you call this very soon after calling InitializeRelayNetworkAccess,
|
||||
/// you call this very soon after calling InitRelayNetworkAccess,
|
||||
/// the data may not be available yet.
|
||||
///
|
||||
/// This always return the most up-to-date information we have available
|
||||
@ -117,10 +157,6 @@ public:
|
||||
/// the string.
|
||||
virtual bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result ) = 0;
|
||||
|
||||
//
|
||||
// Initialization / ping measurement status
|
||||
//
|
||||
|
||||
/// Check if the ping data of sufficient recency is available, and if
|
||||
/// it's too old, start refreshing it.
|
||||
///
|
||||
@ -136,13 +172,11 @@ public:
|
||||
/// Returns false if sufficiently recent data is not available. In this
|
||||
/// case, ping measurement is initiated, if it is not already active.
|
||||
/// (You cannot restart a measurement already in progress.)
|
||||
///
|
||||
/// You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
|
||||
/// to know when ping measurement completes.
|
||||
virtual bool CheckPingDataUpToDate( float flMaxAgeSeconds ) = 0;
|
||||
|
||||
/// Return true if we are taking ping measurements to update our ping
|
||||
/// location or select optimal routing. Ping measurement typically takes
|
||||
/// a few seconds, perhaps up to 10 seconds.
|
||||
virtual bool IsPingMeasurementInProgress() = 0;
|
||||
|
||||
//
|
||||
// List of Valve data centers, and ping times to them. This might
|
||||
// be useful to you if you are use our hosting, or just need to measure
|
||||
@ -199,8 +233,9 @@ public:
|
||||
///
|
||||
/// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg
|
||||
/// or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT
|
||||
/// request a high detail level and then filter out messages in your callback. Instead,
|
||||
/// call function function to adjust the desired level of detail.
|
||||
/// request a high detail level and then filter out messages in your callback. This incurs
|
||||
/// all of the expense of formatting the messages, which are then discarded. Setting a high
|
||||
/// priority value (low numeric value) here allows the library to avoid doing this work.
|
||||
///
|
||||
/// 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
|
||||
@ -224,7 +259,7 @@ public:
|
||||
/// - eScope: Onto what type of object are you applying the setting?
|
||||
/// - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.
|
||||
/// - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!
|
||||
/// - pArg: Value to set it to. You can pass NULL to remove a non-global sett at this scope,
|
||||
/// - pArg: Value to set it to. You can pass NULL to remove a non-global setting at this scope,
|
||||
/// causing the value for that object to use global defaults. Or at global scope, passing NULL
|
||||
/// will reset any custom value and restore it to the system default.
|
||||
/// NOTE: When setting callback functions, do not pass the function pointer directly.
|
||||
@ -232,6 +267,12 @@ public:
|
||||
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 );
|
||||
|
||||
/// Get a configuration value.
|
||||
/// - eValue: which value to fetch
|
||||
/// - eScopeType: query setting on what type of object
|
||||
@ -246,6 +287,9 @@ public:
|
||||
/// pOutNextValue can be used to iterate through all of the known configuration values.
|
||||
/// (Use GetFirstConfigValue() to begin the iteration, will be k_ESteamNetworkingConfig_Invalid on the last value)
|
||||
/// Any of the output parameters can be NULL if you do not need that information.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// Return the lowest numbered configuration value available in the current environment.
|
||||
@ -261,7 +305,7 @@ public:
|
||||
protected:
|
||||
~ISteamNetworkingUtils(); // Silence some warnings
|
||||
};
|
||||
#define STEAMNETWORKINGUTILS_INTERFACE_VERSION "SteamNetworkingUtils001"
|
||||
#define STEAMNETWORKINGUTILS_INTERFACE_VERSION "SteamNetworkingUtils003"
|
||||
|
||||
// Global accessor.
|
||||
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
|
||||
@ -274,15 +318,59 @@ protected:
|
||||
|
||||
// Steamworks SDK
|
||||
inline ISteamNetworkingUtils *SteamNetworkingUtils();
|
||||
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils, SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) );
|
||||
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils,
|
||||
/* 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 ),
|
||||
"global",
|
||||
STEAMNETWORKINGUTILS_INTERFACE_VERSION
|
||||
)
|
||||
#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
|
||||
{
|
||||
enum { k_iCallback = k_iSteamNetworkingUtilsCallbacks + 1 };
|
||||
|
||||
/// Summary status. When this is "current", initialization has
|
||||
/// completed. Anything else means you are not ready yet, or
|
||||
/// there is a significant problem.
|
||||
ESteamNetworkingAvailability m_eAvail;
|
||||
|
||||
/// Nonzero if latency measurement is in progress (or pending,
|
||||
/// awaiting a prerequisite).
|
||||
int m_bPingMeasurementInProgress;
|
||||
|
||||
/// Status obtaining the network config. This is a prerequisite
|
||||
/// for relay network access.
|
||||
///
|
||||
/// Failure to obtain the network config almost always indicates
|
||||
/// a problem with the local internet connection.
|
||||
ESteamNetworkingAvailability m_eAvailNetworkConfig;
|
||||
|
||||
/// Current ability to communicate with ANY relay. Note that
|
||||
/// the complete failure to communicate with any relays almost
|
||||
/// always indicates a problem with the local Internet connection.
|
||||
/// (However, just because you can reach a single relay doesn't
|
||||
/// mean that the local connection is in perfect health.)
|
||||
ESteamNetworkingAvailability m_eAvailAnyRelay;
|
||||
|
||||
/// Non-localized English language status. For diagnostic/debugging
|
||||
/// purposes only.
|
||||
char m_debugMsg[ 256 ];
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Internal stuff
|
||||
|
||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
inline bool ISteamNetworkingUtils::InitializeRelayNetworkAccess() { return CheckPingDataUpToDate( 1e10f ); }
|
||||
inline void ISteamNetworkingUtils::InitRelayNetworkAccess() { CheckPingDataUpToDate( 1e10f ); }
|
||||
#endif
|
||||
|
||||
inline bool ISteamNetworkingUtils::SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Int32, &val ); }
|
||||
@ -291,8 +379,15 @@ inline bool ISteamNetworkingUtils::SetGlobalConfigValueString( ESteamNetworkingC
|
||||
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::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
|
||||
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 );
|
||||
}
|
||||
|
||||
#if !defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) && defined( STEAMNETWORKINGSOCKETS_STEAM )
|
||||
#if !defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) && defined( STEAMNETWORKINGSOCKETS_STEAMCLIENT )
|
||||
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 ); }
|
||||
|
@ -28,6 +28,7 @@ enum EParentalFeature
|
||||
k_EFeatureParentalSetup = 10,
|
||||
k_EFeatureLibrary = 11,
|
||||
k_EFeatureTest = 12,
|
||||
k_EFeatureSiteLicense = 13,
|
||||
k_EFeatureMax
|
||||
};
|
||||
|
||||
|
88
Generator/steam_sdk/isteamremoteplay.h
Normal file
88
Generator/steam_sdk/isteamremoteplay.h
Normal file
@ -0,0 +1,88 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ============
|
||||
|
||||
#ifndef ISTEAMREMOTEPLAY_H
|
||||
#define ISTEAMREMOTEPLAY_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "steam_api_common.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: The form factor of a device
|
||||
//-----------------------------------------------------------------------------
|
||||
enum ESteamDeviceFormFactor
|
||||
{
|
||||
k_ESteamDeviceFormFactorUnknown = 0,
|
||||
k_ESteamDeviceFormFactorPhone = 1,
|
||||
k_ESteamDeviceFormFactorTablet = 2,
|
||||
k_ESteamDeviceFormFactorComputer = 3,
|
||||
k_ESteamDeviceFormFactorTV = 4,
|
||||
};
|
||||
|
||||
// Steam Remote Play session ID
|
||||
typedef uint32 RemotePlaySessionID_t;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Functions to provide information about Steam Remote Play sessions
|
||||
//-----------------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
// Get the SteamID of the connected user
|
||||
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;
|
||||
|
||||
// Get the form factor of the session client device
|
||||
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;
|
||||
|
||||
// Invite a friend to Remote Play Together
|
||||
// This returns false if the invite can't be sent
|
||||
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 );
|
||||
|
||||
// callbacks
|
||||
#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( SteamRemotePlaySessionDisconnected_t, k_iSteamRemotePlayCallbacks + 2 )
|
||||
STEAM_CALLBACK_MEMBER( 0, RemotePlaySessionID_t, m_unSessionID )
|
||||
STEAM_CALLBACK_END( 0 )
|
||||
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
#endif // #define ISTEAMREMOTEPLAY_H
|
@ -65,8 +65,10 @@ enum ERemoteStoragePlatform
|
||||
k_ERemoteStoragePlatformOSX = (1 << 1),
|
||||
k_ERemoteStoragePlatformPS3 = (1 << 2),
|
||||
k_ERemoteStoragePlatformLinux = (1 << 3),
|
||||
k_ERemoteStoragePlatformReserved2 = (1 << 4),
|
||||
k_ERemoteStoragePlatformSwitch = (1 << 4),
|
||||
k_ERemoteStoragePlatformAndroid = (1 << 5),
|
||||
k_ERemoteStoragePlatformIOS = (1 << 6),
|
||||
// NB we get one more before we need to widen some things
|
||||
|
||||
k_ERemoteStoragePlatformAll = 0xffffffff
|
||||
};
|
||||
@ -76,6 +78,7 @@ enum ERemoteStoragePublishedFileVisibility
|
||||
k_ERemoteStoragePublishedFileVisibilityPublic = 0,
|
||||
k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1,
|
||||
k_ERemoteStoragePublishedFileVisibilityPrivate = 2,
|
||||
k_ERemoteStoragePublishedFileVisibilityUnlisted = 3,
|
||||
};
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ enum EUGCMatchingUGCType
|
||||
k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides
|
||||
k_EUGCMatchingUGCType_ControllerBindings = 11,
|
||||
k_EUGCMatchingUGCType_GameManagedItems = 12, // game managed items (not managed by users)
|
||||
k_EUGCMatchingUGCType_All = ~0, // return everything
|
||||
k_EUGCMatchingUGCType_All = ~0, // @note: will only be valid for CreateQueryUserUGCRequest requests
|
||||
};
|
||||
|
||||
// Different lists of published UGC for a user.
|
||||
@ -204,9 +204,11 @@ public:
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
|
||||
@ -225,13 +227,19 @@ public:
|
||||
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;
|
||||
|
||||
// Release the request to free up memory, after retrieving results
|
||||
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;
|
||||
@ -254,6 +262,7 @@ public:
|
||||
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 Workshop Creator API
|
||||
@ -271,6 +280,7 @@ public:
|
||||
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
|
||||
@ -350,7 +360,7 @@ public:
|
||||
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION012"
|
||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION014"
|
||||
|
||||
// Global interface accessor
|
||||
inline ISteamUGC *SteamUGC();
|
||||
|
@ -12,25 +12,6 @@
|
||||
|
||||
#include "steam_api_common.h"
|
||||
|
||||
// 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 )
|
||||
#else
|
||||
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
|
||||
#endif
|
||||
struct CallbackMsg_t
|
||||
{
|
||||
HSteamUser m_hSteamUser;
|
||||
int m_iCallback;
|
||||
uint8 *m_pubParam;
|
||||
int m_cubParam;
|
||||
};
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Functions for accessing and manipulating a steam account
|
||||
// associated with one client instance
|
||||
@ -168,7 +149,12 @@ public:
|
||||
STEAM_CALL_RESULT( EncryptedAppTicketResponse_t )
|
||||
virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0;
|
||||
|
||||
// retrieve a finished ticket
|
||||
// Retrieves a finished ticket.
|
||||
// If no ticket is available, or your buffer is too small, returns false.
|
||||
// Upon exit, *pcbTicket will be either the size of the ticket copied into your buffer
|
||||
// (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;
|
||||
|
||||
// Trading Card badges data access
|
||||
@ -206,6 +192,11 @@ public:
|
||||
|
||||
STEAM_CALL_RESULT( MarketEligibilityResponse_t )
|
||||
virtual SteamAPICall_t GetMarketEligibility() = 0;
|
||||
|
||||
// Retrieves anti indulgence / duration control for current user
|
||||
STEAM_CALL_RESULT( DurationControl_t )
|
||||
virtual SteamAPICall_t GetDurationControl() = 0;
|
||||
|
||||
};
|
||||
|
||||
#define STEAMUSER_INTERFACE_VERSION "SteamUser020"
|
||||
@ -383,6 +374,31 @@ struct MarketEligibilityResponse_t
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sent for games with enabled anti indulgence / duration control, for
|
||||
// enabled users. Lets the game know whether the user can keep playing or
|
||||
// whether the game should exit, and returns info about remaining gameplay time.
|
||||
//
|
||||
// This callback is fired asynchronously in response to timers triggering.
|
||||
// It is also fired in response to calls to GetDurationControl().
|
||||
//-----------------------------------------------------------------------------
|
||||
struct DurationControl_t
|
||||
{
|
||||
enum { k_iCallback = k_iSteamUserCallbacks + 67 };
|
||||
|
||||
EResult m_eResult; // result of call (always k_EResultOK for asynchronous timer-based notifications)
|
||||
AppId_t m_appid; // appid generating playtime
|
||||
|
||||
bool m_bApplicable; // is duration control applicable to user + game combination
|
||||
int32 m_csecsLast5h; // playtime since most recent 5 hour gap in playtime, only counting up to regulatory limit of playtime, in seconds
|
||||
|
||||
EDurationControlProgress m_progress; // recommended progress (either everything is fine, or please exit game)
|
||||
EDurationControlNotification m_notification; // notification to show, if any (always k_EDurationControlNotification_None for API calls)
|
||||
|
||||
int32 m_csecsToday; // playtime on current calendar day
|
||||
int32 m_csecsRemaining; // playtime remaining until the user hits a regulatory limit
|
||||
};
|
||||
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
@ -93,12 +93,19 @@ public:
|
||||
virtual bool RequestCurrentStats() = 0;
|
||||
|
||||
// Data accessors
|
||||
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;
|
||||
|
||||
// Set / update data
|
||||
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;
|
||||
|
||||
virtual bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength ) = 0;
|
||||
|
||||
// Achievement flag accessors
|
||||
@ -153,8 +160,12 @@ public:
|
||||
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( GetUserStatFloat )
|
||||
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 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;
|
||||
@ -265,14 +276,21 @@ public:
|
||||
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( 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( GetGlobalStatHistoryDouble )
|
||||
virtual int32 GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) double *pData, uint32 cubData ) = 0;
|
||||
|
||||
#ifdef _PS3
|
||||
|
@ -41,7 +41,6 @@ enum EGamepadTextInputLineMode
|
||||
k_EGamepadTextInputLineModeMultipleLines = 1
|
||||
};
|
||||
|
||||
|
||||
// function prototype for warning message hook
|
||||
#if defined( POSIX )
|
||||
#define __cdecl
|
||||
@ -160,26 +159,45 @@ public:
|
||||
// ask SteamUI to create and render its OpenVR dashboard
|
||||
virtual void StartVRDashboard() = 0;
|
||||
|
||||
// Returns true if the HMD content will be streamed via Steam In-Home Streaming
|
||||
// Returns true if the HMD content will be streamed via Steam Remote Play
|
||||
virtual bool IsVRHeadsetStreamingEnabled() = 0;
|
||||
|
||||
// Set whether the HMD content will be streamed via Steam In-Home Streaming
|
||||
// Set whether the HMD content will be streamed via Steam Remote Play
|
||||
// If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed.
|
||||
// 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;
|
||||
|
||||
// Returns whether this steam client is a Steam China specific client, vs the global client.
|
||||
virtual bool IsSteamChinaLauncher() = 0;
|
||||
|
||||
// Initializes text filtering.
|
||||
// Returns false if filtering is unavailable for the language the user is currently running in.
|
||||
virtual bool InitFilterText() = 0;
|
||||
|
||||
// Filters the provided input message and places the filtered result into pchOutFilteredText.
|
||||
// pchOutFilteredText is where the output will be placed, even if no filtering or censoring is performed
|
||||
// nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText
|
||||
// pchInputText is the input string that should be filtered, which can be ASCII or UTF-8
|
||||
// bLegalOnly should be false if you want profanity and legally required filtering (where required) and true if you want legally required filtering only
|
||||
// Returns the number of characters (not bytes) filtered.
|
||||
virtual int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly ) = 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;
|
||||
};
|
||||
|
||||
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils009"
|
||||
|
||||
// Global interface accessor
|
||||
inline ISteamUtils *SteamUtils();
|
||||
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamUtils, SteamInternal_FindOrCreateUserInterface( 0, STEAMUTILS_INTERFACE_VERSION ) );
|
||||
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 ) );
|
||||
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamGameServerUtils, SteamInternal_FindOrCreateGameServerInterface( 0, STEAMUTILS_INTERFACE_VERSION ), "gameserver", STEAMUTILS_INTERFACE_VERSION );
|
||||
|
||||
// callbacks
|
||||
#if defined( VALVE_CALLBACK_PACK_SMALL )
|
||||
|
@ -49,13 +49,6 @@ public:
|
||||
inline ISteamVideo *SteamVideo();
|
||||
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamVideo *, SteamVideo, STEAMVIDEO_INTERFACE_VERSION );
|
||||
|
||||
STEAM_CALLBACK_BEGIN( BroadcastUploadStart_t, k_iClientVideoCallbacks + 4 )
|
||||
STEAM_CALLBACK_END(0)
|
||||
|
||||
STEAM_CALLBACK_BEGIN( BroadcastUploadStop_t, k_iClientVideoCallbacks + 5 )
|
||||
STEAM_CALLBACK_MEMBER( 0, EBroadcastUploadResult, m_eResult )
|
||||
STEAM_CALLBACK_END(1)
|
||||
|
||||
STEAM_CALLBACK_BEGIN( GetVideoURLResult_t, k_iClientVideoCallbacks + 11 )
|
||||
STEAM_CALLBACK_MEMBER( 0, EResult, m_eResult )
|
||||
STEAM_CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
|
||||
// Access the IP
|
||||
uint32 GetIP() const;
|
||||
void SetIP( uint32 );
|
||||
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;
|
||||
|
@ -42,6 +42,9 @@
|
||||
#include "isteamvideo.h"
|
||||
#include "isteamparentalsettings.h"
|
||||
#include "isteaminput.h"
|
||||
#include "isteamremoteplay.h"
|
||||
#include "isteamnetworkingsockets.h"
|
||||
#include "isteamnetworkingutils.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
@ -91,28 +94,14 @@ S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg );
|
||||
// SteamAPI_IsSteamRunning() returns true if Steam is currently running
|
||||
S_API bool S_CALLTYPE SteamAPI_IsSteamRunning();
|
||||
|
||||
// Pumps out all the steam messages, calling registered callbacks.
|
||||
// NOT THREADSAFE - do not call from multiple threads simultaneously.
|
||||
S_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks );
|
||||
|
||||
// register the callback funcs to use to interact with the steam dll
|
||||
S_API void Steam_RegisterInterfaceFuncs( void *hModule );
|
||||
|
||||
// returns the HSteamUser of the last user to dispatch a callback
|
||||
S_API HSteamUser Steam_GetHSteamUserCurrent();
|
||||
|
||||
// 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();
|
||||
|
||||
// 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 );
|
||||
|
||||
// backwards compat export, passes through to SteamAPI_ variants
|
||||
S_API HSteamPipe GetHSteamPipe();
|
||||
S_API HSteamUser GetHSteamUser();
|
||||
|
||||
|
||||
#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();
|
||||
@ -129,16 +118,78 @@ S_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion,
|
||||
S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID );
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
//
|
||||
// Manual callback loop
|
||||
//
|
||||
// An alternative method for dispatching callbacks. Similar to a windows message loop.
|
||||
//
|
||||
// If you use the manual callback dispatch, you must NOT use:
|
||||
//
|
||||
// - SteamAPI_RunCallbacks or SteamGameServer_RunCallbacks
|
||||
// - STEAM_CALLBACK, CCallResult, CCallback, or CCallbackManual
|
||||
//
|
||||
// Here is the basic template for replacing SteamAPI_RunCallbacks() with manual dispatch
|
||||
/*
|
||||
|
||||
HSteamPipe hSteamPipe = SteamAPI_GetHSteamPipe(); // See also SteamGameServer_GetHSteamPipe()
|
||||
SteamAPI_ManualDispatch_RunFrame( hSteamPipe )
|
||||
CallbackMsg_t callback;
|
||||
while ( SteamAPI_ManualDispatch_GetNextCallback( hSteamPipe, &callback ) )
|
||||
{
|
||||
// Check for dispatching API call results
|
||||
if ( callback.m_iCallback == SteamAPICallCompleted_t::k_iCallback )
|
||||
{
|
||||
SteamAPICallCompleted_t *pCallCompleted = (SteamAPICallCompleted_t *)callback.
|
||||
void *pTmpCallResult = malloc( pCallback->m_cubParam );
|
||||
bool bFailed;
|
||||
if ( SteamAPI_ManualDispatch_GetAPICallResult( hSteamPipe, pCallCompleted->m_hAsyncCall, pTmpCallResult, pCallback->m_cubParam, pCallback->m_iCallback, &bFailed ) )
|
||||
{
|
||||
// Dispatch the call result to the registered handler(s) for the
|
||||
// call identified by pCallCompleted->m_hAsyncCall
|
||||
}
|
||||
free( pTmpCallResult );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Look at callback.m_iCallback to see what kind of callback it is,
|
||||
// and dispatch to appropriate handler(s)
|
||||
}
|
||||
SteamAPI_ManualDispatch_FreeLastCallback( hSteamPipe );
|
||||
}
|
||||
|
||||
*/
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
|
||||
/// Inform the API that you wish to use manual event dispatch. This must be called after SteamAPI_Init, but before
|
||||
/// you use any of the other manual dispatch functions below.
|
||||
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 );
|
||||
|
||||
/// 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 );
|
||||
|
||||
/// You must call this after dispatching the callback, if SteamAPI_ManualDispatch_GetNextCallback returns true.
|
||||
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 );
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
//
|
||||
// CSteamAPIContext
|
||||
// CSteamAPIContext
|
||||
//
|
||||
// Deprecated! This is not necessary any more. Please use the global accessors directly
|
||||
//
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
|
||||
#ifndef STEAM_API_EXPORTS
|
||||
|
||||
// Deprecated! Use the global accessors directly
|
||||
inline bool CSteamAPIContext::Init()
|
||||
{
|
||||
m_pSteamClient = ::SteamClient();
|
||||
@ -165,9 +216,11 @@ inline bool CSteamAPIContext::Init()
|
||||
if ( !m_pSteamGameSearch )
|
||||
return false;
|
||||
|
||||
#if !defined( IOSALL) // Not yet supported on iOS.
|
||||
m_pSteamMatchmakingServers = ::SteamMatchmakingServers();
|
||||
if ( !m_pSteamMatchmakingServers )
|
||||
return false;
|
||||
#endif
|
||||
|
||||
m_pSteamUserStats = ::SteamUserStats();
|
||||
if ( !m_pSteamUserStats )
|
||||
@ -213,10 +266,10 @@ inline bool CSteamAPIContext::Init()
|
||||
if ( !m_pSteamMusicRemote )
|
||||
return false;
|
||||
|
||||
#ifndef ANDROID // Not yet supported on Android
|
||||
#if !defined( ANDROID ) && !defined( IOSALL) // Not yet supported on Android or ios.
|
||||
m_pSteamHTMLSurface = ::SteamHTMLSurface();
|
||||
if ( !m_pSteamHTMLSurface )
|
||||
return false;
|
||||
return false;
|
||||
#endif
|
||||
|
||||
m_pSteamInventory = ::SteamInventory();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -81,6 +81,9 @@ extern "C" typedef uint32 ( *SteamAPI_CheckCallbackRegistered_t )( int iCallback
|
||||
//
|
||||
// Callbacks and call-results are queued automatically and are only
|
||||
// delivered/executed when your application calls SteamAPI_RunCallbacks().
|
||||
//
|
||||
// Note that there is an alternative, lower level callback dispatch mechanism.
|
||||
// See SteamAPI_ManualDispatch_Init
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
|
||||
// Dispatch all queued Steamworks callbacks.
|
||||
@ -150,6 +153,7 @@ public:
|
||||
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 int GetCallbackSizeBytes() { return sizeof_P; }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,13 +13,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// Internal functions used by the utility CCallback objects to receive callbacks
|
||||
S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback );
|
||||
S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback );
|
||||
// Internal functions used by the utility CCallResult objects to receive async call results
|
||||
S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
|
||||
S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
|
||||
|
||||
// Internal functions used to locate/create interfaces
|
||||
S_API HSteamPipe S_CALLTYPE SteamAPI_GetHSteamPipe();
|
||||
S_API HSteamUser S_CALLTYPE SteamAPI_GetHSteamUser();
|
||||
S_API HSteamPipe S_CALLTYPE SteamGameServer_GetHSteamPipe();
|
||||
@ -29,6 +23,37 @@ 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
|
||||
// through a safety function that checks for interfaces being created or destroyed.
|
||||
//
|
||||
// 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_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 );
|
||||
// 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 );
|
||||
|
||||
// disable this warning; this pattern need for steam callback registration
|
||||
#ifdef _MSVC_VER
|
||||
#pragma warning( push )
|
||||
@ -53,6 +78,8 @@ S_API void *S_CALLTYPE SteamInternal_FindOrCreateGameServerInterface( HSteamUser
|
||||
#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 >
|
||||
inline CCallResult<T, P>::CCallResult()
|
||||
{
|
||||
@ -154,10 +181,29 @@ inline void CCallback< T, P, bGameserver >::Run( void *pvParam )
|
||||
(m_pObj->*m_Func)((P *)pvParam);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Macros to define steam callback structures. Used internally for debugging
|
||||
//-----------------------------------------------------------------------------
|
||||
#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 )
|
||||
#else
|
||||
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
|
||||
#endif
|
||||
|
||||
/// Internal structure used in manual callback dispatch
|
||||
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
|
||||
int m_cubParam; // Size of the data pointed to by m_pubParam
|
||||
};
|
||||
#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"
|
||||
#else
|
||||
@ -196,6 +242,8 @@ class ISteamParentalSettings;
|
||||
class ISteamGameSearch;
|
||||
class ISteamInput;
|
||||
class ISteamParties;
|
||||
class ISteamTV;
|
||||
class ISteamRemotePlay;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Base values for callback identifiers, each callback must
|
||||
@ -215,6 +263,7 @@ enum { k_iSteamUserStatsCallbacks = 1100 };
|
||||
enum { k_iSteamNetworkingCallbacks = 1200 };
|
||||
enum { k_iSteamNetworkingSocketsCallbacks = 1220 };
|
||||
enum { k_iSteamNetworkingMessagesCallbacks = 1250 };
|
||||
enum { k_iSteamNetworkingUtilsCallbacks = 1280 };
|
||||
enum { k_iClientRemoteStorageCallbacks = 1300 };
|
||||
enum { k_iClientDepotBuilderCallbacks = 1400 };
|
||||
enum { k_iSteamGameServerItemsCallbacks = 1500 };
|
||||
@ -257,36 +306,10 @@ enum { k_iClientShaderCallbacks = 5100 };
|
||||
enum { k_iSteamGameSearchCallbacks = 5200 };
|
||||
enum { k_iSteamPartiesCallbacks = 5300 };
|
||||
enum { k_iClientPartiesCallbacks = 5400 };
|
||||
|
||||
// Macro used to define a type-safe accessor that will always return the version
|
||||
// of the interface of the *header file* you are compiling with! We also bounce
|
||||
// through a safety function that checks for interfaces being created or destroyed.
|
||||
#ifndef STEAM_API_EXPORTS
|
||||
// SteamInternal_ContextInit takes a base pointer for the equivalent of
|
||||
// struct { void (*pFn)(void* pCtx); uintp counter; CSteamAPIContext ctx; }
|
||||
// Do not change layout of 2 + sizeof... or add non-pointer aligned data!
|
||||
// NOTE: declaring "static CSteamAPIConext" creates a large function
|
||||
// which queries the initialization status of the object. We know that
|
||||
// it is pointer-aligned and fully memset with zeros, so just alias a
|
||||
// static buffer of the appropriate size and call it a CSteamAPIContext.
|
||||
#define STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, expr ) \
|
||||
inline void S_CALLTYPE SteamInternal_Init_ ## name( type *p ) { *p = (type)( expr ); } \
|
||||
inline type name() { \
|
||||
static void* s_CallbackCounterAndContext[ 3 ] = { (void*)&SteamInternal_Init_ ## name, 0, 0 }; \
|
||||
return *(type*)SteamInternal_ContextInit( s_CallbackCounterAndContext ); \
|
||||
}
|
||||
|
||||
#else
|
||||
// Stub when we're compiling steam_api.dll itself. These are inline
|
||||
// functions defined when the header is included. not functions exported
|
||||
// by the lib!
|
||||
#define STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, expr )
|
||||
#endif
|
||||
|
||||
#define STEAM_DEFINE_USER_INTERFACE_ACCESSOR( type, name, version ) \
|
||||
STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, SteamInternal_FindOrCreateUserInterface( SteamAPI_GetHSteamUser(), version ) )
|
||||
#define STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( type, name, version ) \
|
||||
STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, SteamInternal_FindOrCreateGameServerInterface( SteamGameServer_GetHSteamUser(), version ) )
|
||||
enum { k_iSteamSTARCallbacks = 5500 };
|
||||
enum { k_iClientSTARCallbacks = 5600 };
|
||||
enum { k_iSteamRemotePlayCallbacks = 5700 };
|
||||
enum { k_iClientCompatCallbacks = 5800 };
|
||||
|
||||
#ifdef _MSVC_VER
|
||||
#pragma warning( pop )
|
||||
@ -325,6 +348,7 @@ public:
|
||||
ISteamHTMLSurface* SteamHTMLSurface() const { return m_pSteamHTMLSurface; }
|
||||
ISteamInventory* SteamInventory() const { return m_pSteamInventory; }
|
||||
ISteamVideo* SteamVideo() const { return m_pSteamVideo; }
|
||||
ISteamTV* SteamTV() const { return m_pSteamTV; }
|
||||
ISteamParentalSettings* SteamParentalSettings() const { return m_pSteamParentalSettings; }
|
||||
ISteamInput* SteamInput() const { return m_pSteamInput; }
|
||||
private:
|
||||
@ -349,6 +373,7 @@ private:
|
||||
ISteamHTMLSurface *m_pSteamHTMLSurface;
|
||||
ISteamInventory *m_pSteamInventory;
|
||||
ISteamVideo *m_pSteamVideo;
|
||||
ISteamTV *m_pSteamTV;
|
||||
ISteamParentalSettings *m_pSteamParentalSettings;
|
||||
ISteamInput *m_pSteamInput;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@
|
||||
// General result codes
|
||||
enum EResult
|
||||
{
|
||||
k_EResultNone = 0, // no result
|
||||
k_EResultOK = 1, // success
|
||||
k_EResultFail = 2, // generic failure
|
||||
k_EResultNoConnection = 3, // no/failed network connection
|
||||
@ -138,6 +139,8 @@ enum EResult
|
||||
k_EResultAccountNotFriends = 111, // the user is not mutually friends
|
||||
k_EResultLimitedUserAccount = 112, // the user is limited
|
||||
k_EResultCantRemoveItem = 113, // item can't be removed
|
||||
k_EResultAccountDeleted = 114, // account has been deleted
|
||||
k_EResultExistingUserCancelledLicense = 115, // A license for this already exists, but cancelled
|
||||
};
|
||||
|
||||
// Error codes for use with the voice functions
|
||||
@ -275,6 +278,8 @@ enum EAppOwnershipFlags
|
||||
k_EAppOwnershipFlags_RentalNotActivated = 0x10000, // Rental hasn't been activated yet
|
||||
k_EAppOwnershipFlags_Rental = 0x20000, // Is a rental
|
||||
k_EAppOwnershipFlags_SiteLicense = 0x40000, // Is from a site license
|
||||
k_EAppOwnershipFlags_LegacyFreeSub = 0x80000, // App only owned through Steam's legacy free sub
|
||||
k_EAppOwnershipFlags_InvalidOSType = 0x100000, // app not supported on current OS version, used to indicate a game is 32-bit on post-catalina. Currently it's own flag so the library will display a notice.
|
||||
};
|
||||
|
||||
|
||||
@ -298,9 +303,10 @@ enum EAppType
|
||||
k_EAppType_Franchise = 0x400, // A hub for collections of multiple apps, eg films, series, games
|
||||
k_EAppType_Video = 0x800, // A video component of either a Film or TVSeries (may be the feature, an episode, preview, making-of, etc)
|
||||
k_EAppType_Plugin = 0x1000, // Plug-in types for other Apps
|
||||
k_EAppType_Music = 0x2000, // Music files
|
||||
k_EAppType_MusicAlbum = 0x2000, // "Video game soundtrack album"
|
||||
k_EAppType_Series = 0x4000, // Container app for video series
|
||||
k_EAppType_Comic = 0x8000, // Comic Book
|
||||
k_EAppType_Comic_UNUSED = 0x8000, // Comic Book
|
||||
k_EAppType_Beta = 0x10000, // this is a beta version of a game
|
||||
|
||||
k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only
|
||||
k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace
|
||||
@ -379,10 +385,7 @@ typedef bool (*PFNLegacyKeyInstalled)();
|
||||
|
||||
const unsigned int k_unSteamAccountIDMask = 0xFFFFFFFF;
|
||||
const unsigned int k_unSteamAccountInstanceMask = 0x000FFFFF;
|
||||
// we allow 3 simultaneous user account instances right now, 1= desktop, 2 = console, 4 = web, 0 = all
|
||||
const unsigned int k_unSteamUserDesktopInstance = 1;
|
||||
const unsigned int k_unSteamUserConsoleInstance = 2;
|
||||
const unsigned int k_unSteamUserWebInstance = 4;
|
||||
const unsigned int k_unSteamUserDefaultInstance = 1; // fixed instance for all individual users
|
||||
|
||||
// Special flags for Chat accounts - they go in the top 8 bits
|
||||
// of the steam ID's "instance", leaving 12 for the actual instances
|
||||
@ -412,8 +415,8 @@ enum EMarketingMessageFlags
|
||||
//aggregate flags
|
||||
k_EMarketingMessageFlagsPlatformRestrictions =
|
||||
k_EMarketingMessageFlagsPlatformWindows |
|
||||
k_EMarketingMessageFlagsPlatformMac |
|
||||
k_EMarketingMessageFlagsPlatformLinux,
|
||||
k_EMarketingMessageFlagsPlatformMac |
|
||||
k_EMarketingMessageFlagsPlatformLinux,
|
||||
};
|
||||
|
||||
|
||||
@ -515,12 +518,15 @@ enum EVRHMDType
|
||||
k_eEVRHMDType_HTC_VivePre = 2, // htc vive pre
|
||||
k_eEVRHMDType_HTC_Vive = 3, // htc vive consumer release
|
||||
k_eEVRHMDType_HTC_VivePro = 4, // htc vive pro release
|
||||
k_eEVRHMDType_HTC_ViveCosmos = 5, // HTC Vive Cosmos
|
||||
|
||||
k_eEVRHMDType_HTC_Unknown = 20, // unknown htc hmd
|
||||
|
||||
k_eEVRHMDType_Oculus_DK1 = 21, // Oculus DK1
|
||||
k_eEVRHMDType_Oculus_DK2 = 22, // Oculus DK2
|
||||
k_eEVRHMDType_Oculus_Rift = 23, // Oculus rift
|
||||
k_eEVRHMDType_Oculus_Rift = 23, // Oculus Rift
|
||||
k_eEVRHMDType_Oculus_RiftS = 24, // Oculus Rift S
|
||||
k_eEVRHMDType_Oculus_Quest = 25, // Oculus Quest
|
||||
|
||||
k_eEVRHMDType_Oculus_Unknown = 40, // // Oculus unknown HMD
|
||||
|
||||
@ -535,6 +541,7 @@ enum EVRHMDType
|
||||
|
||||
k_eEVRHMDType_HP_Unknown = 80, // HP unknown HMD
|
||||
k_eEVRHMDType_HP_WindowsMR = 81, // HP Windows MR headset
|
||||
k_eEVRHMDType_HP_Reverb = 82, // HP Reverb Windows MR headset
|
||||
|
||||
k_eEVRHMDType_Samsung_Unknown = 90, // Samsung unknown HMD
|
||||
k_eEVRHMDType_Samsung_Odyssey = 91, // Samsung Odyssey Windows MR headset
|
||||
@ -548,6 +555,9 @@ enum EVRHMDType
|
||||
k_eEVRHMDType_Huawei_VR2 = 121, // Huawei VR2 3DOF headset
|
||||
k_eEVRHMDType_Huawei_EndOfRange = 129, // end of Huawei HMD range
|
||||
|
||||
k_eEVRHmdType_Valve_Unknown = 130, // Valve Unknown HMD
|
||||
k_eEVRHmdType_Valve_Index = 131, // Valve Index HMD
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -556,7 +566,7 @@ enum EVRHMDType
|
||||
//-----------------------------------------------------------------------------
|
||||
static inline bool BIsOculusHMD( EVRHMDType eType )
|
||||
{
|
||||
return eType == k_eEVRHMDType_Oculus_DK1 || eType == k_eEVRHMDType_Oculus_DK2 || eType == k_eEVRHMDType_Oculus_Rift || eType == k_eEVRHMDType_Oculus_Unknown;
|
||||
return eType == k_eEVRHMDType_Oculus_DK1 || eType == k_eEVRHMDType_Oculus_DK2 || eType == k_eEVRHMDType_Oculus_Rift || eType == k_eEVRHMDType_Oculus_RiftS || eType == k_eEVRHMDType_Oculus_Quest || eType == k_eEVRHMDType_Oculus_Unknown;
|
||||
}
|
||||
|
||||
|
||||
@ -647,6 +657,42 @@ enum EMarketNotAllowedReasonFlags
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// describes XP / progress restrictions to apply for games with duration control /
|
||||
// anti-indulgence enabled for minor Steam China users.
|
||||
//
|
||||
// WARNING: DO NOT RENUMBER
|
||||
enum EDurationControlProgress
|
||||
{
|
||||
k_EDurationControlProgress_Full = 0, // Full progress
|
||||
k_EDurationControlProgress_Half = 1, // deprecated - XP or persistent rewards should be halved
|
||||
k_EDurationControlProgress_None = 2, // deprecated - XP or persistent rewards should be stopped
|
||||
|
||||
k_EDurationControl_ExitSoon_3h = 3, // allowed 3h time since 5h gap/break has elapsed, game should exit - steam will terminate the game soon
|
||||
k_EDurationControl_ExitSoon_5h = 4, // allowed 5h time in calendar day has elapsed, game should exit - steam will terminate the game soon
|
||||
k_EDurationControl_ExitSoon_Night = 5, // game running after day period, game should exit - steam will terminate the game soon
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// describes which notification timer has expired, for steam china duration control feature
|
||||
//
|
||||
// WARNING: DO NOT RENUMBER
|
||||
enum EDurationControlNotification
|
||||
{
|
||||
k_EDurationControlNotification_None = 0, // just informing you about progress, no notification to show
|
||||
k_EDurationControlNotification_1Hour = 1, // "you've been playing for N hours"
|
||||
|
||||
k_EDurationControlNotification_3Hours = 2, // deprecated - "you've been playing for 3 hours; take a break"
|
||||
k_EDurationControlNotification_HalfProgress = 3,// deprecated - "your XP / progress is half normal"
|
||||
k_EDurationControlNotification_NoProgress = 4, // deprecated - "your XP / progress is zero"
|
||||
|
||||
k_EDurationControlNotification_ExitSoon_3h = 5, // allowed 3h time since 5h gap/break has elapsed, game should exit - steam will terminate the game soon
|
||||
k_EDurationControlNotification_ExitSoon_5h = 6, // allowed 5h time in calendar day has elapsed, game should exit - steam will terminate the game soon
|
||||
k_EDurationControlNotification_ExitSoon_Night = 7,// game running after day period, game should exit - steam will terminate the game soon
|
||||
};
|
||||
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
|
||||
#define CSTEAMID_DEFINED
|
||||
@ -690,7 +736,7 @@ public:
|
||||
CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType )
|
||||
{
|
||||
#if defined(_SERVER) && defined(Assert)
|
||||
Assert( ! ( ( k_EAccountTypeIndividual == eAccountType ) && ( unAccountInstance > k_unSteamUserWebInstance ) ) ); // enforce that for individual accounts, instance is always 1
|
||||
Assert( ( k_EAccountTypeIndividual != eAccountType ) || ( unAccountInstance == k_unSteamUserDefaultInstance ) ); // enforce that for individual accounts, instance is always 1
|
||||
#endif // _SERVER
|
||||
InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType );
|
||||
}
|
||||
@ -732,8 +778,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
// by default we pick the desktop instance
|
||||
m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance;
|
||||
m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDefaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@ -800,7 +845,7 @@ public:
|
||||
pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits;
|
||||
m_steamid.m_comp.m_EUniverse = eUniverse; // set the universe
|
||||
m_steamid.m_comp.m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual
|
||||
m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance; // Steam2 only knew desktop instances
|
||||
m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDefaultInstance; // Steam2 only knew one instance
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -969,8 +1014,7 @@ public:
|
||||
// simple accessors
|
||||
void SetAccountID( uint32 unAccountID ) { m_steamid.m_comp.m_unAccountID = unAccountID; }
|
||||
void SetAccountInstance( uint32 unInstance ){ m_steamid.m_comp.m_unAccountInstance = unInstance; }
|
||||
void ClearIndividualInstance() { if ( BIndividualAccount() ) m_steamid.m_comp.m_unAccountInstance = 0; }
|
||||
bool HasNoIndividualInstance() const { return BIndividualAccount() && (m_steamid.m_comp.m_unAccountInstance==0); }
|
||||
|
||||
AccountID_t GetAccountID() const { return m_steamid.m_comp.m_unAccountID; }
|
||||
uint32 GetUnAccountInstance() const { return m_steamid.m_comp.m_unAccountInstance; }
|
||||
EAccountType GetEAccountType() const { return ( EAccountType ) m_steamid.m_comp.m_EAccountType; }
|
||||
@ -1040,7 +1084,7 @@ inline bool CSteamID::IsValid() const
|
||||
|
||||
if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual )
|
||||
{
|
||||
if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance > k_unSteamUserWebInstance )
|
||||
if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance != k_unSteamUserDefaultInstance )
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1135,6 +1179,17 @@ public:
|
||||
m_gameID.m_nType = k_EGameIDTypeGameMod;
|
||||
}
|
||||
|
||||
CGameID( const CGameID &that )
|
||||
{
|
||||
m_ulGameID = that.m_ulGameID;
|
||||
}
|
||||
|
||||
CGameID& operator=( const CGameID & that )
|
||||
{
|
||||
m_ulGameID = that.m_ulGameID;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Hidden functions used only by Steam
|
||||
explicit CGameID( const char *pchGameID );
|
||||
const char *Render() const; // render this Game ID to string
|
||||
@ -1373,6 +1428,23 @@ enum EPlayerResult_t
|
||||
k_EPlayerResultCompleted = 5, // player completed game
|
||||
};
|
||||
|
||||
|
||||
enum ESteamIPv6ConnectivityProtocol
|
||||
{
|
||||
k_ESteamIPv6ConnectivityProtocol_Invalid = 0,
|
||||
k_ESteamIPv6ConnectivityProtocol_HTTP = 1, // because a proxy may make this different than other protocols
|
||||
k_ESteamIPv6ConnectivityProtocol_UDP = 2, // test UDP connectivity. Uses a port that is commonly needed for other Steam stuff. If UDP works, TCP probably works.
|
||||
};
|
||||
|
||||
// For the above transport protocol, what do we think the local machine's connectivity to the internet over ipv6 is like
|
||||
enum ESteamIPv6ConnectivityState
|
||||
{
|
||||
k_ESteamIPv6ConnectivityState_Unknown = 0, // We haven't run a test yet
|
||||
k_ESteamIPv6ConnectivityState_Good = 1, // We have recently been able to make a request on ipv6 for the given protocol
|
||||
k_ESteamIPv6ConnectivityState_Bad = 2, // We failed to make a request, either because this machine has no ipv6 address assigned, or it has no upstream connectivity
|
||||
};
|
||||
|
||||
|
||||
// Define compile time assert macros to let us validate the structure sizes.
|
||||
#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1];
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
//====== Copyright Valve Corporation, All rights reserved. ====================
|
||||
//
|
||||
// Backend functions to generate authorization tickets for steam datagram
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef STEAMDATAGRAM_TICKETGEN_H
|
||||
#define STEAMDATAGRAM_TICKETGEN_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// Import some common stuff that is useful by both the client
|
||||
// and the backend ticket-generating authority.
|
||||
#include "steamdatagram_tickets.h"
|
||||
|
||||
#if defined( STEAMDATAGRAM_TICKETGEN_FOREXPORT )
|
||||
#define STEAMDATAGRAM_TICKET_INTERFACE DLL_EXPORT
|
||||
#elif defined( STEAMNETWORKINGSOCKETS_STATIC_LINK )
|
||||
#define STEAMDATAGRAM_TICKET_INTERFACE extern "C"
|
||||
#else
|
||||
#define STEAMDATAGRAM_TICKET_INTERFACE DLL_IMPORT
|
||||
#endif
|
||||
|
||||
struct SteamDatagramSignedTicketBlob
|
||||
{
|
||||
int m_sz;
|
||||
uint8 m_blob[ k_cbSteamDatagramMaxSerializedTicket ];
|
||||
};
|
||||
|
||||
/// Initialize ticket generation with an Ed25519 private key.
|
||||
/// See: https://ed25519.cr.yp.to/
|
||||
///
|
||||
/// Input buffer will be securely wiped.
|
||||
///
|
||||
/// You can generate an Ed25519 key using OpenSSH: ssh-keygen -t ed25519
|
||||
/// Or with our cert tool: steamnetworkingsockets_certtool gen_keypair
|
||||
///
|
||||
/// The private key should be a PEM-like block of text
|
||||
/// ("-----BEGIN OPENSSH PRIVATE KEY-----").
|
||||
/// Private keys encrypted with a password are not supported.
|
||||
///
|
||||
/// In order for signatures using this key to be accepted by the relay network,
|
||||
/// you need to send your public key to Valve. This key should be on a single line
|
||||
/// of text that begins with "ssh-ed25519". (The format used in the .ssh/authorized_keys
|
||||
/// file.)
|
||||
STEAMDATAGRAM_TICKET_INTERFACE bool SteamDatagram_InitTicketGenerator_Ed25519( void *pvPrivateKey, size_t cbPrivateKey );
|
||||
|
||||
/// Serialize the specified auth ticket and attach a signature.
|
||||
/// Returns false if you did something stupid like forgot to load a key.
|
||||
/// Will also fail if your ticket is too big. (Probably because you
|
||||
/// added too many extra fields.)
|
||||
///
|
||||
/// The resulting blob should be sent to the client, who will put it in
|
||||
/// their ticket cache using ISteamNetworkingSockets::ReceivedRelayAuthTicket
|
||||
STEAMDATAGRAM_TICKET_INTERFACE bool SteamDatagram_SerializeAndSignTicket( const SteamDatagramRelayAuthTicket &ticket, SteamDatagramSignedTicketBlob &outBlob, SteamNetworkingErrMsg &errMsg );
|
||||
|
||||
//
|
||||
// Some ping-related tools that don't have anything to do with tickets.
|
||||
// But it's something that a backend might find useful, so we're putting it in this library for now.
|
||||
//
|
||||
|
||||
/// Parse location string. Returns true on success
|
||||
STEAMDATAGRAM_TICKET_INTERFACE bool SteamDatagram_ParsePingLocation( const char *pszString, SteamNetworkPingLocation_t &outLocation );
|
||||
|
||||
/// Estimate ping time between two locations.
|
||||
STEAMDATAGRAM_TICKET_INTERFACE int SteamDatagram_EstimatePingBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 );
|
||||
|
||||
#endif // STEAMDATAGRAM_TICKETGEN_H
|
@ -36,7 +36,6 @@ 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.)
|
||||
#ifndef IS_STEAMDATAGRAMROUTER
|
||||
struct SteamDatagramHostedAddress
|
||||
{
|
||||
|
||||
@ -73,7 +72,7 @@ struct SteamDatagramHostedAddress
|
||||
/// Convert to/from std::string (or anything that acts like it).
|
||||
/// Useful for interfacing with google protobuf. It's a template
|
||||
/// mainly so that we don't have to include <string> in the header.
|
||||
/// Note: by "string", we don't mean that it's text. Ut's a binary
|
||||
/// 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 )
|
||||
{
|
||||
@ -90,9 +89,7 @@ struct SteamDatagramHostedAddress
|
||||
{
|
||||
str->assign( m_data, m_cbSize );
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
/// Ticket used to gain access to the relay network.
|
||||
struct SteamDatagramRelayAuthTicket
|
||||
@ -228,7 +225,7 @@ private:
|
||||
if ( m_nExtraFields >= k_nMaxExtraFields )
|
||||
{
|
||||
assert( false );
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
ExtraField *p = &m_vecExtraFields[ m_nExtraFields++ ];
|
||||
p->m_eType = eType;
|
||||
@ -244,4 +241,46 @@ private:
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/// Max size of user data blob
|
||||
const size_t k_cbMaxSteamDatagramGameCoordinatorServerLoginAppData = 2048;
|
||||
|
||||
/// Max size of serialized data blob
|
||||
const size_t k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized = 4096;
|
||||
|
||||
/// Structure that describes a gameserver attempting to authenticate
|
||||
/// with your central server allocator / matchmaking service ("game coordinator").
|
||||
/// This is useful because the game coordinator needs to know:
|
||||
///
|
||||
/// - What data center is the gameserver running in?
|
||||
/// - The routing blob of the gameserver
|
||||
/// - Is the gameserver actually trusted?
|
||||
///
|
||||
/// Using this structure, you can securely communicate this information
|
||||
/// to your server, and you can do this WITHOUT maintaining any
|
||||
/// whitelists or tables of IP addresses.
|
||||
///
|
||||
/// See ISteamNetworkingSockets::GetGameCoordinatorServerLogin
|
||||
struct SteamDatagramGameCoordinatorServerLogin
|
||||
{
|
||||
/// Server's identity
|
||||
SteamNetworkingIdentity m_identity;
|
||||
|
||||
/// Routing info. Note that this includes the POPID
|
||||
SteamDatagramHostedAddress m_routing;
|
||||
|
||||
/// AppID that the server thinks it is running
|
||||
AppId_t m_nAppID;
|
||||
|
||||
/// Unix timestamp when this was generated
|
||||
RTime32 m_rtime;
|
||||
|
||||
/// Size of application data
|
||||
int m_cbAppData;
|
||||
|
||||
/// 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 ];
|
||||
};
|
||||
|
||||
#endif // STEAMDATAGRAM_TICKETS_H
|
||||
|
@ -29,4 +29,8 @@ S_API bool SteamEncryptedAppTicket_BUserOwnsAppInTicket( uint8 *rgubTicketDecryp
|
||||
|
||||
S_API bool SteamEncryptedAppTicket_BUserIsVacBanned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
|
||||
|
||||
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 bool SteamEncryptedAppTicket_BIsTicketSigned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, const uint8 *pubRSAKey, uint32 cubRSAKey );
|
||||
|
@ -11,6 +11,7 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
//----------------------------------------
|
||||
// SteamNetworkingSockets library config
|
||||
@ -19,8 +20,10 @@
|
||||
#ifdef STEAMNETWORKINGSOCKETS_STATIC_LINK
|
||||
#define STEAMNETWORKINGSOCKETS_INTERFACE extern
|
||||
#endif
|
||||
#define STEAMNETWORKINGSOCKETS_STEAMCLIENT
|
||||
#define STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
||||
#include <steam/steam_api_common.h>
|
||||
#define STEAMNETWORKINGSOCKETS_ENABLE_P2P
|
||||
#include "steam_api_common.h"
|
||||
//
|
||||
//----------------------------------------
|
||||
|
||||
@ -35,16 +38,26 @@
|
||||
|
||||
struct SteamDatagramRelayAuthTicket;
|
||||
struct SteamDatagramHostedAddress;
|
||||
struct SteamDatagramGameCoordinatorServerLogin;
|
||||
struct SteamNetConnectionStatusChangedCallback_t;
|
||||
struct SteamNetAuthenticationStatus_t;
|
||||
struct SteamRelayNetworkStatus_t;
|
||||
|
||||
/// Handle used to identify a connection to a remote host.
|
||||
typedef uint32 HSteamNetConnection;
|
||||
const HSteamNetConnection k_HSteamNetConnection_Invalid = 0;
|
||||
|
||||
/// Handle used to identify a "listen socket".
|
||||
/// Handle used to identify a "listen socket". Unlike traditional
|
||||
/// Berkeley sockets, a listen socket and a connection are two
|
||||
/// different abstractions.
|
||||
typedef uint32 HSteamListenSocket;
|
||||
const HSteamListenSocket k_HSteamListenSocket_Invalid = 0;
|
||||
|
||||
/// Handle used to identify a poll group, used to query many
|
||||
/// connections at once efficiently.
|
||||
typedef uint32 HSteamNetPollGroup;
|
||||
const HSteamNetPollGroup k_HSteamNetPollGroup_Invalid = 0;
|
||||
|
||||
/// Max length of diagnostic error message
|
||||
const int k_cchMaxSteamNetworkingErrMsg = 1024;
|
||||
|
||||
@ -60,9 +73,36 @@ typedef uint32 SteamNetworkingPOPID;
|
||||
/// microseconds. This is guaranteed to increase over time during the lifetime
|
||||
/// of a process, but not globally across runs. You don't need to worry about
|
||||
/// the value wrapping around. Note that the underlying clock might not actually have
|
||||
/// microsecond *resolution*.
|
||||
/// microsecond resolution.
|
||||
typedef int64 SteamNetworkingMicroseconds;
|
||||
|
||||
/// Describe the status of a particular network resource
|
||||
enum ESteamNetworkingAvailability
|
||||
{
|
||||
// Negative values indicate a problem.
|
||||
//
|
||||
// In general, we will not automatically retry unless you take some action that
|
||||
// depends on of requests this resource, such as querying the status, attempting
|
||||
// to initiate a connection, receive a connection, etc. If you do not take any
|
||||
// action at all, we do not automatically retry in the background.
|
||||
k_ESteamNetworkingAvailability_CannotTry = -102, // A dependent resource is missing, so this service is unavailable. (E.g. we cannot talk to routers because Internet is down or we don't have the network config.)
|
||||
k_ESteamNetworkingAvailability_Failed = -101, // We have tried for enough time that we would expect to have been successful by now. We have never been successful
|
||||
k_ESteamNetworkingAvailability_Previously = -100, // We tried and were successful at one time, but now it looks like we have a problem
|
||||
|
||||
k_ESteamNetworkingAvailability_Retrying = -10, // We previously failed and are currently retrying
|
||||
|
||||
// Not a problem, but not ready either
|
||||
k_ESteamNetworkingAvailability_NeverTried = 1, // We don't know because we haven't ever checked/tried
|
||||
k_ESteamNetworkingAvailability_Waiting = 2, // We're waiting on a dependent resource to be acquired. (E.g. we cannot obtain a cert until we are logged into Steam. We cannot measure latency to relays until we have the network config.)
|
||||
k_ESteamNetworkingAvailability_Attempting = 3, // We're actively trying now, but are not yet successful.
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
//
|
||||
// Describing network hosts
|
||||
//
|
||||
@ -70,15 +110,16 @@ typedef int64 SteamNetworkingMicroseconds;
|
||||
/// Different methods of describing the identity of a network host
|
||||
enum ESteamNetworkingIdentityType
|
||||
{
|
||||
// Dummy/unknown/invalid
|
||||
// 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
|
||||
// we'll use k_ESteamNetworkingIdentityType_UnknownType.
|
||||
k_ESteamNetworkingIdentityType_Invalid = 0,
|
||||
|
||||
//
|
||||
// Basic platform-specific identifiers.
|
||||
//
|
||||
k_ESteamNetworkingIdentityType_SteamID = 16, // 64-bit CSteamID
|
||||
k_ESteamNetworkingIdentityType_XboxPairwiseID = 17, // Publisher-specific user identity, as string
|
||||
//k_ESteamNetworkingIdentityType_PlaystationSomething = 18,
|
||||
|
||||
//
|
||||
// Special identifiers.
|
||||
@ -103,6 +144,13 @@ enum ESteamNetworkingIdentityType
|
||||
k_ESteamNetworkingIdentityType_GenericString = 2,
|
||||
k_ESteamNetworkingIdentityType_GenericBytes = 3,
|
||||
|
||||
// This identity type is used when we parse a string that looks like is a
|
||||
// valid identity, just of a kind that we don't recognize. In this case, we
|
||||
// can often still communicate with the peer! Allowing such identities
|
||||
// for types we do not recognize useful is very useful for forward
|
||||
// compatibility.
|
||||
k_ESteamNetworkingIdentityType_UnknownType = 4,
|
||||
|
||||
// Make sure this enum is stored in an int.
|
||||
k_ESteamNetworkingIdentityType__Force32bit = 0x7fffffff,
|
||||
};
|
||||
@ -141,6 +189,7 @@ struct SteamNetworkingIPAddr
|
||||
union
|
||||
{
|
||||
uint8 m_ipv6[ 16 ];
|
||||
#ifndef API_GEN // API generator doesn't understand this. The bindings will just use the accessors
|
||||
struct // IPv4 "mapped address" (rfc4038 section 4.2)
|
||||
{
|
||||
uint64 m_8zeros;
|
||||
@ -148,6 +197,7 @@ struct SteamNetworkingIPAddr
|
||||
uint16 m_ffff;
|
||||
uint8 m_ip[ 4 ]; // NOTE: As bytes, i.e. network byte order
|
||||
} m_ipv4;
|
||||
#endif
|
||||
};
|
||||
uint16 m_port; // Host byte order
|
||||
|
||||
@ -155,7 +205,11 @@ struct SteamNetworkingIPAddr
|
||||
bool operator==(const SteamNetworkingIPAddr &x ) const;
|
||||
};
|
||||
|
||||
/// An abstract way to represent the identity of a network host
|
||||
/// An abstract way to represent the identity of a network host. All identities can
|
||||
/// be represented as simple string. Furthermore, this string representation is actually
|
||||
/// 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
|
||||
{
|
||||
/// Type of identity.
|
||||
@ -173,9 +227,6 @@ struct SteamNetworkingIdentity
|
||||
void SetSteamID64( uint64 steamID ); // Takes SteamID as raw 64-bit number
|
||||
uint64 GetSteamID64() const; // Returns 0 if identity is not SteamID
|
||||
|
||||
bool SetXboxPairwiseID( const char *pszString ); // Returns false if invalid length
|
||||
const char *GetXboxPairwiseID() const; // Returns nullptr if not Xbox ID
|
||||
|
||||
void SetIPAddr( const SteamNetworkingIPAddr &addr ); // Set to specified IP:port
|
||||
const SteamNetworkingIPAddr *GetIPAddr() const; // returns null if we are not an IP address.
|
||||
|
||||
@ -199,14 +250,17 @@ struct SteamNetworkingIdentity
|
||||
/// k_cchMaxString bytes big to avoid truncation.
|
||||
void ToString( char *buf, size_t cbBuf ) const;
|
||||
|
||||
/// Parse back a string that was generated using ToString
|
||||
/// 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 funcky 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 );
|
||||
|
||||
// Max sizes
|
||||
enum {
|
||||
k_cchMaxString = 128, // Max length of the buffer needed to hold any identity, formatted in string format by ToString
|
||||
k_cchMaxGenericString = 32, // Max length of the string for generic string identities. Including terminating '\0'
|
||||
k_cchMaxXboxPairwiseID = 32, // Including terminating '\0'
|
||||
k_cbMaxGenericBytes = 32,
|
||||
};
|
||||
|
||||
@ -220,8 +274,8 @@ struct SteamNetworkingIdentity
|
||||
union {
|
||||
uint64 m_steamID64;
|
||||
char m_szGenericString[ k_cchMaxGenericString ];
|
||||
char m_szXboxPairwiseID[ k_cchMaxXboxPairwiseID ];
|
||||
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
|
||||
};
|
||||
@ -588,7 +642,7 @@ struct SteamNetworkingQuickConnectionStatus
|
||||
/// but has now been scheduled for re-transmission. Thus, it's possible to
|
||||
/// observe m_cbPendingReliable increasing between two checks, even if no
|
||||
/// calls were made to send reliable data between the checks. Data that is
|
||||
/// awaiting the nagle delay will appear in these numbers.
|
||||
/// awaiting the Nagle delay will appear in these numbers.
|
||||
int m_cbPendingUnreliable;
|
||||
int m_cbPendingReliable;
|
||||
|
||||
@ -636,7 +690,7 @@ struct SteamNetworkingQuickConnectionStatus
|
||||
/// and our peer might, too.
|
||||
const int k_cbMaxSteamNetworkingSocketsMessageSizeSend = 512 * 1024;
|
||||
|
||||
/// A message that has been received
|
||||
/// A message that has been received.
|
||||
struct SteamNetworkingMessage_t
|
||||
{
|
||||
|
||||
@ -644,15 +698,20 @@ struct SteamNetworkingMessage_t
|
||||
void *m_pData;
|
||||
|
||||
/// Size of the payload.
|
||||
uint32 m_cbSize;
|
||||
int m_cbSize;
|
||||
|
||||
/// The connection this came from. (Not used when using the ISteamMessages interface)
|
||||
/// For messages received on connections: what connection did this come from?
|
||||
/// For outgoing messages: what connection to send it to?
|
||||
/// Not used when using the ISteamNetworkingMessages interface
|
||||
HSteamNetConnection m_conn;
|
||||
|
||||
/// Who sent this to us?
|
||||
SteamNetworkingIdentity m_sender;
|
||||
/// For inbound messages: Who sent this to us?
|
||||
/// For outbound messages on connections: not used.
|
||||
/// For outbound messages on the ad-hoc ISteamNetworkingMessages interface: who should we send this to?
|
||||
SteamNetworkingIdentity m_identityPeer;
|
||||
|
||||
/// The user data associated with the connection.
|
||||
/// For messages received on connections, this is the user data
|
||||
/// associated with the connection.
|
||||
///
|
||||
/// This is *usually* the same as calling GetConnection() and then
|
||||
/// fetching the user data associated with that connection, but for
|
||||
@ -665,12 +724,16 @@ struct SteamNetworkingMessage_t
|
||||
/// - This is an inline call, so it's *much* faster.
|
||||
/// - You might have closed the connection, so fetching the user data
|
||||
/// would not be possible.
|
||||
///
|
||||
/// Not used when sending messages,
|
||||
int64 m_nConnUserData;
|
||||
|
||||
/// Local timestamps when it was received
|
||||
/// Local timestamp when the message was received
|
||||
/// Not used for outbound messages.
|
||||
SteamNetworkingMicroseconds m_usecTimeReceived;
|
||||
|
||||
/// Message number assigned by the sender
|
||||
/// Message number assigned by the sender.
|
||||
/// This is not used for outbound messages
|
||||
int64 m_nMessageNumber;
|
||||
|
||||
/// Function used to free up m_pData. This mechanism exists so that
|
||||
@ -681,33 +744,48 @@ struct SteamNetworkingMessage_t
|
||||
/// free( pMsg->m_pData );
|
||||
void (*m_pfnFreeData)( SteamNetworkingMessage_t *pMsg );
|
||||
|
||||
/// Function to used to decrement reference count and, if it's zero, release
|
||||
/// the message. You should not normally need to access this directly.
|
||||
/// (Use Release(), and don't set this.)
|
||||
/// 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 );
|
||||
|
||||
/// The channel number the message was received on.
|
||||
/// (Not used for messages received on "connections")
|
||||
/// When using ISteamNetworkingMessages, the channel number the message was received on
|
||||
/// (Not used for messages sent or received on "connections")
|
||||
int m_nChannel;
|
||||
|
||||
/// Pad to multiple of 8 bytes
|
||||
int m___nPadDummy;
|
||||
/// Bitmask of k_nSteamNetworkingSend_xxx flags.
|
||||
/// For received messages, only the k_nSteamNetworkingSend_Reliable bit is valid.
|
||||
/// For outbound messages, all bits are relevant
|
||||
int m_nFlags;
|
||||
|
||||
#ifdef __cplusplus
|
||||
/// Arbitrary user data that you can use when sending messages using
|
||||
/// ISteamNetworkingUtils::AllocateMessage and ISteamNetworkingSockets::SendMessage.
|
||||
/// (The callback you set in m_pfnFreeData might use this field.)
|
||||
///
|
||||
/// Not used for received messages.
|
||||
int64 m_nUserData;
|
||||
|
||||
/// You MUST call this when you're done with the object,
|
||||
/// to free up memory, etc.
|
||||
inline void Release();
|
||||
/// You MUST call this when you're done with the object,
|
||||
/// to free up memory, etc.
|
||||
inline void Release();
|
||||
|
||||
// For code compatibility, some accessors
|
||||
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; }
|
||||
inline SteamNetworkingMicroseconds GetTimeReceived() const { return m_usecTimeReceived; }
|
||||
inline int64 GetMessageNumber() const { return m_nMessageNumber; }
|
||||
#endif
|
||||
// For code compatibility, some accessors
|
||||
#ifndef API_GEN
|
||||
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; }
|
||||
inline SteamNetworkingMicroseconds GetTimeReceived() const { return m_usecTimeReceived; }
|
||||
inline int64 GetMessageNumber() const { return m_nMessageNumber; }
|
||||
#endif
|
||||
protected:
|
||||
// Declare destructor protected. You should never need to declare a message
|
||||
// object on the stack or create one yourself.
|
||||
// - 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() {}
|
||||
};
|
||||
|
||||
//
|
||||
@ -766,7 +844,7 @@ const int k_nSteamNetworkingSend_NoDelay = 4;
|
||||
// - there is a sufficiently large number of messages queued up already such that the current message
|
||||
// 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.
|
||||
// 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;
|
||||
|
||||
// Reliable message send. Can send up to k_cbMaxSteamNetworkingSocketsMessageSizeSend bytes in a single message.
|
||||
@ -785,6 +863,21 @@ const int k_nSteamNetworkingSend_Reliable = 8;
|
||||
// Migration note: This is equivalent to k_EP2PSendReliable
|
||||
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
|
||||
// a performance win when messages are sent from the "main thread". However, if this
|
||||
// flag is set, and data is ready to be sent immediately (either from this message
|
||||
// or earlier queued data), then that work will be done in the current thread, before
|
||||
// the current call returns. If data is not ready to be sent (due to rate limiting
|
||||
// or Nagle), then this flag has no effect.
|
||||
//
|
||||
// This is an advanced flag used to control performance at a very low level. For
|
||||
// most applications running on modern hardware with more than one CPU core, doing
|
||||
// the work of sending on a service thread will yield the best performance. Only
|
||||
// use this flag if you have a really good reason and understand what you are doing.
|
||||
// Otherwise you will probably just make performance worse.
|
||||
const int k_nSteamNetworkingSend_UseCurrentThread = 16;
|
||||
|
||||
//
|
||||
// Ping location / measurement
|
||||
//
|
||||
@ -924,8 +1017,44 @@ enum ESteamNetworkingConfigValue
|
||||
/// we don't know our identity or can't get a cert. On the server, it means that
|
||||
/// we won't automatically reject a connection due to a failure to authenticate.
|
||||
/// (You can examine the incoming connection and decide whether to accept it.)
|
||||
///
|
||||
/// This is a dev configuration value, and you should not let users modify it in
|
||||
/// production.
|
||||
k_ESteamNetworkingConfig_IP_AllowWithoutAuth = 23,
|
||||
|
||||
/// [connection int32] Do not send UDP packets with a payload of
|
||||
/// larger than N bytes. If you set this, k_ESteamNetworkingConfig_MTU_DataSize
|
||||
/// is automatically adjusted
|
||||
k_ESteamNetworkingConfig_MTU_PacketSize = 32,
|
||||
|
||||
/// [connection int32] (read only) Maximum message size you can send that
|
||||
/// will not fragment, based on k_ESteamNetworkingConfig_MTU_PacketSize
|
||||
k_ESteamNetworkingConfig_MTU_DataSize = 33,
|
||||
|
||||
/// [connection int32] Allow unencrypted (and unauthenticated) communication.
|
||||
/// 0: Not allowed (the default)
|
||||
/// 1: Allowed, but prefer encrypted
|
||||
/// 2: Allowed, and preferred
|
||||
/// 3: Required. (Fail the connection if the peer requires encryption.)
|
||||
///
|
||||
/// This is a dev configuration value, since its purpose is to disable encryption.
|
||||
/// You should not let users modify it in production. (But note that it requires
|
||||
/// the peer to also modify their value in order for encryption to be disabled.)
|
||||
k_ESteamNetworkingConfig_Unencrypted = 34,
|
||||
|
||||
/// [global int32] 0 or 1. Some variables are "dev" variables. They are useful
|
||||
/// for debugging, but should not be adjusted in production. When this flag is false (the default),
|
||||
/// such variables will not be enumerated by the ISteamnetworkingUtils::GetFirstConfigValue
|
||||
/// ISteamNetworkingUtils::GetConfigValueInfo functions. The idea here is that you
|
||||
/// can use those functions to provide a generic mechanism to set any configuration
|
||||
/// value from a console or configuration file, looking up the variable by name. Depending
|
||||
/// on your game, modifying other configuration values may also have negative effects, and
|
||||
/// you may wish to further lock down which variables are allowed to be modified by the user.
|
||||
/// (Maybe no variables!) Or maybe you use a whitelist or blacklist approach.
|
||||
///
|
||||
/// (This flag is itself a dev variable.)
|
||||
k_ESteamNetworkingConfig_EnumerateDevVars = 35,
|
||||
|
||||
//
|
||||
// Settings for SDR relayed connections
|
||||
//
|
||||
@ -968,6 +1097,13 @@ enum ESteamNetworkingConfigValue
|
||||
/// this set (maybe just one). Comma-separated list.
|
||||
k_ESteamNetworkingConfig_SDRClient_ForceProxyAddr = 31,
|
||||
|
||||
/// [global string] For debugging. Force ping times to clusters to be the specified
|
||||
/// values. A comma separated list of <cluster>=<ms> values. E.g. "sto=32,iad=100"
|
||||
///
|
||||
/// This is a dev configuration value, you probably should not let users modify it
|
||||
/// in production.
|
||||
k_ESteamNetworkingConfig_SDRClient_FakeClusterPing = 36,
|
||||
|
||||
//
|
||||
// Log levels for debuging information. A higher priority
|
||||
// (lower numeric value) will cause more stuff to be printed.
|
||||
@ -982,6 +1118,36 @@ enum ESteamNetworkingConfigValue
|
||||
k_ESteamNetworkingConfigValue__Force32Bit = 0x7fffffff
|
||||
};
|
||||
|
||||
/// In a few places we need to set configuration options on listen sockets and connections, and
|
||||
/// have them take effect *before* the listen socket or connection really starts doing anything.
|
||||
/// Creating the object and then setting the options "immediately" after creation doesn't work
|
||||
/// completely, because network packets could be received between the time the object is created and
|
||||
/// when the options are applied. To set options at creation time in a reliable way, they must be
|
||||
/// passed to the creation function. This structure is used to pass those options.
|
||||
///
|
||||
/// For the meaning of these fields, see ISteamNetworkingUtils::SetConfigValue. Basically
|
||||
/// 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
|
||||
{
|
||||
/// Which option is being set
|
||||
ESteamNetworkingConfigValue m_eValue;
|
||||
|
||||
/// Which field below did you fill in?
|
||||
ESteamNetworkingConfigDataType m_eDataType;
|
||||
|
||||
/// Option value
|
||||
union
|
||||
{
|
||||
int32_t m_int32;
|
||||
int64_t m_int64;
|
||||
float m_float;
|
||||
const char *m_string; // Points to your '\0'-terminated buffer
|
||||
void *m_functionPtr;
|
||||
} m_val;
|
||||
};
|
||||
|
||||
/// Return value of ISteamNetworkintgUtils::GetConfigValue
|
||||
enum ESteamNetworkingGetConfigValueResult
|
||||
{
|
||||
@ -1059,9 +1225,13 @@ inline void GetSteamNetworkingLocationPOPStringFromID( SteamNetworkingPOPID id,
|
||||
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';
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Internal stuff
|
||||
#ifndef API_GEN
|
||||
|
||||
// For code compatibility
|
||||
typedef SteamNetworkingMessage_t ISteamNetworkingMessage;
|
||||
@ -1083,24 +1253,21 @@ inline void SteamNetworkingIdentity::SetSteamID( CSteamID steamID ) { SetSteamID
|
||||
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 bool SteamNetworkingIdentity::SetXboxPairwiseID( const char *pszString ) { size_t l = strlen( pszString ); if ( l < 1 || l >= sizeof(m_szXboxPairwiseID) ) return false;
|
||||
m_eType = k_ESteamNetworkingIdentityType_XboxPairwiseID; m_cbSize = int(l+1); memcpy( m_szXboxPairwiseID, pszString, m_cbSize ); return true; }
|
||||
inline const char *SteamNetworkingIdentity::GetXboxPairwiseID() const { return m_eType == k_ESteamNetworkingIdentityType_XboxPairwiseID ? m_szXboxPairwiseID : nullptr; }
|
||||
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 : nullptr; }
|
||||
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 : nullptr; }
|
||||
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 nullptr;
|
||||
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 ); }
|
||||
|
||||
#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) || !defined( STEAMNETWORKINGSOCKETS_STEAM )
|
||||
#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) || !defined( STEAMNETWORKINGSOCKETS_STEAMCLIENT )
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamAPI_SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr *pAddr, char *buf, size_t cbBuf, bool bWithPort );
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamAPI_SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr );
|
||||
STEAMNETWORKINGSOCKETS_INTERFACE void SteamAPI_SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf );
|
||||
@ -1111,4 +1278,6 @@ inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const {
|
||||
inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamAPI_SteamNetworkingIdentity_ParseString( this, sizeof(*this), pszStr ); }
|
||||
#endif
|
||||
|
||||
#endif // #ifndef API_GEN
|
||||
|
||||
#endif // #ifndef STEAMNETWORKINGTYPES
|
||||
|
@ -104,6 +104,7 @@ typedef unsigned int uintp;
|
||||
#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 ];
|
||||
@ -130,7 +131,6 @@ const JobID_t k_JobIDNil = 0xffffffffffffffffull;
|
||||
// this is baked into client messages and interfaces as an int,
|
||||
// make sure we never break this.
|
||||
typedef uint32 PackageId_t;
|
||||
const PackageId_t k_uPackageIdFreeSub = 0x0;
|
||||
const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;
|
||||
|
||||
typedef uint32 BundleId_t;
|
||||
@ -184,4 +184,80 @@ const SiteId_t k_ulSiteIdInvalid = 0;
|
||||
typedef uint64 PartyBeaconID_t;
|
||||
const PartyBeaconID_t k_ulPartyBeaconIdInvalid = 0;
|
||||
|
||||
enum ESteamIPType
|
||||
{
|
||||
k_ESteamIPTypeIPv4 = 0,
|
||||
k_ESteamIPTypeIPv6 = 1,
|
||||
};
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
|
||||
struct SteamIPAddress_t
|
||||
{
|
||||
union {
|
||||
|
||||
uint32 m_unIPv4; // Host order
|
||||
uint8 m_rgubIPv6[16]; // Network order! Same as inaddr_in6. (0011:2233:4455:6677:8899:aabb:ccdd:eeff)
|
||||
|
||||
// Internal use only
|
||||
uint64 m_ipv6Qword[2]; // big endian
|
||||
};
|
||||
|
||||
ESteamIPType m_eType;
|
||||
|
||||
bool IsSet() const
|
||||
{
|
||||
if ( k_ESteamIPTypeIPv4 == m_eType )
|
||||
{
|
||||
return m_unIPv4 != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_ipv6Qword[0] !=0 || m_ipv6Qword[1] != 0;
|
||||
}
|
||||
}
|
||||
|
||||
static SteamIPAddress_t IPv4Any()
|
||||
{
|
||||
SteamIPAddress_t ipOut;
|
||||
ipOut.m_eType = k_ESteamIPTypeIPv4;
|
||||
ipOut.m_unIPv4 = 0;
|
||||
|
||||
return ipOut;
|
||||
}
|
||||
|
||||
static SteamIPAddress_t IPv6Any()
|
||||
{
|
||||
SteamIPAddress_t ipOut;
|
||||
ipOut.m_eType = k_ESteamIPTypeIPv6;
|
||||
ipOut.m_ipv6Qword[0] = 0;
|
||||
ipOut.m_ipv6Qword[1] = 0;
|
||||
|
||||
return ipOut;
|
||||
}
|
||||
|
||||
static SteamIPAddress_t IPv4Loopback()
|
||||
{
|
||||
SteamIPAddress_t ipOut;
|
||||
ipOut.m_eType = k_ESteamIPTypeIPv4;
|
||||
ipOut.m_unIPv4 = 0x7f000001;
|
||||
|
||||
return ipOut;
|
||||
}
|
||||
|
||||
static SteamIPAddress_t IPv6Loopback()
|
||||
{
|
||||
SteamIPAddress_t ipOut;
|
||||
ipOut.m_eType = k_ESteamIPTypeIPv6;
|
||||
ipOut.m_ipv6Qword[0] = 0;
|
||||
ipOut.m_ipv6Qword[1] = 0;
|
||||
ipOut.m_rgubIPv6[15] = 1;
|
||||
|
||||
return ipOut;
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
#endif // STEAMTYPES_H
|
||||
|
Loading…
Reference in New Issue
Block a user