From 98b149b9b6a1fbaa60e13a48b8aed578b429a814 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Mon, 6 Dec 2021 16:51:17 -0500 Subject: [PATCH] SDK 1.52 --- dll/common_includes.h | 12 +- dll/flat.cpp | 315 +++++++-- dll/local_storage.cpp | 2 +- dll/steam_client.cpp | 12 +- dll/steam_controller.h | 142 +++- dll/steam_gameserver.cpp | 23 + dll/steam_gameserver.h | 14 + dll/steam_networking_sockets.h | 1 + dll/steam_networking_socketsserialized.h | 9 +- dll/steam_remote_storage.h | 29 + dll/steam_ugc.h | 17 + dll/steam_utils.h | 27 + sdk_includes/isteamapplist.h | 11 +- sdk_includes/isteamcontroller.h | 7 +- sdk_includes/isteamgameserver.h | 136 ++-- sdk_includes/isteamgameserver013.h | 240 +++++++ sdk_includes/isteamhtmlsurface.h | 1 - sdk_includes/isteaminput.h | 213 +++++- sdk_includes/isteaminput002.h | 149 ++++ sdk_includes/isteamnetworkingsockets.h | 41 +- sdk_includes/isteamnetworkingsockets009.h | 653 ++++++++++++++++++ .../isteamnetworkingsocketsserialized.h | 16 + sdk_includes/isteamremotestorage.h | 112 ++- sdk_includes/isteamremotestorage014.h | 214 ++++++ sdk_includes/isteamugc.h | 32 + sdk_includes/isteamutils.h | 44 +- sdk_includes/steam_api.h | 3 + sdk_includes/steam_api_flat.h | 39 +- sdk_includes/steam_api_internal.h | 25 + sdk_includes/steam_gameserver.h | 17 +- sdk_includes/steamclientpublic.h | 3 + sdk_includes/steamnetworkingtypes.h | 114 ++- 32 files changed, 2416 insertions(+), 257 deletions(-) create mode 100644 sdk_includes/isteamgameserver013.h create mode 100644 sdk_includes/isteaminput002.h create mode 100644 sdk_includes/isteamnetworkingsockets009.h create mode 100644 sdk_includes/isteamremotestorage014.h diff --git a/dll/common_includes.h b/dll/common_includes.h index 4dc55d1..f68e161 100644 --- a/dll/common_includes.h +++ b/dll/common_includes.h @@ -184,8 +184,16 @@ inline std::wstring utf8_decode(const std::string &str) #define CLIENT_HSTEAMUSER 1 #define SERVER_HSTEAMUSER 1 -#define DEFAULT_NAME "Goldberg" -#define PROGRAM_NAME "Goldberg SteamEmu" +#define DEFAULT_NAME "Noob" +#define PROGRAM_NAME_1 "Go" +#define PROGRAM_NAME_2 "ld" +#define PROGRAM_NAME_3 "be" +#define PROGRAM_NAME_4 "rg " +#define PROGRAM_NAME_5 "St" +#define PROGRAM_NAME_6 "ea" +#define PROGRAM_NAME_7 "mE" +#define PROGRAM_NAME_8 "mu" + #define DEFAULT_LANGUAGE "english" #define LOBBY_CONNECT_APPID ((uint32)-2) diff --git a/dll/flat.cpp b/dll/flat.cpp index b15dd67..9007c71 100644 --- a/dll/flat.cpp +++ b/dll/flat.cpp @@ -242,6 +242,16 @@ STEAMAPI_API void SteamAPI_ISteamUser_TerminateGameConnection( ISteamUser* self, return (get_steam_client()->steam_user)->TerminateGameConnection(unIPServer, usPortServer); } +STEAMAPI_API int SteamAPI_ISteamUser_InitiateGameConnection_DEPRECATED( ISteamUser* self, void * pAuthBlob, int cbMaxAuthBlob, uint64_steamid steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) +{ + return (get_steam_client()->steam_user)->InitiateGameConnection(pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure); +} + +STEAMAPI_API void SteamAPI_ISteamUser_TerminateGameConnection_DEPRECATED( ISteamUser* self, uint32 unIPServer, uint16 usPortServer ) +{ + return (get_steam_client()->steam_user)->TerminateGameConnection(unIPServer, usPortServer); +} + STEAMAPI_API void SteamAPI_ISteamUser_TrackAppUsageEvent( ISteamUser* self, uint64_gameid gameID, int eAppUsageEvent, const char * pchExtraInfo ) { return (get_steam_client()->steam_user)->TrackAppUsageEvent(CGameID(gameID), eAppUsageEvent, pchExtraInfo); @@ -1180,6 +1190,44 @@ STEAMAPI_API ESteamIPv6ConnectivityState SteamAPI_ISteamUtils_GetIPv6Connectivit return (ptr)->GetIPv6ConnectivityState(eProtocol); } +STEAMAPI_API bool SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck( ISteamUtils* self ) +{ + int test1 = ((char *)self - (char*)get_steam_client()->steam_utils); + int test2 = ((char *)self - (char*)get_steam_client()->steam_gameserver_utils); + auto ptr = get_steam_client()->steam_gameserver_utils; + if (test1 >= 0 && (test2 < 0 || test1 < test2)) { + ptr = get_steam_client()->steam_utils; + } + + return (ptr)->IsSteamRunningOnSteamDeck(); +} + +STEAMAPI_API bool SteamAPI_ISteamUtils_ShowModalGamepadTextInput( ISteamUtils* self, EGamepadTextInputLineMode eLineInputMode ) +{ + int test1 = ((char *)self - (char*)get_steam_client()->steam_utils); + int test2 = ((char *)self - (char*)get_steam_client()->steam_gameserver_utils); + auto ptr = get_steam_client()->steam_gameserver_utils; + if (test1 >= 0 && (test2 < 0 || test1 < test2)) { + ptr = get_steam_client()->steam_utils; + } + + //flat vs normal api mismatch + return (ptr)->ShowFloatingGamepadTextInput((EFloatingGamepadTextInputMode)eLineInputMode, 0, 0, 0, 0); +} + +STEAMAPI_API void SteamAPI_ISteamUtils_SetGameLauncherMode( ISteamUtils* self, bool bLauncherMode ) +{ + int test1 = ((char *)self - (char*)get_steam_client()->steam_utils); + int test2 = ((char *)self - (char*)get_steam_client()->steam_gameserver_utils); + auto ptr = get_steam_client()->steam_gameserver_utils; + if (test1 >= 0 && (test2 < 0 || test1 < test2)) { + ptr = get_steam_client()->steam_utils; + } + + return (ptr)->SetGameLauncherMode(bLauncherMode); +} + + STEAMAPI_API ISteamMatchmaking *SteamAPI_SteamMatchmaking_v009() { return get_steam_client()->GetISteamMatchmaking(flat_hsteamuser(), flat_hsteampipe(), "SteamMatchMaking009"); @@ -1665,6 +1713,11 @@ STEAMAPI_API ISteamRemoteStorage *SteamAPI_SteamRemoteStorage_v014() return get_steam_client()->GetISteamRemoteStorage(flat_hsteamuser(), flat_hsteampipe(), "STEAMREMOTESTORAGE_INTERFACE_VERSION014"); } +STEAMAPI_API ISteamRemoteStorage *SteamAPI_SteamRemoteStorage_v016() +{ + return get_steam_client()->GetISteamRemoteStorage(flat_hsteamuser(), flat_hsteampipe(), "STEAMREMOTESTORAGE_INTERFACE_VERSION016"); +} + STEAMAPI_API bool SteamAPI_ISteamRemoteStorage_FileWrite( ISteamRemoteStorage* self, const char * pchFile, const void * pvData, int32 cubData ) { return (get_steam_client()->steam_remote_storage)->FileWrite(pchFile, pvData, cubData); @@ -1940,6 +1993,26 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( return (get_steam_client()->steam_remote_storage)->UGCDownloadToLocation(hContent, pchLocation, unPriority); } +STEAMAPI_API int32 SteamAPI_ISteamRemoteStorage_GetLocalFileChangeCount( ISteamRemoteStorage* self ) +{ + return (get_steam_client()->steam_remote_storage)->GetLocalFileChangeCount(); +} + +STEAMAPI_API const char * SteamAPI_ISteamRemoteStorage_GetLocalFileChange( ISteamRemoteStorage* self, int iFile, ERemoteStorageLocalFileChange * pEChangeType, ERemoteStorageFilePathType * pEFilePathType ) +{ + return (get_steam_client()->steam_remote_storage)->GetLocalFileChange(iFile, pEChangeType, pEFilePathType); +} + +STEAMAPI_API bool SteamAPI_ISteamRemoteStorage_BeginFileWriteBatch( ISteamRemoteStorage* self ) +{ + return (get_steam_client()->steam_remote_storage)->BeginFileWriteBatch(); +} + +STEAMAPI_API bool SteamAPI_ISteamRemoteStorage_EndFileWriteBatch( ISteamRemoteStorage* self ) +{ + return (get_steam_client()->steam_remote_storage)->EndFileWriteBatch(); +} + STEAMAPI_API ISteamUserStats *SteamAPI_SteamUserStats_v012() { return get_steam_client()->GetISteamUserStats(flat_hsteamuser(), flat_hsteampipe(), "STEAMUSERSTATS_INTERFACE_VERSION012"); @@ -2910,9 +2983,14 @@ STEAMAPI_API ISteamInput *SteamAPI_SteamInput_v002() return get_steam_client()->GetISteamInput(flat_hsteamuser(), flat_hsteampipe(), "SteamInput002"); } -STEAMAPI_API bool SteamAPI_ISteamInput_Init( ISteamInput* self ) +STEAMAPI_API ISteamInput *SteamAPI_SteamInput_v005() { - return (get_steam_client()->steam_controller)->Init(); + return get_steam_client()->GetISteamInput(flat_hsteamuser(), flat_hsteampipe(), "SteamInput005"); +} + +STEAMAPI_API bool SteamAPI_ISteamInput_Init( ISteamInput* self, bool bExplicitlyCallRunFrame ) +{ + return self->Init(bExplicitlyCallRunFrame); } STEAMAPI_API bool SteamAPI_ISteamInput_Shutdown( ISteamInput* self ) @@ -2920,9 +2998,24 @@ STEAMAPI_API bool SteamAPI_ISteamInput_Shutdown( ISteamInput* self ) return (get_steam_client()->steam_controller)->Shutdown(); } -STEAMAPI_API void SteamAPI_ISteamInput_RunFrame( ISteamInput* self ) +STEAMAPI_API bool SteamAPI_ISteamInput_SetInputActionManifestFilePath( ISteamInput* self, const char * pchInputActionManifestAbsolutePath ) { - return (get_steam_client()->steam_controller)->RunFrame(); + return (get_steam_client()->steam_controller)->SetInputActionManifestFilePath(pchInputActionManifestAbsolutePath); +} + +STEAMAPI_API void SteamAPI_ISteamInput_RunFrame( ISteamInput* self, bool bReservedValue ) +{ + return (get_steam_client()->steam_controller)->RunFrame(bReservedValue); +} + +STEAMAPI_API bool SteamAPI_ISteamInput_BWaitForData( ISteamInput* self, bool bWaitForever, uint32 unTimeout ) +{ + return (get_steam_client()->steam_controller)->BWaitForData(bWaitForever, unTimeout); +} + +STEAMAPI_API bool SteamAPI_ISteamInput_BNewDataAvailable( ISteamInput* self ) +{ + return (get_steam_client()->steam_controller)->BNewDataAvailable(); } STEAMAPI_API int SteamAPI_ISteamInput_GetConnectedControllers( ISteamInput* self, InputHandle_t * handlesOut ) @@ -2930,6 +3023,16 @@ STEAMAPI_API int SteamAPI_ISteamInput_GetConnectedControllers( ISteamInput* self return (get_steam_client()->steam_controller)->GetConnectedControllers(handlesOut); } +STEAMAPI_API void SteamAPI_ISteamInput_EnableDeviceCallbacks( ISteamInput* self ) +{ + return (get_steam_client()->steam_controller)->EnableDeviceCallbacks(); +} + +STEAMAPI_API void SteamAPI_ISteamInput_EnableActionEventCallbacks( ISteamInput* self, SteamInputActionEventCallbackPointer pCallback ) +{ + return (get_steam_client()->steam_controller)->EnableActionEventCallbacks(pCallback); +} + STEAMAPI_API InputActionSetHandle_t SteamAPI_ISteamInput_GetActionSetHandle( ISteamInput* self, const char * pszActionSetName ) { return (get_steam_client()->steam_controller)->GetActionSetHandle(pszActionSetName); @@ -2980,6 +3083,11 @@ STEAMAPI_API int SteamAPI_ISteamInput_GetDigitalActionOrigins( ISteamInput* self return (get_steam_client()->steam_controller)->GetDigitalActionOrigins(inputHandle, actionSetHandle, digitalActionHandle, originsOut); } +STEAMAPI_API const char * SteamAPI_ISteamInput_GetStringForDigitalActionName( ISteamInput* self, InputDigitalActionHandle_t eActionHandle ) +{ + return (get_steam_client()->steam_controller)->GetStringForDigitalActionName(eActionHandle); +} + STEAMAPI_API InputAnalogActionHandle_t SteamAPI_ISteamInput_GetAnalogActionHandle( ISteamInput* self, const char * pszActionName ) { return (get_steam_client()->steam_controller)->GetAnalogActionHandle(pszActionName); @@ -3000,11 +3108,31 @@ STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphForActionOrigin( ISteamIn return (get_steam_client()->steam_controller)->GetGlyphForActionOrigin(eOrigin); } +STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphPNGForActionOrigin( ISteamInput* self, EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags ) +{ + return (get_steam_client()->steam_controller)->GetGlyphPNGForActionOrigin(eOrigin, eSize, unFlags); +} + +STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphSVGForActionOrigin( ISteamInput* self, EInputActionOrigin eOrigin, uint32 unFlags ) +{ + return (get_steam_client()->steam_controller)->GetGlyphSVGForActionOrigin(eOrigin, unFlags); +} + +STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphForActionOrigin_Legacy( ISteamInput* self, EInputActionOrigin eOrigin ) +{ + return (get_steam_client()->steam_controller)->GetGlyphForActionOrigin_Legacy(eOrigin); +} + STEAMAPI_API const char * SteamAPI_ISteamInput_GetStringForActionOrigin( ISteamInput* self, EInputActionOrigin eOrigin ) { return (get_steam_client()->steam_controller)->GetStringForActionOrigin(eOrigin); } +STEAMAPI_API const char * SteamAPI_ISteamInput_GetStringForAnalogActionName( ISteamInput* self, InputAnalogActionHandle_t eActionHandle ) +{ + return (get_steam_client()->steam_controller)->GetStringForAnalogActionName(eActionHandle); +} + STEAMAPI_API void SteamAPI_ISteamInput_StopAnalogActionMomentum( ISteamInput* self, InputHandle_t inputHandle, InputAnalogActionHandle_t eAction ) { return (get_steam_client()->steam_controller)->StopAnalogActionMomentum(inputHandle, eAction); @@ -3020,6 +3148,16 @@ STEAMAPI_API void SteamAPI_ISteamInput_TriggerVibration( ISteamInput* self, Inpu return (get_steam_client()->steam_controller)->TriggerVibration(inputHandle, usLeftSpeed, usRightSpeed); } +STEAMAPI_API void SteamAPI_ISteamInput_TriggerVibrationExtended( ISteamInput* self, InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed, unsigned short usLeftTriggerSpeed, unsigned short usRightTriggerSpeed ) +{ + return (get_steam_client()->steam_controller)->TriggerVibrationExtended(inputHandle, usLeftSpeed, usRightSpeed, usLeftTriggerSpeed, usRightTriggerSpeed); +} + +STEAMAPI_API void SteamAPI_ISteamInput_TriggerSimpleHapticEvent( ISteamInput* self, InputHandle_t inputHandle, EControllerHapticLocation eHapticLocation, uint8 nIntensity, char nGainDB, uint8 nOtherIntensity, char nOtherGainDB ) +{ + return (get_steam_client()->steam_controller)->TriggerSimpleHapticEvent(inputHandle, eHapticLocation, nIntensity, nGainDB, nOtherIntensity, nOtherGainDB); +} + STEAMAPI_API void SteamAPI_ISteamInput_SetLEDColor( ISteamInput* self, InputHandle_t inputHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) { return (get_steam_client()->steam_controller)->SetLEDColor(inputHandle, nColorR, nColorG, nColorB, nFlags); @@ -3035,6 +3173,16 @@ STEAMAPI_API void SteamAPI_ISteamInput_TriggerRepeatedHapticPulse( ISteamInput* return (get_steam_client()->steam_controller)->TriggerRepeatedHapticPulse(inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); } +STEAMAPI_API void SteamAPI_ISteamInput_Legacy_TriggerHapticPulse( ISteamInput* self, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) +{ + return (get_steam_client()->steam_controller)->Legacy_TriggerHapticPulse(inputHandle, eTargetPad, usDurationMicroSec); +} + +STEAMAPI_API void SteamAPI_ISteamInput_Legacy_TriggerRepeatedHapticPulse( ISteamInput* self, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) +{ + return (get_steam_client()->steam_controller)->Legacy_TriggerRepeatedHapticPulse(inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); +} + STEAMAPI_API bool SteamAPI_ISteamInput_ShowBindingPanel( ISteamInput* self, InputHandle_t inputHandle ) { return (get_steam_client()->steam_controller)->ShowBindingPanel(inputHandle); @@ -3085,6 +3233,11 @@ STEAMAPI_API uint32 SteamAPI_ISteamInput_GetRemotePlaySessionID( ISteamInput* se return (get_steam_client()->steam_controller)->GetRemotePlaySessionID(inputHandle); } +STEAMAPI_API uint16 SteamAPI_ISteamInput_GetSessionInputConfigurationSettings( ISteamInput* self ) +{ + return (get_steam_client()->steam_controller)->GetSessionInputConfigurationSettings(); +} + STEAMAPI_API ISteamController *SteamAPI_SteamController_v007() { return get_steam_client()->GetISteamController(flat_hsteamuser(), flat_hsteampipe(), "SteamController007"); @@ -4305,6 +4458,31 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_DeleteItem( ISteamUGC* self, Publ return (ptr)->DeleteItem(nPublishedFileID); } +STEAMAPI_API bool SteamAPI_ISteamUGC_ShowWorkshopEULA( ISteamUGC* self ) +{ + int test1 = ((char *)self - (char*)get_steam_client()->steam_ugc); + int test2 = ((char *)self - (char*)get_steam_client()->steam_gameserver_ugc); + auto ptr = get_steam_client()->steam_gameserver_ugc; + if (test1 >= 0 && (test2 < 0 || test1 < test2)) { + ptr = get_steam_client()->steam_ugc; + } + + return (ptr)->ShowWorkshopEULA(); +} + +STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_GetWorkshopEULAStatus( ISteamUGC* self ) +{ + int test1 = ((char *)self - (char*)get_steam_client()->steam_ugc); + int test2 = ((char *)self - (char*)get_steam_client()->steam_gameserver_ugc); + auto ptr = get_steam_client()->steam_gameserver_ugc; + if (test1 >= 0 && (test2 < 0 || test1 < test2)) { + ptr = get_steam_client()->steam_ugc; + } + + return (ptr)->GetWorkshopEULAStatus(); +} + + STEAMAPI_API ISteamAppList *SteamAPI_SteamAppList_v001() { return get_steam_client()->GetISteamAppList(flat_hsteamuser(), flat_hsteampipe(), "STEAMAPPLIST_INTERFACE_VERSION001"); @@ -5234,6 +5412,16 @@ STEAMAPI_API ESteamNetworkingConnectionState SteamAPI_ISteamNetworkingMessages_G return self->GetSessionConnectionInfo(identityRemote, pConnectionInfo, pQuickStatus); } +STEAMAPI_API ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI_v011() +{ + return (ISteamNetworkingSockets *)get_steam_client()->GetISteamGenericInterface(flat_hsteamuser(), flat_hsteampipe(), "SteamNetworkingSockets011"); +} + +STEAMAPI_API ISteamNetworkingSockets *SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v011() +{ + return (ISteamNetworkingSockets *)get_steam_client()->GetISteamGenericInterface(flat_gs_hsteamuser(), flat_gs_hsteampipe(), "SteamNetworkingSockets011"); +} + STEAMAPI_API ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI_v009() { return (ISteamNetworkingSockets *)get_steam_client()->GetISteamGenericInterface(flat_hsteamuser(), flat_hsteampipe(), "SteamNetworkingSockets009"); @@ -5459,6 +5647,11 @@ STEAMAPI_API bool SteamAPI_ISteamNetworkingSockets_SetCertificate( ISteamNetwork return self->SetCertificate(pCertificate, cbCertificate, errMsg); } +// STEAMAPI_API void SteamAPI_ISteamNetworkingSockets_ResetIdentity( ISteamNetworkingSockets* self, const SteamNetworkingIdentity * pIdentity ) +// { +// return self->ResetIdentity(pIdentity); +// } + STEAMAPI_API void SteamAPI_ISteamNetworkingSockets_RunCallbacks( ISteamNetworkingSockets* self ) { return self->RunCallbacks(); @@ -5489,6 +5682,11 @@ STEAMAPI_API ISteamNetworkingUtils *SteamAPI_SteamNetworkingUtils_SteamAPI_v003( return (ISteamNetworkingUtils *)get_steam_client()->GetISteamGenericInterface(flat_hsteamuser(), flat_hsteampipe(), "SteamNetworkingUtils003"); } +STEAMAPI_API ISteamNetworkingUtils *SteamAPI_SteamNetworkingUtils_SteamAPI_v004() +{ + return (ISteamNetworkingUtils *)get_steam_client()->GetISteamGenericInterface(flat_hsteamuser(), flat_hsteampipe(), "SteamNetworkingUtils004"); +} + STEAMAPI_API ISteamNetworkingUtils *SteamAPI_SteamNetworkingUtils_v003() { return (ISteamNetworkingUtils *)get_steam_client()->GetISteamGenericInterface(flat_hsteamuser(), flat_hsteampipe(), "SteamNetworkingUtils003"); @@ -5649,6 +5847,11 @@ STEAMAPI_API bool SteamAPI_ISteamNetworkingUtils_GetConfigValueInfo( ISteamNetwo return self->GetConfigValueInfo(eValue, pOutName, pOutDataType, pOutScope, pOutNextValue); } +// STEAMAPI_API ESteamNetworkingConfigValue SteamAPI_ISteamNetworkingUtils_IterateGenericEditableConfigValues( ISteamNetworkingUtils* self, ESteamNetworkingConfigValue eCurrent, bool bEnumerateDevVars ) +// { +// return self->GetConfigValueInfo(eValue, pOutName, pOutDataType, pOutScope, pOutNextValue); +// } + STEAMAPI_API ESteamNetworkingConfigValue SteamAPI_ISteamNetworkingUtils_GetFirstConfigValue( ISteamNetworkingUtils* self ) { return self->GetFirstConfigValue(); @@ -5679,6 +5882,11 @@ STEAMAPI_API ISteamGameServer *SteamAPI_SteamGameServer_v013() return get_steam_client()->GetISteamGameServer(flat_gs_hsteamuser(), flat_gs_hsteampipe(), "SteamGameServer013"); } +STEAMAPI_API ISteamGameServer *SteamAPI_SteamGameServer_v014() +{ + return get_steam_client()->GetISteamGameServer(flat_gs_hsteamuser(), flat_gs_hsteampipe(), "SteamGameServer014"); +} + STEAMAPI_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char * pchVersionString) { return ((ISteamGameServer *)instancePtr)->InitGameServer(unIP, usGamePort, usQueryPort, unFlags, nGameAppId, pchVersionString); @@ -5686,177 +5894,192 @@ STEAMAPI_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, STEAMAPI_API void SteamAPI_ISteamGameServer_SetProduct( ISteamGameServer* self, const char * pszProduct ) { - return self->SetProduct(pszProduct); + return get_steam_client()->steam_gameserver->SetProduct(pszProduct); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetGameDescription( ISteamGameServer* self, const char * pszGameDescription ) { - return self->SetGameDescription(pszGameDescription); + return get_steam_client()->steam_gameserver->SetGameDescription(pszGameDescription); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetModDir( ISteamGameServer* self, const char * pszModDir ) { - return self->SetModDir(pszModDir); + return get_steam_client()->steam_gameserver->SetModDir(pszModDir); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetDedicatedServer( ISteamGameServer* self, bool bDedicated ) { - return self->SetDedicatedServer(bDedicated); + return get_steam_client()->steam_gameserver->SetDedicatedServer(bDedicated); } STEAMAPI_API void SteamAPI_ISteamGameServer_LogOn( ISteamGameServer* self, const char * pszToken ) { - return self->LogOn(pszToken); + return get_steam_client()->steam_gameserver->LogOn(pszToken); } STEAMAPI_API void SteamAPI_ISteamGameServer_LogOnAnonymous( ISteamGameServer* self ) { - return self->LogOnAnonymous(); + return get_steam_client()->steam_gameserver->LogOnAnonymous(); } STEAMAPI_API void SteamAPI_ISteamGameServer_LogOff( ISteamGameServer* self ) { - return self->LogOff(); + return get_steam_client()->steam_gameserver->LogOff(); } STEAMAPI_API bool SteamAPI_ISteamGameServer_BLoggedOn( ISteamGameServer* self ) { - return self->BLoggedOn(); + return get_steam_client()->steam_gameserver->BLoggedOn(); } STEAMAPI_API bool SteamAPI_ISteamGameServer_BSecure( ISteamGameServer* self ) { - return self->BSecure(); + return get_steam_client()->steam_gameserver->BSecure(); } STEAMAPI_API uint64_steamid SteamAPI_ISteamGameServer_GetSteamID( ISteamGameServer* self ) { - return self->GetSteamID().ConvertToUint64(); + return get_steam_client()->steam_gameserver->GetSteamID().ConvertToUint64(); } STEAMAPI_API bool SteamAPI_ISteamGameServer_WasRestartRequested( ISteamGameServer* self ) { - return self->WasRestartRequested(); + return get_steam_client()->steam_gameserver->WasRestartRequested(); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetMaxPlayerCount( ISteamGameServer* self, int cPlayersMax ) { - return self->SetMaxPlayerCount(cPlayersMax); + return get_steam_client()->steam_gameserver->SetMaxPlayerCount(cPlayersMax); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetBotPlayerCount( ISteamGameServer* self, int cBotplayers ) { - return self->SetBotPlayerCount(cBotplayers); + return get_steam_client()->steam_gameserver->SetBotPlayerCount(cBotplayers); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetServerName( ISteamGameServer* self, const char * pszServerName ) { - return self->SetServerName(pszServerName); + return get_steam_client()->steam_gameserver->SetServerName(pszServerName); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetMapName( ISteamGameServer* self, const char * pszMapName ) { - return self->SetMapName(pszMapName); + return get_steam_client()->steam_gameserver->SetMapName(pszMapName); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetPasswordProtected( ISteamGameServer* self, bool bPasswordProtected ) { - return self->SetPasswordProtected(bPasswordProtected); + return get_steam_client()->steam_gameserver->SetPasswordProtected(bPasswordProtected); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetSpectatorPort( ISteamGameServer* self, uint16 unSpectatorPort ) { - return self->SetSpectatorPort(unSpectatorPort); + return get_steam_client()->steam_gameserver->SetSpectatorPort(unSpectatorPort); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetSpectatorServerName( ISteamGameServer* self, const char * pszSpectatorServerName ) { - return self->SetSpectatorServerName(pszSpectatorServerName); + return get_steam_client()->steam_gameserver->SetSpectatorServerName(pszSpectatorServerName); } STEAMAPI_API void SteamAPI_ISteamGameServer_ClearAllKeyValues( ISteamGameServer* self ) { - return self->ClearAllKeyValues(); + return get_steam_client()->steam_gameserver->ClearAllKeyValues(); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetKeyValue( ISteamGameServer* self, const char * pKey, const char * pValue ) { - return self->SetKeyValue(pKey, pValue); + return get_steam_client()->steam_gameserver->SetKeyValue(pKey, pValue); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetGameTags( ISteamGameServer* self, const char * pchGameTags ) { - return self->SetGameTags(pchGameTags); + return get_steam_client()->steam_gameserver->SetGameTags(pchGameTags); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetGameData( ISteamGameServer* self, const char * pchGameData ) { - return self->SetGameData(pchGameData); + return get_steam_client()->steam_gameserver->SetGameData(pchGameData); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetRegion( ISteamGameServer* self, const char * pszRegion ) { - return self->SetRegion(pszRegion); + return get_steam_client()->steam_gameserver->SetRegion(pszRegion); } STEAMAPI_API bool SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( ISteamGameServer* self, uint32 unIPClient, const void * pvAuthBlob, uint32 cubAuthBlobSize, CSteamID * pSteamIDUser ) { - return self->SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, pSteamIDUser); + return get_steam_client()->steam_gameserver->SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, pSteamIDUser); +} + +STEAMAPI_API bool SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate_DEPRECATED( ISteamGameServer* self, uint32 unIPClient, const void * pvAuthBlob, uint32 cubAuthBlobSize, CSteamID * pSteamIDUser ) +{ + return get_steam_client()->steam_gameserver->SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, pSteamIDUser); } STEAMAPI_API uint64_steamid SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( ISteamGameServer* self ) { - return self->CreateUnauthenticatedUserConnection().ConvertToUint64(); + return get_steam_client()->steam_gameserver->CreateUnauthenticatedUserConnection().ConvertToUint64(); } STEAMAPI_API void SteamAPI_ISteamGameServer_SendUserDisconnect( ISteamGameServer* self, uint64_steamid steamIDUser ) { - return self->SendUserDisconnect(steamIDUser); + return get_steam_client()->steam_gameserver->SendUserDisconnect(steamIDUser); +} + +STEAMAPI_API void SteamAPI_ISteamGameServer_SendUserDisconnect_DEPRECATED( ISteamGameServer* self, uint64_steamid steamIDUser ) +{ + return get_steam_client()->steam_gameserver->SendUserDisconnect(steamIDUser); } STEAMAPI_API bool SteamAPI_ISteamGameServer_BUpdateUserData( ISteamGameServer* self, uint64_steamid steamIDUser, const char * pchPlayerName, uint32 uScore ) { - return self->BUpdateUserData(steamIDUser, pchPlayerName, uScore); + return get_steam_client()->steam_gameserver->BUpdateUserData(steamIDUser, pchPlayerName, uScore); +} + +STEAMAPI_API void SteamAPI_ISteamGameServer_SetAdvertiseServerActive( ISteamGameServer* self, bool bActive ) +{ + return get_steam_client()->steam_gameserver->SetAdvertiseServerActive(bActive); } STEAMAPI_API HAuthTicket SteamAPI_ISteamGameServer_GetAuthSessionTicket( ISteamGameServer* self, void * pTicket, int cbMaxTicket, uint32 * pcbTicket ) { - return self->GetAuthSessionTicket(pTicket, cbMaxTicket, pcbTicket); + return get_steam_client()->steam_gameserver->GetAuthSessionTicket(pTicket, cbMaxTicket, pcbTicket); } STEAMAPI_API EBeginAuthSessionResult SteamAPI_ISteamGameServer_BeginAuthSession( ISteamGameServer* self, const void * pAuthTicket, int cbAuthTicket, uint64_steamid steamID ) { - return self->BeginAuthSession(pAuthTicket, cbAuthTicket, steamID); + return get_steam_client()->steam_gameserver->BeginAuthSession(pAuthTicket, cbAuthTicket, steamID); } STEAMAPI_API void SteamAPI_ISteamGameServer_EndAuthSession( ISteamGameServer* self, uint64_steamid steamID ) { - return self->EndAuthSession(steamID); + return get_steam_client()->steam_gameserver->EndAuthSession(steamID); } STEAMAPI_API void SteamAPI_ISteamGameServer_CancelAuthTicket( ISteamGameServer* self, HAuthTicket hAuthTicket ) { - return self->CancelAuthTicket(hAuthTicket); + return get_steam_client()->steam_gameserver->CancelAuthTicket(hAuthTicket); } STEAMAPI_API EUserHasLicenseForAppResult SteamAPI_ISteamGameServer_UserHasLicenseForApp( ISteamGameServer* self, uint64_steamid steamID, AppId_t appID ) { - return self->UserHasLicenseForApp(steamID, appID); + return get_steam_client()->steam_gameserver->UserHasLicenseForApp(steamID, appID); } STEAMAPI_API bool SteamAPI_ISteamGameServer_RequestUserGroupStatus( ISteamGameServer* self, uint64_steamid steamIDUser, uint64_steamid steamIDGroup ) { - return self->RequestUserGroupStatus(steamIDUser, steamIDGroup); + return get_steam_client()->steam_gameserver->RequestUserGroupStatus(steamIDUser, steamIDGroup); } STEAMAPI_API void SteamAPI_ISteamGameServer_GetGameplayStats( ISteamGameServer* self ) { - return self->GetGameplayStats(); + return get_steam_client()->steam_gameserver->GetGameplayStats(); } STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation( ISteamGameServer* self ) { - return self->GetServerReputation(); + return get_steam_client()->steam_gameserver->GetServerReputation(); } STEAMAPI_API void *SteamAPI_ISteamGameServer_GetPublicIP( intptr_t instancePtr, void *instancePtr_possible ) @@ -5872,37 +6095,37 @@ STEAMAPI_API void *SteamAPI_ISteamGameServer_GetPublicIP( intptr_t instancePtr, STEAMAPI_API bool SteamAPI_ISteamGameServer_HandleIncomingPacket( ISteamGameServer* self, const void * pData, int cbData, uint32 srcIP, uint16 srcPort ) { - return self->HandleIncomingPacket(pData, cbData, srcIP, srcPort); + return get_steam_client()->steam_gameserver->HandleIncomingPacket(pData, cbData, srcIP, srcPort); } STEAMAPI_API int SteamAPI_ISteamGameServer_GetNextOutgoingPacket( ISteamGameServer* self, void * pOut, int cbMaxOut, uint32 * pNetAdr, uint16 * pPort ) { - return self->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort); + return get_steam_client()->steam_gameserver->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort); } STEAMAPI_API void SteamAPI_ISteamGameServer_EnableHeartbeats( ISteamGameServer* self, bool bActive ) { - return self->EnableHeartbeats(bActive); + return get_steam_client()->steam_gameserver->EnableHeartbeats(bActive); } STEAMAPI_API void SteamAPI_ISteamGameServer_SetHeartbeatInterval( ISteamGameServer* self, int iHeartbeatInterval ) { - return self->SetHeartbeatInterval(iHeartbeatInterval); + return get_steam_client()->steam_gameserver->SetHeartbeatInterval(iHeartbeatInterval); } STEAMAPI_API void SteamAPI_ISteamGameServer_ForceHeartbeat( ISteamGameServer* self ) { - return self->ForceHeartbeat(); + return get_steam_client()->steam_gameserver->ForceHeartbeat(); } STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_AssociateWithClan( ISteamGameServer* self, uint64_steamid steamIDClan ) { - return self->AssociateWithClan(steamIDClan); + return get_steam_client()->steam_gameserver->AssociateWithClan(steamIDClan); } STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( ISteamGameServer* self, uint64_steamid steamIDNewPlayer ) { - return self->ComputeNewPlayerCompatibility(steamIDNewPlayer); + return get_steam_client()->steam_gameserver->ComputeNewPlayerCompatibility(steamIDNewPlayer); } STEAMAPI_API ISteamGameServerStats *SteamAPI_SteamGameServerStats_v001() diff --git a/dll/local_storage.cpp b/dll/local_storage.cpp index 5448e73..9ae0a6b 100644 --- a/dll/local_storage.cpp +++ b/dll/local_storage.cpp @@ -434,7 +434,7 @@ std::string Local_Storage::get_user_appdata_path() } } #endif - return user_appdata_path.append(PATH_SEPARATOR).append(PROGRAM_NAME).append(" Saves"); + return user_appdata_path.append(PATH_SEPARATOR).append(PROGRAM_NAME_1).append(PROGRAM_NAME_2).append(PROGRAM_NAME_3).append(PROGRAM_NAME_4).append(PROGRAM_NAME_5).append(PROGRAM_NAME_6).append(PROGRAM_NAME_7).append(PROGRAM_NAME_8).append(" Saves"); } static std::string replace_with(std::string s, std::string const &old, const char *new_str) diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index 3cc395b..ed523bf 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -304,6 +304,8 @@ ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSte return (ISteamGameServer *)(void *)(ISteamGameServer011 *)steam_gameserver; } else if (strcmp(pchVersion, "SteamGameServer012") == 0) { return (ISteamGameServer *)(void *)(ISteamGameServer012 *)steam_gameserver; + } else if (strcmp(pchVersion, "SteamGameServer013") == 0) { + return (ISteamGameServer *)(void *)(ISteamGameServer013 *)steam_gameserver; } else if (strcmp(pchVersion, STEAMGAMESERVER_INTERFACE_VERSION) == 0) { gameserver_has_ipv6_functions = true; return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver; @@ -481,8 +483,10 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe return (void *)(ISteamNetworkingSocketsSerialized003 *)steam_networking_sockets_serialized_temp; } else if (strcmp(pchVersion, "SteamNetworkingSocketsSerialized004") == 0) { return (void *)(ISteamNetworkingSocketsSerialized004 *)steam_networking_sockets_serialized_temp; + } else if (strcmp(pchVersion, "SteamNetworkingSocketsSerialized005") == 0) { + return (void *)(ISteamNetworkingSocketsSerialized005 *)steam_networking_sockets_serialized_temp; } else { - return (void *)(ISteamNetworkingSocketsSerialized004 *)steam_networking_sockets_serialized_temp; + return (void *)(ISteamNetworkingSocketsSerialized005 *)steam_networking_sockets_serialized_temp; } } else if (strstr(pchVersion, "SteamNetworkingSockets") == pchVersion) { Steam_Networking_Sockets *steam_networking_sockets_temp; @@ -504,6 +508,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe return (void *)(ISteamNetworkingSockets006 *) steam_networking_sockets_temp; } else if (strcmp(pchVersion, "SteamNetworkingSockets008") == 0) { return (void *)(ISteamNetworkingSockets008 *) steam_networking_sockets_temp; + } else if (strcmp(pchVersion, "SteamNetworkingSockets009") == 0) { + return (void *)(ISteamNetworkingSockets009 *) steam_networking_sockets_temp; } else { return (void *)(ISteamNetworkingSockets *) steam_networking_sockets_temp; } @@ -746,6 +752,8 @@ ISteamRemoteStorage *Steam_Client::GetISteamRemoteStorage( HSteamUser hSteamuser return (ISteamRemoteStorage *)(void *)(ISteamRemoteStorage012 *)steam_remote_storage; } else if (strcmp(pchVersion, "STEAMREMOTESTORAGE_INTERFACE_VERSION013") == 0) { return (ISteamRemoteStorage *)(void *)(ISteamRemoteStorage013 *)steam_remote_storage; + } else if (strcmp(pchVersion, "STEAMREMOTESTORAGE_INTERFACE_VERSION014") == 0) { + return (ISteamRemoteStorage *)(void *)(ISteamRemoteStorage014 *)steam_remote_storage; } else if (strcmp(pchVersion, STEAMREMOTESTORAGE_INTERFACE_VERSION) == 0) { return (ISteamRemoteStorage *)(void *)(ISteamRemoteStorage *)steam_remote_storage; } else { @@ -1086,6 +1094,8 @@ ISteamInput *Steam_Client::GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSt if (strcmp(pchVersion, "SteamInput001") == 0) { return (ISteamInput *)(void *)(ISteamInput001 *)steam_controller; + } else if (strcmp(pchVersion, "SteamInput002") == 0) { + return (ISteamInput *)(void *)(ISteamInput002 *)steam_controller; } else if (strcmp(pchVersion, STEAMINPUT_INTERFACE_VERSION) == 0) { return (ISteamInput *)(void *)(ISteamInput *)steam_controller; } else { diff --git a/dll/steam_controller.h b/dll/steam_controller.h index 88ad5db..f763b71 100644 --- a/dll/steam_controller.h +++ b/dll/steam_controller.h @@ -101,6 +101,7 @@ public ISteamController006, public ISteamController007, public ISteamController, public ISteamInput001, +public ISteamInput002, public ISteamInput { class Settings *settings; @@ -164,6 +165,7 @@ public ISteamInput bool disabled; bool initialized; + bool explicitly_call_run_frame; void set_handles(std::map, std::string>>> action_sets) { uint64 handle_num = 1; @@ -316,9 +318,9 @@ Steam_Controller(class Settings *settings, class SteamCallResults *callback_resu } // Init and Shutdown must be called when starting/ending use of this interface -bool Init() +bool Init(bool bExplicitlyCallRunFrame) { - PRINT_DEBUG("Steam_Controller::Init()\n"); + PRINT_DEBUG("Steam_Controller::Init() %u\n", bExplicitlyCallRunFrame); std::lock_guard lock(global_mutex); if (disabled || initialized) { return true; @@ -342,6 +344,7 @@ bool Init() background_rumble_thread = std::thread(background_rumble, rumble_thread_data); initialized = true; + explicitly_call_run_frame = bExplicitlyCallRunFrame; return true; } @@ -351,6 +354,11 @@ bool Init( const char *pchAbsolutePathToControllerConfigVDF ) return Init(); } +bool Init() +{ + return Init(true); +} + bool Shutdown() { PRINT_DEBUG("Steam_Controller::Shutdown()\n"); @@ -374,10 +382,57 @@ void SetOverrideMode( const char *pchMode ) PRINT_DEBUG("Steam_Controller::SetOverrideMode\n"); } +// Set the absolute path to the Input Action Manifest file containing the in-game actions +// and file paths to the official configurations. Used in games that bundle Steam Input +// configurations inside of the game depot instead of using the Steam Workshop +bool SetInputActionManifestFilePath( const char *pchInputActionManifestAbsolutePath ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return false; +} + +bool BWaitForData( bool bWaitForever, uint32 unTimeout ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return false; +} + +// Returns true if new data has been received since the last time action data was accessed +// via GetDigitalActionData or GetAnalogActionData. The game will still need to call +// SteamInput()->RunFrame() or SteamAPI_RunCallbacks() before this to update the data stream +bool BNewDataAvailable() +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return false; +} + +// Enable SteamInputDeviceConnected_t and SteamInputDeviceDisconnected_t callbacks. +// Each controller that is already connected will generate a device connected +// callback when you enable them +void EnableDeviceCallbacks() +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return; +} + +// Enable SteamInputActionEvent_t callbacks. Directly calls your callback function +// for lower latency than standard Steam callbacks. Supports one callback at a time. +// Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks +void EnableActionEventCallbacks( SteamInputActionEventCallbackPointer pCallback ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return; +} + // Synchronize API state with the latest Steam Controller inputs available. This // is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest // possible latency, you call this directly before reading controller state. -void RunFrame() +void RunFrame(bool bReservedValue) { PRINT_DEBUG("Steam_Controller::RunFrame()\n"); if (disabled || !initialized) { @@ -387,6 +442,11 @@ void RunFrame() GamepadUpdate(); } +void RunFrame() +{ + RunFrame(true); +} + bool GetControllerState( uint32 unControllerIndex, SteamControllerState001_t *pState ) { PRINT_DEBUG("Steam_Controller::GetControllerState()\n"); @@ -686,6 +746,14 @@ int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t a return count; } +// Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle +const char *GetStringForDigitalActionName( InputDigitalActionHandle_t eActionHandle ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return "Button String"; +} + // Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls. ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) { @@ -824,6 +892,13 @@ void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPa PRINT_DEBUG("Steam_Controller::TriggerHapticPulse\n"); } +// Trigger a haptic pulse on a controller +void Legacy_TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + TriggerHapticPulse(inputHandle, eTargetPad, usDurationMicroSec ); +} + void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) { PRINT_DEBUG("Steam_Controller::TriggerHapticPulse old\n"); @@ -837,6 +912,18 @@ void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamCont PRINT_DEBUG("Steam_Controller::TriggerRepeatedHapticPulse\n"); } +void Legacy_TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + TriggerRepeatedHapticPulse(inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); +} + + +// Send a haptic pulse, works on Steam Deck and Steam Controller devices +void TriggerSimpleHapticEvent( InputHandle_t inputHandle, EControllerHapticLocation eHapticLocation, uint8 nIntensity, char nGainDB, uint8 nOtherIntensity, char nOtherGainDB ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); +} // Tigger a vibration event on supported controllers. void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) @@ -862,6 +949,13 @@ void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLef rumble_thread_data->rumble_thread_cv.notify_one(); } +// Trigger a vibration event on supported controllers including Xbox trigger impulse rumble - Steam will translate these commands into haptic pulses for Steam Controllers +void TriggerVibrationExtended( InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed, unsigned short usLeftTriggerSpeed, unsigned short usRightTriggerSpeed ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + TriggerVibration(inputHandle, usLeftSpeed, usRightSpeed); + //TODO trigger impulse rumbles +} // Set the controller LED color on supported controllers. void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) @@ -929,6 +1023,13 @@ const char *GetStringForActionOrigin( EInputActionOrigin eOrigin ) return "Button String"; } +// Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle +const char *GetStringForAnalogActionName( InputAnalogActionHandle_t eActionHandle ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return "Button String"; +} // Get a local path to art for on-screen glyph for a particular origin const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) @@ -1015,6 +1116,29 @@ const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) return glyph->second.c_str(); } +// Get a local path to a PNG file for the provided origin's glyph. +const char *GetGlyphPNGForActionOrigin( EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return ""; +} + +// Get a local path to a SVG file for the provided origin's glyph. +const char *GetGlyphSVGForActionOrigin( EInputActionOrigin eOrigin, uint32 unFlags ) +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + //TODO SteamInput005 + return ""; +} + +// Get a local path to an older, Big Picture Mode-style PNG file for a particular origin +const char *GetGlyphForActionOrigin_Legacy( EInputActionOrigin eOrigin ) +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return GetGlyphForActionOrigin(eOrigin); +} + // Returns the input type for a particular handle ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle ) { @@ -1078,9 +1202,19 @@ uint32 GetRemotePlaySessionID( InputHandle_t inputHandle ) return 0; } +// Get a bitmask of the Steam Input Configuration types opted in for the current session. Returns ESteamInputConfigurationEnableType values.? +// Note: user can override the settings from the Steamworks Partner site so the returned values may not exactly match your default configuration +uint16 GetSessionInputConfigurationSettings() +{ + PRINT_DEBUG("TODO %s\n", __FUNCTION__); + return 0; +} + void RunCallbacks() { - RunFrame(); + if (explicitly_call_run_frame) { + RunFrame(); + } } }; diff --git a/dll/steam_gameserver.cpp b/dll/steam_gameserver.cpp index 584f369..54b80b1 100644 --- a/dll/steam_gameserver.cpp +++ b/dll/steam_gameserver.cpp @@ -618,6 +618,19 @@ void Steam_GameServer::EnableHeartbeats( bool bActive ) PRINT_DEBUG("EnableHeartbeats\n"); } +/// Indicate whether you wish to be listed on the master server list +/// and/or respond to server browser / LAN discovery packets. +/// The server starts with this value set to false. You should set all +/// relevant server parameters before enabling advertisement on the server. +/// +/// (This function used to be named EnableHeartbeats, so if you are wondering +/// where that function went, it's right here. It does the same thing as before, +/// the old name was just confusing.) +void Steam_GameServer::SetAdvertiseServerActive( bool bActive ) +{ + PRINT_DEBUG("SetAdvertiseServerActive\n"); + EnableHeartbeats(bActive); +} // You usually don't need to modify this. // Pass -1 to use the default value for iHeartbeatInterval. @@ -627,6 +640,11 @@ void Steam_GameServer::SetHeartbeatInterval( int iHeartbeatInterval ) PRINT_DEBUG("SetHeartbeatInterval\n"); } +void Steam_GameServer::SetMasterServerHeartbeatInterval_DEPRECATED( int iHeartbeatInterval ) +{ + PRINT_DEBUG("SetMasterServerHeartbeatInterval_DEPRECATED\n"); +} + // Force a heartbeat to steam at the next opportunity void Steam_GameServer::ForceHeartbeat() @@ -634,6 +652,11 @@ void Steam_GameServer::ForceHeartbeat() PRINT_DEBUG("ForceHeartbeat\n"); } +void Steam_GameServer::ForceMasterServerHeartbeat_DEPRECATED() +{ + PRINT_DEBUG("ForceMasterServerHeartbeat_DEPRECATED\n"); +} + // associate this game server with this clan for the purposes of computing player compat STEAM_CALL_RESULT( AssociateWithClanResult_t ) diff --git a/dll/steam_gameserver.h b/dll/steam_gameserver.h index e66f3b9..7268d30 100644 --- a/dll/steam_gameserver.h +++ b/dll/steam_gameserver.h @@ -35,6 +35,7 @@ public ISteamGameServer009, public ISteamGameServer010, public ISteamGameServer011, public ISteamGameServer012, +public ISteamGameServer013, public ISteamGameServer { class Settings *settings; @@ -311,6 +312,16 @@ public: // you want it to be active (default: off). void EnableHeartbeats( bool bActive ); + /// Indicate whether you wish to be listed on the master server list + /// and/or respond to server browser / LAN discovery packets. + /// The server starts with this value set to false. You should set all + /// relevant server parameters before enabling advertisement on the server. + /// + /// (This function used to be named EnableHeartbeats, so if you are wondering + /// where that function went, it's right here. It does the same thing as before, + /// the old name was just confusing.) + void SetAdvertiseServerActive( bool bActive ); + // You usually don't need to modify this. // Pass -1 to use the default value for iHeartbeatInterval. // Some mods change this. @@ -319,6 +330,9 @@ public: // Force a heartbeat to steam at the next opportunity void ForceHeartbeat(); + void SetMasterServerHeartbeatInterval_DEPRECATED( int iHeartbeatInterval ); + void ForceMasterServerHeartbeat_DEPRECATED(); + // associate this game server with this clan for the purposes of computing player compat STEAM_CALL_RESULT( AssociateWithClanResult_t ) SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ); diff --git a/dll/steam_networking_sockets.h b/dll/steam_networking_sockets.h index 7550413..a0ba19c 100644 --- a/dll/steam_networking_sockets.h +++ b/dll/steam_networking_sockets.h @@ -58,6 +58,7 @@ public ISteamNetworkingSockets003, public ISteamNetworkingSockets004, public ISteamNetworkingSockets006, public ISteamNetworkingSockets008, +public ISteamNetworkingSockets009, public ISteamNetworkingSockets { class Settings *settings; diff --git a/dll/steam_networking_socketsserialized.h b/dll/steam_networking_socketsserialized.h index 327d59b..8b55292 100644 --- a/dll/steam_networking_socketsserialized.h +++ b/dll/steam_networking_socketsserialized.h @@ -20,7 +20,8 @@ class Steam_Networking_Sockets_Serialized : public ISteamNetworkingSocketsSerialized002, public ISteamNetworkingSocketsSerialized003, -public ISteamNetworkingSocketsSerialized004 +public ISteamNetworkingSocketsSerialized004, +public ISteamNetworkingSocketsSerialized005 { class Settings *settings; class Networking *network; @@ -129,6 +130,12 @@ bool BAllowDirectConnectToPeer(SteamNetworkingIdentity const &identity) return true; } +int BeginAsyncRequestFakeIP(int a) +{ + PRINT_DEBUG("Steam_Networking_Sockets_Serialized::BeginAsyncRequestFakeIP\n"); + return true; +} + void RunCallbacks() { } diff --git a/dll/steam_remote_storage.h b/dll/steam_remote_storage.h index d393c94..032bc5f 100644 --- a/dll/steam_remote_storage.h +++ b/dll/steam_remote_storage.h @@ -50,6 +50,7 @@ public ISteamRemoteStorage010, public ISteamRemoteStorage011, public ISteamRemoteStorage012, public ISteamRemoteStorage013, +public ISteamRemoteStorage014, public ISteamRemoteStorage { private: @@ -761,4 +762,32 @@ SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocat return 0; } +// Cloud dynamic state change notification +int32 GetLocalFileChangeCount() +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return 0; +} + +const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType ) +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return ""; +} + +// Indicate to Steam the beginning / end of a set of local file +// operations - for example, writing a game save that requires updating two files. +bool BeginFileWriteBatch() +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return true; +} + +bool EndFileWriteBatch() +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return true; +} + + }; diff --git a/dll/steam_ugc.h b/dll/steam_ugc.h index 3786c36..28e4dba 100644 --- a/dll/steam_ugc.h +++ b/dll/steam_ugc.h @@ -203,6 +203,7 @@ bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint32 index, uint32 in bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) { PRINT_DEBUG("Steam_UGC::GetQueryUGCPreviewURL\n"); + //TODO: escape simulator tries downloading this url and unsubscribes if it fails return false; } @@ -856,4 +857,20 @@ SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) return 0; } +// Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not +bool ShowWorkshopEULA() +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return false; +} + +// Retrieve information related to the user's acceptance or not of the app's specific Workshop EULA +STEAM_CALL_RESULT( WorkshopEULAStatus_t ) +SteamAPICall_t GetWorkshopEULAStatus() +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return 0; +} + + }; diff --git a/dll/steam_utils.h b/dll/steam_utils.h index ce76e8c..b59fdd4 100644 --- a/dll/steam_utils.h +++ b/dll/steam_utils.h @@ -405,4 +405,31 @@ ESteamIPv6ConnectivityState GetIPv6ConnectivityState( ESteamIPv6ConnectivityProt return k_ESteamIPv6ConnectivityState_Unknown; } +// returns true if currently running on the Steam Deck device +bool IsSteamRunningOnSteamDeck() +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return false; +} + +// Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game. +// The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field +bool ShowFloatingGamepadTextInput( EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight ) +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return false; +} + +// In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher +void SetGameLauncherMode( bool bLauncherMode ) +{ + PRINT_DEBUG("%s\n", __FUNCTION__); +} + +bool DismissFloatingGamepadTextInput() +{ + PRINT_DEBUG("%s\n", __FUNCTION__); + return true; +} + }; diff --git a/sdk_includes/isteamapplist.h b/sdk_includes/isteamapplist.h index 3c5b0e1..ffe2618 100644 --- a/sdk_includes/isteamapplist.h +++ b/sdk_includes/isteamapplist.h @@ -11,7 +11,6 @@ #endif #include "steam_api_common.h" -#include "steamtypes.h" //----------------------------------------------------------------------------- // Purpose: This is a restricted interface that can only be used by previously approved apps, @@ -52,16 +51,18 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamAppList *, SteamAppList, STEAMAPPLIS // Purpose: Sent when a new app is installed //--------------------------------------------------------------------------------- STEAM_CALLBACK_BEGIN( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 ) - STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs -STEAM_CALLBACK_END(1) +STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +STEAM_CALLBACK_MEMBER( 1, int, m_iInstallFolderIndex ) // library folder the app is installed +STEAM_CALLBACK_END( 2 ) //--------------------------------------------------------------------------------- // Purpose: Sent when an app is uninstalled //--------------------------------------------------------------------------------- STEAM_CALLBACK_BEGIN( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 ) - STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs -STEAM_CALLBACK_END(1) +STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +STEAM_CALLBACK_MEMBER( 1, int, m_iInstallFolderIndex ) // library folder the app was installed +STEAM_CALLBACK_END(2) #pragma pack( pop ) diff --git a/sdk_includes/isteamcontroller.h b/sdk_includes/isteamcontroller.h index 4191f58..985c046 100644 --- a/sdk_includes/isteamcontroller.h +++ b/sdk_includes/isteamcontroller.h @@ -410,6 +410,11 @@ enum EControllerActionOrigin k_EControllerActionOrigin_PS5_Gyro_Yaw, k_EControllerActionOrigin_PS5_Gyro_Roll, + k_EControllerActionOrigin_XBoxOne_LeftGrip_Lower, + k_EControllerActionOrigin_XBoxOne_LeftGrip_Upper, + k_EControllerActionOrigin_XBoxOne_RightGrip_Lower, + k_EControllerActionOrigin_XBoxOne_RightGrip_Upper, + k_EControllerActionOrigin_XBoxOne_Share, 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. @@ -635,7 +640,7 @@ public: virtual void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) = 0; //----------------------------------------------------------------------------- - // Utility functions availible without using the rest of Steam Input API + // Utility functions available without using the rest of Steam Input API //----------------------------------------------------------------------------- // Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode diff --git a/sdk_includes/isteamgameserver.h b/sdk_includes/isteamgameserver.h index bfc55ae..6f0444e 100644 --- a/sdk_includes/isteamgameserver.h +++ b/sdk_includes/isteamgameserver.h @@ -91,14 +91,23 @@ public: /// Set name of map to report in the server browser /// - /// @see k_cbMaxGameServerName + /// @see k_cbMaxGameServerMapName virtual void SetMapName( const char *pszMapName ) = 0; /// Let people know if your server will require a password virtual void SetPasswordProtected( bool bPasswordProtected ) = 0; - /// Spectator server. The default value is zero, meaning the service - /// is not used. + /// Spectator server port to advertise. The default value is zero, meaning the + /// service is not used. If your server receives any info requests on the LAN, + /// this is the value that will be placed into the reply for such local queries. + /// + /// This is also the value that will be advertised by the master server. + /// The only exception is if your server is using a FakeIP. Then then the second + /// fake port number (index 1) assigned to your server will be listed on the master + /// server as the spectator port, if you set this value to any nonzero value. + /// + /// This function merely controls the values that are advertised -- it's up to you to + /// configure the server to actually listen on this port and handle any spectator traffic virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0; /// Name of the spectator server. (Only used if spectator port is nonzero.) @@ -120,8 +129,6 @@ public: /// Sets a string defining the "gamedata" for this server, this is optional, but if it is set /// it allows users to filter in the matchmaking/server-browser interfaces based on the value - /// don't set this unless it actually changes, its only uploaded to the master once (when - /// acknowledged) /// /// @see k_cbMaxGameServerGameData virtual void SetGameData( const char *pchGameData ) = 0; @@ -129,42 +136,20 @@ public: /// Region identifier. This is an optional field, the default value is empty, meaning the "world" region virtual void SetRegion( const char *pszRegion ) = 0; + /// Indicate whether you wish to be listed on the master server list + /// and/or respond to server browser / LAN discovery packets. + /// The server starts with this value set to false. You should set all + /// relevant server parameters before enabling advertisement on the server. + /// + /// (This function used to be named EnableHeartbeats, so if you are wondering + /// where that function went, it's right here. It does the same thing as before, + /// the old name was just confusing.) + virtual void SetAdvertiseServerActive( bool bActive ) = 0; + // -// Player list management / authentication +// Player list management / authentication. // - // Handles receiving a new connection from a Steam user. This call will ask the Steam - // servers to validate the users identity, app ownership, and VAC status. If the Steam servers - // are off-line, then it will validate the cached ticket itself which will validate app ownership - // and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection() - // and must then be sent up to the game server for authentication. - // - // Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL - // If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication - // for the user has succeeded or failed (the steamid in the callback will match the one returned by this call) - virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0; - - // Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation. - // - // Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect() - // when this user leaves the server just like you would for a real user. - virtual CSteamID CreateUnauthenticatedUserConnection() = 0; - - // Should be called whenever a user leaves our game server, this lets Steam internally - // track which users are currently on which servers for the purposes of preventing a single - // account being logged into multiple servers, showing who is currently on a server, etc. - virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0; - - // Update the data to be displayed in the server browser and matchmaking interfaces for a user - // currently connected to the server. For regular users you must call this after you receive a - // GSUserValidationSuccess callback. - // - // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player) - virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0; - - // New auth system APIs - do not mix with the old auth system APIs. - // ---------------------------------------------------------------- - // Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ). // pcbTicket retrieves the length of the actual ticket. virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; @@ -199,13 +184,10 @@ public: // connect to virtual SteamIPAddress_t GetPublicIP() = 0; -// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own -// socket to talk to the master server on, it lets the game use its socket to forward messages -// back and forth. This prevents us from requiring server ops to open up yet another port -// in their firewalls. -// -// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001 - +// Server browser related query packet processing for shared socket mode. These are used +// when you pass STEAMGAMESERVER_QUERY_PORT_SHARED as the query port to SteamGameServer_Init. +// IP address and port are in host order, i.e 127.0.0.1 == 0x7f000001 + // These are used when you've elected to multiplex the game server's UDP socket // rather than having the master server updater use its own sockets. // @@ -223,21 +205,9 @@ public: virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0; // -// Control heartbeats / advertisement with master server +// Server clan association // - // Call this as often as you like to tell the master server updater whether or not - // you want it to be active (default: off). - virtual void EnableHeartbeats( bool bActive ) = 0; - - // You usually don't need to modify this. - // Pass -1 to use the default value for iHeartbeatInterval. - // Some mods change this. - virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0; - - // Force a heartbeat to steam at the next opportunity - virtual void ForceHeartbeat() = 0; - // associate this game server with this clan for the purposes of computing player compat STEAM_CALL_RESULT( AssociateWithClanResult_t ) virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0; @@ -246,9 +216,57 @@ public: STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t ) virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0; + + + + // Handles receiving a new connection from a Steam user. This call will ask the Steam + // servers to validate the users identity, app ownership, and VAC status. If the Steam servers + // are off-line, then it will validate the cached ticket itself which will validate app ownership + // and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection() + // and must then be sent up to the game server for authentication. + // + // Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL + // If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication + // for the user has succeeded or failed (the steamid in the callback will match the one returned by this call) + // + // DEPRECATED! This function will be removed from the SDK in an upcoming version. + // Please migrate to BeginAuthSession and related functions. + //virtual bool SendUserConnectAndAuthenticate_DEPRECATED( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0; + virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0; + + // Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation. + // + // Return Value: Returns a SteamID for the user to be tracked with, you should call EndAuthSession() + // when this user leaves the server just like you would for a real user. + virtual CSteamID CreateUnauthenticatedUserConnection() = 0; + + // Should be called whenever a user leaves our game server, this lets Steam internally + // track which users are currently on which servers for the purposes of preventing a single + // account being logged into multiple servers, showing who is currently on a server, etc. + // + // DEPRECATED! This function will be removed from the SDK in an upcoming version. + // Please migrate to BeginAuthSession and related functions. + //virtual void SendUserDisconnect_DEPRECATED( CSteamID steamIDUser ) = 0; + virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0; + + // Update the data to be displayed in the server browser and matchmaking interfaces for a user + // currently connected to the server. For regular users you must call this after you receive a + // GSUserValidationSuccess callback. + // + // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player) + virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0; + +// Deprecated functions. These will be removed in a future version of the SDK. +// If you really need these, please contact us and help us understand what you are +// using them for. + + STEAM_PRIVATE_API( + virtual void SetMasterServerHeartbeatInterval_DEPRECATED( int iHeartbeatInterval ) = 0; + virtual void ForceMasterServerHeartbeat_DEPRECATED() = 0; + ) }; -#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer013" +#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer014" #ifndef STEAM_API_EXPORTS // Global accessor diff --git a/sdk_includes/isteamgameserver013.h b/sdk_includes/isteamgameserver013.h new file mode 100644 index 0000000..fdd7711 --- /dev/null +++ b/sdk_includes/isteamgameserver013.h @@ -0,0 +1,240 @@ + +#ifndef ISTEAMGAMESERVER013_H +#define ISTEAMGAMESERVER013_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamGameServer013 +{ +public: +// +// Basic server data. These properties, if set, must be set before before calling LogOn. They +// may not be changed after logged in. +// + + /// This is called by SteamGameServer_Init, and you will usually not need to call it directly + STEAM_PRIVATE_API( virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; ) + + /// Game product identifier. This is currently used by the master server for version checking purposes. + /// It's a required field, but will eventually will go away, and the AppID will be used for this purpose. + virtual void SetProduct( const char *pszProduct ) = 0; + + /// Description of the game. This is a required field and is displayed in the steam server browser....for now. + /// This is a required field, but it will go away eventually, as the data should be determined from the AppID. + virtual void SetGameDescription( const char *pszGameDescription ) = 0; + + /// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning + /// this application is the original game, not a mod. + /// + /// @see k_cbMaxGameServerGameDir + virtual void SetModDir( const char *pszModDir ) = 0; + + /// Is this is a dedicated server? The default value is false. + virtual void SetDedicatedServer( bool bDedicated ) = 0; + +// +// Login +// + + /// Begin process to login to a persistent game server account + /// + /// You need to register for callbacks to determine the result of this operation. + /// @see SteamServersConnected_t + /// @see SteamServerConnectFailure_t + /// @see SteamServersDisconnected_t + virtual void LogOn( const char *pszToken ) = 0; + + /// Login to a generic, anonymous account. + /// + /// Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init, + /// but this is no longer the case. + virtual void LogOnAnonymous() = 0; + + /// Begin process of logging game server out of steam + virtual void LogOff() = 0; + + // status functions + virtual bool BLoggedOn() = 0; + virtual bool BSecure() = 0; + virtual CSteamID GetSteamID() = 0; + + /// Returns true if the master server has requested a restart. + /// Only returns true once per request. + virtual bool WasRestartRequested() = 0; + +// +// Server state. These properties may be changed at any time. +// + + /// Max player count that will be reported to server browser and client queries + virtual void SetMaxPlayerCount( int cPlayersMax ) = 0; + + /// Number of bots. Default value is zero + virtual void SetBotPlayerCount( int cBotplayers ) = 0; + + /// Set the name of server as it will appear in the server browser + /// + /// @see k_cbMaxGameServerName + virtual void SetServerName( const char *pszServerName ) = 0; + + /// Set name of map to report in the server browser + /// + /// @see k_cbMaxGameServerName + virtual void SetMapName( const char *pszMapName ) = 0; + + /// Let people know if your server will require a password + virtual void SetPasswordProtected( bool bPasswordProtected ) = 0; + + /// Spectator server. The default value is zero, meaning the service + /// is not used. + virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0; + + /// Name of the spectator server. (Only used if spectator port is nonzero.) + /// + /// @see k_cbMaxGameServerMapName + virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0; + + /// Call this to clear the whole list of key/values that are sent in rules queries. + virtual void ClearAllKeyValues() = 0; + + /// Call this to add/update a key/value pair. + virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0; + + /// Sets a string defining the "gametags" for this server, this is optional, but if it is set + /// it allows users to filter in the matchmaking/server-browser interfaces based on the value + /// + /// @see k_cbMaxGameServerTags + virtual void SetGameTags( const char *pchGameTags ) = 0; + + /// Sets a string defining the "gamedata" for this server, this is optional, but if it is set + /// it allows users to filter in the matchmaking/server-browser interfaces based on the value + /// don't set this unless it actually changes, its only uploaded to the master once (when + /// acknowledged) + /// + /// @see k_cbMaxGameServerGameData + virtual void SetGameData( const char *pchGameData ) = 0; + + /// Region identifier. This is an optional field, the default value is empty, meaning the "world" region + virtual void SetRegion( const char *pszRegion ) = 0; + +// +// Player list management / authentication +// + + // Handles receiving a new connection from a Steam user. This call will ask the Steam + // servers to validate the users identity, app ownership, and VAC status. If the Steam servers + // are off-line, then it will validate the cached ticket itself which will validate app ownership + // and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection() + // and must then be sent up to the game server for authentication. + // + // Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL + // If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication + // for the user has succeeded or failed (the steamid in the callback will match the one returned by this call) + virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0; + + // Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation. + // + // Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect() + // when this user leaves the server just like you would for a real user. + virtual CSteamID CreateUnauthenticatedUserConnection() = 0; + + // Should be called whenever a user leaves our game server, this lets Steam internally + // track which users are currently on which servers for the purposes of preventing a single + // account being logged into multiple servers, showing who is currently on a server, etc. + virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0; + + // Update the data to be displayed in the server browser and matchmaking interfaces for a user + // currently connected to the server. For regular users you must call this after you receive a + // GSUserValidationSuccess callback. + // + // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player) + virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0; + + // New auth system APIs - do not mix with the old auth system APIs. + // ---------------------------------------------------------------- + + // Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ). + // pcbTicket retrieves the length of the actual ticket. + virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; + + // Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused + // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse ) + virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0; + + // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity + virtual void EndAuthSession( CSteamID steamID ) = 0; + + // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to + virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0; + + // After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function + // to determine if the user owns downloadable content specified by the provided AppID. + virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0; + + // Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t + // returns false if we're not connected to the steam servers and thus cannot ask + virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0; + + + // these two functions s are deprecated, and will not return results + // they will be removed in a future version of the SDK + virtual void GetGameplayStats( ) = 0; + STEAM_CALL_RESULT( GSReputation_t ) + virtual SteamAPICall_t GetServerReputation() = 0; + + // 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 SteamIPAddress_t GetPublicIP() = 0; + +// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own +// socket to talk to the master server on, it lets the game use its socket to forward messages +// back and forth. This prevents us from requiring server ops to open up yet another port +// in their firewalls. +// +// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001 + + // These are used when you've elected to multiplex the game server's UDP socket + // rather than having the master server updater use its own sockets. + // + // Source games use this to simplify the job of the server admins, so they + // don't have to open up more ports on their firewalls. + + // Call this when a packet that starts with 0xFFFFFFFF comes in. That means + // it's for us. + virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0; + + // AFTER calling HandleIncomingPacket for any packets that came in that frame, call this. + // This gets a packet that the master server updater needs to send out on UDP. + // It returns the length of the packet it wants to send, or 0 if there are no more packets to send. + // Call this each frame until it returns 0. + virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0; + +// +// Control heartbeats / advertisement with master server +// + + // Call this as often as you like to tell the master server updater whether or not + // you want it to be active (default: off). + virtual void EnableHeartbeats( bool bActive ) = 0; + + // You usually don't need to modify this. + // Pass -1 to use the default value for iHeartbeatInterval. + // Some mods change this. + virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0; + + // Force a heartbeat to steam at the next opportunity + virtual void ForceHeartbeat() = 0; + + // associate this game server with this clan for the purposes of computing player compat + STEAM_CALL_RESULT( AssociateWithClanResult_t ) + virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0; + + // ask if any of the current players dont want to play with this new player - or vice versa + STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t ) + virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0; + +}; + +#endif // ISTEAMGAMESERVER013_H diff --git a/sdk_includes/isteamhtmlsurface.h b/sdk_includes/isteamhtmlsurface.h index 9e53c9c..54058cd 100644 --- a/sdk_includes/isteamhtmlsurface.h +++ b/sdk_includes/isteamhtmlsurface.h @@ -201,7 +201,6 @@ public: virtual void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) = 0; // You MUST call this in response to a HTML_FileOpenDialog_t callback - STEAM_IGNOREATTR() virtual void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) = 0; }; diff --git a/sdk_includes/isteaminput.h b/sdk_includes/isteaminput.h index 0d1192c..568c778 100644 --- a/sdk_includes/isteaminput.h +++ b/sdk_includes/isteaminput.h @@ -228,11 +228,11 @@ enum EInputActionOrigin k_EInputActionOrigin_XBoxOne_DPad_West, k_EInputActionOrigin_XBoxOne_DPad_East, k_EInputActionOrigin_XBoxOne_DPad_Move, - k_EInputActionOrigin_XBoxOne_Reserved1, - k_EInputActionOrigin_XBoxOne_Reserved2, - k_EInputActionOrigin_XBoxOne_Reserved3, - k_EInputActionOrigin_XBoxOne_Reserved4, - k_EInputActionOrigin_XBoxOne_Reserved5, + k_EInputActionOrigin_XBoxOne_LeftGrip_Lower, + k_EInputActionOrigin_XBoxOne_LeftGrip_Upper, + k_EInputActionOrigin_XBoxOne_RightGrip_Lower, + k_EInputActionOrigin_XBoxOne_RightGrip_Upper, + k_EInputActionOrigin_XBoxOne_Share, // Xbox Series X controllers only k_EInputActionOrigin_XBoxOne_Reserved6, k_EInputActionOrigin_XBoxOne_Reserved7, k_EInputActionOrigin_XBoxOne_Reserved8, @@ -472,6 +472,20 @@ enum ESteamControllerPad k_ESteamControllerPad_Right }; +enum EControllerHapticLocation +{ + k_EControllerHapticLocation_Left = ( 1 << k_ESteamControllerPad_Left ), + k_EControllerHapticLocation_Right = ( 1 << k_ESteamControllerPad_Right ), + k_EControllerHapticLocation_Both = ( 1 << k_ESteamControllerPad_Left | 1 << k_ESteamControllerPad_Right ), +}; + +enum EControllerHapticType +{ + k_EControllerHapticType_Off, + k_EControllerHapticType_Tick, + k_EControllerHapticType_Click, +}; + enum ESteamInputType { k_ESteamInputType_Unknown, @@ -492,6 +506,16 @@ enum ESteamInputType k_ESteamInputType_MaximumPossibleValue = 255, }; +// Individual values are used by the GetSessionInputConfigurationSettings bitmask +enum ESteamInputConfigurationEnableType +{ + k_ESteamInputConfigurationEnableType_None = 0x0000, + k_ESteamInputConfigurationEnableType_Playstation = 0x0001, + k_ESteamInputConfigurationEnableType_Xbox = 0x0002, + k_ESteamInputConfigurationEnableType_Generic = 0x0004, + k_ESteamInputConfigurationEnableType_Switch = 0x0008, +}; + // These values are passed into SetLEDColor enum ESteamInputLEDFlag { @@ -501,11 +525,24 @@ enum ESteamInputLEDFlag k_ESteamInputLEDFlag_RestoreUserDefault }; +// These values are passed into GetGlyphPNGForActionOrigin +enum ESteamInputGlyphSize +{ + k_ESteamInputGlyphSize_Small, + k_ESteamInputGlyphSize_Medium, + k_ESteamInputGlyphSize_Large, +}; + +enum ESteamInputActionEventType +{ + ESteamInputActionEventType_DigitalAction, + ESteamInputActionEventType_AnalogAction, +}; + // InputHandle_t is used to refer to a specific controller. // This handle will consistently identify a controller, even if it is disconnected and re-connected typedef uint64 InputHandle_t; - // These handles are used to refer to a specific in-game action or action set // All action handles should be queried during initialization for performance reasons typedef uint64 InputActionSetHandle_t; @@ -554,8 +591,29 @@ struct InputMotionData_t float rotVelZ; }; +//----------------------------------------------------------------------------- +// Purpose: when callbacks are enabled this fires each time a controller action +// state changes +//----------------------------------------------------------------------------- +struct SteamInputActionEvent_t +{ + InputHandle_t controllerHandle; + ESteamInputActionEventType eEventType; + union { + struct { + InputAnalogActionHandle_t actionHandle; + InputAnalogActionData_t analogActionData; + } analogAction; + struct { + InputDigitalActionHandle_t actionHandle; + InputDigitalActionData_t digitalActionData; + } digitalAction; + }; +}; + #pragma pack( pop ) +typedef void ( *SteamInputActionEventCallbackPointer )( SteamInputActionEvent_t * ); //----------------------------------------------------------------------------- // Purpose: Steam Input API @@ -564,15 +622,33 @@ class ISteamInput { public: - // Init and Shutdown must be called when starting/ending use of this interface - virtual bool Init() = 0; + // Init and Shutdown must be called when starting/ending use of this interface. + // if bExplicitlyCallRunFrame is called then you will need to manually call RunFrame + // each frame, otherwise Steam Input will updated when SteamAPI_RunCallbacks() is called + virtual bool Init( bool bExplicitlyCallRunFrame ) = 0; virtual bool Shutdown() = 0; - // Synchronize API state with the latest Steam Controller inputs available. This + // Set the absolute path to the Input Action Manifest file containing the in-game actions + // and file paths to the official configurations. Used in games that bundle Steam Input + // configurations inside of the game depot instead of using the Steam Workshop + virtual bool SetInputActionManifestFilePath( const char *pchInputActionManifestAbsolutePath ) = 0; + + // Synchronize API state with the latest Steam Input action data available. This // is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest - // possible latency, you call this directly before reading controller state. This must - // be called from somewhere before GetConnectedControllers will return any handles - virtual void RunFrame() = 0; + // possible latency, you call this directly before reading controller state. + // Note: This must be called from somewhere before GetConnectedControllers will + // return any handles + virtual void RunFrame( bool bReservedValue = true ) = 0; + + // Waits on an IPC event from Steam sent when there is new data to be fetched from + // the data drop. Returns true when data was recievied before the timeout expires. + // Useful for games with a dedicated input thread + virtual bool BWaitForData( bool bWaitForever, uint32 unTimeout ) = 0; + + // Returns true if new data has been received since the last time action data was accessed + // via GetDigitalActionData or GetAnalogActionData. The game will still need to call + // SteamInput()->RunFrame() or SteamAPI_RunCallbacks() before this to update the data stream + virtual bool BNewDataAvailable() = 0; // Enumerate currently connected Steam Input enabled devices - developers can opt in controller by type (ex: Xbox/Playstation/etc) via // the Steam Input settings in the Steamworks site or users can opt-in in their controller settings in Steam. @@ -580,6 +656,32 @@ public: // Returns the number of handles written to handlesOut virtual int GetConnectedControllers( STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_COUNT, Receives list of connected controllers ) InputHandle_t *handlesOut ) = 0; + //----------------------------------------------------------------------------- + // CALLBACKS + //----------------------------------------------------------------------------- + + // Controller configuration loaded - these callbacks will always fire if you have + // a handler. Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks + STEAM_CALL_BACK( SteamInputConfigurationLoaded_t ) + + // Enable SteamInputDeviceConnected_t and SteamInputDeviceDisconnected_t callbacks. + // Each controller that is already connected will generate a device connected + // callback when you enable them + virtual void EnableDeviceCallbacks() = 0; + + // Controller Connected - provides info about a single newly connected controller + // Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks + STEAM_CALL_BACK( SteamInputDeviceConnected_t ) + + // Controller Disconnected - provides info about a single disconnected controller + // Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks + STEAM_CALL_BACK( SteamInputDeviceDisconnected_t ) + + // Enable SteamInputActionEvent_t callbacks. Directly calls your callback function + // for lower latency than standard Steam callbacks. Supports one callback at a time. + // Note: this is called within either SteamInput()->RunFrame or by SteamAPI_RunCallbacks + virtual void EnableActionEventCallbacks( SteamInputActionEventCallbackPointer pCallback ) = 0; + //----------------------------------------------------------------------------- // ACTION SETS //----------------------------------------------------------------------------- @@ -597,8 +699,9 @@ 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; + // Enumerate currently active layers. - // handlesOut should point to a STEAM_INPUT_MAX_ACTIVE_LAYERS sized array of ControllerActionSetHandle_t handles + // handlesOut should point to a STEAM_INPUT_MAX_ACTIVE_LAYERS sized array of InputActionSetHandle_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; @@ -617,6 +720,9 @@ public: // the Steam client and will exceed the values from this header, please check bounds if you are using a look up table. virtual int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_ORIGINS, Receives list of action origins ) EInputActionOrigin *originsOut ) = 0; + // Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle + virtual const char *GetStringForDigitalActionName( InputDigitalActionHandle_t eActionHandle ) = 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; @@ -627,13 +733,22 @@ public: // originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to // the Steam client and will exceed the values from this header, please check bounds if you are using a look up table. virtual int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_ORIGINS, Receives list of action origins ) EInputActionOrigin *originsOut ) = 0; - - // Get a local path to art for on-screen glyph for a particular origin - virtual const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) = 0; + + // Get a local path to a PNG file for the provided origin's glyph. + virtual const char *GetGlyphPNGForActionOrigin( EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags ) = 0; + + // Get a local path to a SVG file for the provided origin's glyph. + virtual const char *GetGlyphSVGForActionOrigin( EInputActionOrigin eOrigin, uint32 unFlags ) = 0; + + // Get a local path to an older, Big Picture Mode-style PNG file for a particular origin + virtual const char *GetGlyphForActionOrigin_Legacy( EInputActionOrigin eOrigin ) = 0; // Returns a localized string (from Steam's language setting) for the specified origin. virtual const char *GetStringForActionOrigin( EInputActionOrigin eOrigin ) = 0; + // Returns a localized string (from Steam's language setting) for the user-facing action name corresponding to the specified handle + virtual const char *GetStringForAnalogActionName( InputAnalogActionHandle_t eActionHandle ) = 0; + // Stop analog momentum for the action if it is a mouse action in trackball mode virtual void StopAnalogActionMomentum( InputHandle_t inputHandle, InputAnalogActionHandle_t eAction ) = 0; @@ -647,20 +762,26 @@ public: // Trigger a vibration event on supported controllers - Steam will translate these commands into haptic pulses for Steam Controllers virtual void TriggerVibration( InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) = 0; + // Trigger a vibration event on supported controllers including Xbox trigger impulse rumble - Steam will translate these commands into haptic pulses for Steam Controllers + virtual void TriggerVibrationExtended( InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed, unsigned short usLeftTriggerSpeed, unsigned short usRightTriggerSpeed ) = 0; + + // Send a haptic pulse, works on Steam Deck and Steam Controller devices + virtual void TriggerSimpleHapticEvent( InputHandle_t inputHandle, EControllerHapticLocation eHapticLocation, uint8 nIntensity, char nGainDB, uint8 nOtherIntensity, char nOtherGainDB ) = 0; + // Set the controller LED color on supported controllers. nFlags is a bitmask of values from ESteamInputLEDFlag - 0 will default to setting a color. Steam will handle // the behavior on exit of your program so you don't need to try restore the default as you are shutting down virtual void SetLEDColor( InputHandle_t inputHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) = 0; // Trigger a haptic pulse on a Steam Controller - if you are approximating rumble you may want to use TriggerVibration instead. // Good uses for Haptic pulses include chimes, noises, or directional gameplay feedback (taking damage, footstep locations, etc). - virtual void TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; + virtual void Legacy_TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; // Trigger a haptic pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times. If you are approximating rumble you may want to use TriggerVibration instead. // nFlags is currently unused and reserved for future use. - virtual void TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0; + virtual void Legacy_TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0; //----------------------------------------------------------------------------- - // Utility functions availible without using the rest of Steam Input API + // Utility functions available without using the rest of Steam Input API //----------------------------------------------------------------------------- // Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode @@ -699,12 +820,64 @@ public: // 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; + + // Get a bitmask of the Steam Input Configuration types opted in for the current session. Returns ESteamInputConfigurationEnableType values.? + // Note: user can override the settings from the Steamworks Partner site so the returned values may not exactly match your default configuration + virtual uint16 GetSessionInputConfigurationSettings() = 0; }; -#define STEAMINPUT_INTERFACE_VERSION "SteamInput002" +#define STEAMINPUT_INTERFACE_VERSION "SteamInput005" // Global interface accessor inline ISteamInput *SteamInput(); STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamInput *, SteamInput, STEAMINPUT_INTERFACE_VERSION ); +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx +#endif + +//----------------------------------------------------------------------------- +// Purpose: called when a new controller has been connected, will fire once +// per controller if multiple new controllers connect in the same frame +//----------------------------------------------------------------------------- +struct SteamInputDeviceConnected_t +{ + enum { k_iCallback = k_iSteamControllerCallbacks + 1 }; + InputHandle_t m_ulConnectedDeviceHandle; // Handle for device +}; + +//----------------------------------------------------------------------------- +// Purpose: called when a new controller has been connected, will fire once +// per controller if multiple new controllers connect in the same frame +//----------------------------------------------------------------------------- +struct SteamInputDeviceDisconnected_t +{ + enum { k_iCallback = k_iSteamControllerCallbacks + 2 }; + InputHandle_t m_ulDisconnectedDeviceHandle; // Handle for device +}; + +//----------------------------------------------------------------------------- +// Purpose: called when a controller configuration has been loaded, will fire once +// per controller per focus change for Steam Input enabled controllers +//----------------------------------------------------------------------------- +struct SteamInputConfigurationLoaded_t +{ + enum { k_iCallback = k_iSteamControllerCallbacks + 3 }; + AppId_t m_unAppID; + InputHandle_t m_ulDeviceHandle; // Handle for device + CSteamID m_ulMappingCreator; // May differ from local user when using + // an unmodified community or official config + uint32 m_unMajorRevision; // Binding revision from In-game Action File. + // Same value as queried by GetDeviceBindingRevision + uint32 m_unMinorRevision; + bool m_bUsesSteamInputAPI; // Does the configuration contain any Analog/Digital actions? + bool m_bUsesGamepadAPI; // Does the configuration contain any Xinput bindings? +}; + +#pragma pack( pop ) + #endif // ISTEAMINPUT_H \ No newline at end of file diff --git a/sdk_includes/isteaminput002.h b/sdk_includes/isteaminput002.h new file mode 100644 index 0000000..dc16b0d --- /dev/null +++ b/sdk_includes/isteaminput002.h @@ -0,0 +1,149 @@ + +#ifndef ISTEAMINPUT002_H +#define ISTEAMINPUT002_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamInput002 +{ +public: + + // Init and Shutdown must be called when starting/ending use of this interface + virtual bool Init() = 0; + virtual bool Shutdown() = 0; + + // Synchronize API state with the latest Steam Controller inputs available. This + // is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest + // possible latency, you call this directly before reading controller state. This must + // be called from somewhere before GetConnectedControllers will return any handles + virtual void RunFrame() = 0; + + // Enumerate currently connected Steam Input enabled devices - developers can opt in controller by type (ex: Xbox/Playstation/etc) via + // the Steam Input settings in the Steamworks site or users can opt-in in their controller settings in Steam. + // handlesOut should point to a STEAM_INPUT_MAX_COUNT sized array of InputHandle_t handles + // Returns the number of handles written to handlesOut + virtual int GetConnectedControllers( STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_COUNT, Receives list of connected controllers ) InputHandle_t *handlesOut ) = 0; + + //----------------------------------------------------------------------------- + // ACTION SETS + //----------------------------------------------------------------------------- + + // Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls. + virtual InputActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0; + + // Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive') + // This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in + // your state loops, instead of trying to place it in all of your state transitions. + virtual void ActivateActionSet( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle ) = 0; + virtual InputActionSetHandle_t GetCurrentActionSet( InputHandle_t inputHandle ) = 0; + + // ACTION SET LAYERS + virtual void ActivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle ) = 0; + virtual void DeactivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle ) = 0; + virtual void DeactivateAllActionSetLayers( InputHandle_t inputHandle ) = 0; + // 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 + //----------------------------------------------------------------------------- + + // Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls. + virtual InputDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0; + + // Returns the current state of the supplied digital game action + virtual InputDigitalActionData_t GetDigitalActionData( InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle ) = 0; + + // Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action. + // originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to + // the Steam client and will exceed the values from this header, please check bounds if you are using a look up table. + virtual int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, 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; + + // Returns the current state of these supplied analog game action + virtual InputAnalogActionData_t GetAnalogActionData( InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle ) = 0; + + // Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action. + // originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to + // the Steam client and will exceed the values from this header, please check bounds if you are using a look up table. + virtual int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, STEAM_OUT_ARRAY_COUNT( STEAM_INPUT_MAX_ORIGINS, Receives list of action origins ) EInputActionOrigin *originsOut ) = 0; + + // Get a local path to art for on-screen glyph for a particular origin + virtual const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) = 0; + + // 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 + virtual void StopAnalogActionMomentum( InputHandle_t inputHandle, InputAnalogActionHandle_t eAction ) = 0; + + // Returns raw motion data from the specified device + virtual InputMotionData_t GetMotionData( InputHandle_t inputHandle ) = 0; + + //----------------------------------------------------------------------------- + // OUTPUTS + //----------------------------------------------------------------------------- + + // Trigger a vibration event on supported controllers - Steam will translate these commands into haptic pulses for Steam Controllers + virtual void TriggerVibration( InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) = 0; + + // Set the controller LED color on supported controllers. nFlags is a bitmask of values from ESteamInputLEDFlag - 0 will default to setting a color. Steam will handle + // the behavior on exit of your program so you don't need to try restore the default as you are shutting down + virtual void SetLEDColor( InputHandle_t inputHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) = 0; + + // Trigger a haptic pulse on a Steam Controller - if you are approximating rumble you may want to use TriggerVibration instead. + // Good uses for Haptic pulses include chimes, noises, or directional gameplay feedback (taking damage, footstep locations, etc). + virtual void TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; + + // Trigger a haptic pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times. If you are approximating rumble you may want to use TriggerVibration instead. + // nFlags is currently unused and reserved for future use. + virtual void TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0; + + //----------------------------------------------------------------------------- + // Utility functions availible without using the rest of Steam Input API + //----------------------------------------------------------------------------- + + // Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode + // If the user is not in Big Picture Mode it will open up the binding in a new window + virtual bool ShowBindingPanel( InputHandle_t inputHandle ) = 0; + + // Returns the input type for a particular handle - unlike EInputActionOrigin which update with Steam and may return unrecognized values + // ESteamInputType will remain static and only return valid values from your SDK version + virtual ESteamInputType GetInputTypeForHandle( InputHandle_t inputHandle ) = 0; + + // Returns the associated controller handle for the specified emulated gamepad - can be used with the above 2 functions + // to identify controllers presented to your game over Xinput. Returns 0 if the Xinput index isn't associated with Steam Input + virtual InputHandle_t GetControllerForGamepadIndex( int nIndex ) = 0; + + // Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index + virtual int GetGamepadIndexForController( InputHandle_t ulinputHandle ) = 0; + + // Returns a localized string (from Steam's language setting) for the specified Xbox controller origin. + virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0; + + // Get a local path to art for on-screen glyph for a particular Xbox controller origin + virtual const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) = 0; + + // Get the equivalent ActionOrigin for a given Xbox controller origin this can be chained with GetGlyphForActionOrigin to provide future proof glyphs for + // non-Steam Input API action games. Note - this only translates the buttons directly and doesn't take into account any remapping a user has made in their configuration + virtual EInputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, EXboxOrigin eOrigin ) = 0; + + // Convert an origin to another controller type - for inputs not present on the other controller type this will return k_EInputActionOrigin_None + // When a new input type is added you will be able to pass in k_ESteamInputType_Unknown 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; +}; + +#endif //ISTEAMINPUT002_H diff --git a/sdk_includes/isteamnetworkingsockets.h b/sdk_includes/isteamnetworkingsockets.h index 8979ddf..2c6814e 100644 --- a/sdk_includes/isteamnetworkingsockets.h +++ b/sdk_includes/isteamnetworkingsockets.h @@ -19,10 +19,13 @@ class ISteamNetworkingSignalingRecvContext; /// Lower level networking API. /// /// - Connection-oriented API (like TCP, not UDP). When sending and receiving -/// messages, a connection handle is used. (For a UDP-style interface, see -/// ISteamNetworkingMessages.) In this TCP-style interface, the "server" will -/// "listen" on a "listen socket." A "client" will "connect" to the server, -/// and the server will "accept" the connection. +/// messages, a connection handle is used. (For a UDP-style interface, where +/// the peer is identified by their address with each send/recv call, see +/// ISteamNetworkingMessages.) The typical pattern is for a "server" to "listen" +/// on a "listen socket." A "client" will "connect" to the server, and the +/// server will "accept" the connection. If you have a symmetric situation +/// where either peer may initiate the connection and server/client roles are +/// not clearly defined, check out k_ESteamNetworkingConfig_SymmetricConnect. /// - But unlike TCP, it's message-oriented, not stream-oriented. /// - Mix of reliable and unreliable messages /// - Fragmentation and reassembly @@ -196,7 +199,23 @@ public: /// Set connection user data. the data is returned in the following places /// - You can query it using GetConnectionUserData. /// - The SteamNetworkingmessage_t structure. - /// - The SteamNetConnectionInfo_t structure. (Which is a member of SteamNetConnectionStatusChangedCallback_t.) + /// - The SteamNetConnectionInfo_t structure. + /// (Which is a member of SteamNetConnectionStatusChangedCallback_t -- but see WARNINGS below!!!!) + /// + /// Do you need to set this atomically when the connection is created? + /// See k_ESteamNetworkingConfig_ConnectionUserData. + /// + /// WARNING: Be *very careful* when using the value provided in callbacks structs. + /// Callbacks are queued, and the value that you will receive in your + /// callback is the userdata that was effective at the time the callback + /// was queued. There are subtle race conditions that can happen if you + /// don't understand this! + /// + /// If any incoming messages for this connection are queued, the userdata + /// field is updated, so that when when you receive messages (e.g. with + /// ReceiveMessagesOnConnection), they will always have the very latest + /// userdata. So the tricky race conditions that can happen with callbacks + /// do not apply to retrieving messages. /// /// Returns false if the handle is invalid. virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) = 0; @@ -262,7 +281,7 @@ public: /// 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 + /// invoked at any time from any thread (perhaps even before SendMessages /// returns!), so it MUST be fast and threadsafe. /// /// You MUST also fill in: @@ -658,15 +677,15 @@ public: /// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext ) = 0; -// -// Certificate provision by the application. On Steam, we normally handle all this automatically -// and you will not need to use these advanced functions. -// + // + // Certificate provision by the application. On Steam, we normally handle all this automatically + // and you will not need to use these advanced functions. + // /// Get blob that describes a certificate request. You can send this to your game coordinator. /// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will /// 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.) + /// size. (512 bytes is a conservative estimate.) /// /// Pass this blob to your game coordinator and call SteamDatagram_CreateCert. virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0; diff --git a/sdk_includes/isteamnetworkingsockets009.h b/sdk_includes/isteamnetworkingsockets009.h new file mode 100644 index 0000000..fbef0d5 --- /dev/null +++ b/sdk_includes/isteamnetworkingsockets009.h @@ -0,0 +1,653 @@ + +#ifndef ISTEAMNETWORKINGSOCKETS009 +#define ISTEAMNETWORKINGSOCKETS009 + + +class ISteamNetworkingSockets009 +{ +public: + + /// Creates a "server" socket that listens for clients to connect to by + /// calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6) + /// + /// You must select a specific local port to listen on and set it + /// the port field of the local address. + /// + /// Usually you 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, 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 + /// matching call to CreateListenSocketIP on the specified port. + /// + /// A SteamNetConnectionStatusChangedCallback_t callback will be triggered when we start + /// connecting, and then another one on either timeout or successful connection. + /// + /// If the server does not have any identity configured, then their network address + /// will be the only identity in use. Or, the network host may provide a platform-specific + /// identity with or without a valid certificate to authenticate that identity. (These + /// details will be contained in the SteamNetConnectionStatusChangedCallback_t.) It's + /// up to your application to decide whether to allow the connection. + /// + /// By default, all connections will get basic encryption sufficient to prevent + /// casual eavesdropping. But note that without certificates (or a shared secret + /// distributed through some other out-of-band mechanism), you don't have any + /// way of knowing who is actually on the other end, and thus are vulnerable to + /// man-in-the-middle attacks. + /// + /// 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; + + /// Like CreateListenSocketIP, but clients will connect using ConnectP2P. + /// + /// nLocalVirtualPort specifies how clients can connect to this socket using + /// ConnectP2P. It's very common for applications to only have one listening socket; + /// in that case, use zero. If you need to open multiple listen sockets and have clients + /// be able to connect to one or the other, then nLocalVirtualPort should be a small + /// integer (<1000) unique to each listen socket you create. + /// + /// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess() + /// when your app initializes. + /// + /// If you are listening on a dedicated servers in known data center, + /// then you can listen using this function instead of CreateHostedDedicatedServerListenSocket, + /// to allow clients to connect without a ticket. Any user that owns + /// the app and is signed into Steam will be able to attempt to connect to + /// your server. Also, a connection attempt may require the client to + /// be connected to Steam, which is one more moving part that may fail. When + /// tickets are used, then once a ticket is obtained, a client can connect to + /// your server even if they got disconnected from Steam or Steam is offline. + /// + /// If you need to set any initial config options, pass them here. See + /// SteamNetworkingConfigValue_t for more about why this is preferable to + /// setting the options "immediately" after creation. + virtual HSteamListenSocket CreateListenSocketP2P( int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + + /// Begin connecting to a peer that is identified using a platform-specific identifier. + /// This uses the default rendezvous service, which depends on the platform and library + /// configuration. (E.g. on Steam, it goes through the steam backend.) + /// + /// 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. + /// + /// To use your own signaling service, see: + /// - ConnectP2PCustomSignaling + /// - k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling + virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + + /// Accept an incoming connection that has been received on a listen socket. + /// + /// When a connection attempt is received (perhaps after a few basic handshake + /// packets have been exchanged to prevent trivial spoofing), a connection interface + /// object is created in the k_ESteamNetworkingConnectionState_Connecting state + /// and a SteamNetConnectionStatusChangedCallback_t is posted. At this point, your + /// application MUST either accept or close the connection. (It may not ignore it.) + /// Accepting the connection will transition it either into the connected state, + /// or the finding route state, depending on the connection type. + /// + /// You should take action within a second or two, because accepting the connection is + /// what actually sends the reply notifying the client that they are connected. If you + /// delay taking action, from the client's perspective it is the same as the network + /// being unresponsive, and the client may timeout the connection attempt. In other + /// words, the client cannot distinguish between a delay caused by network problems + /// and a delay caused by the application. + /// + /// This means that if your application goes for more than a few seconds without + /// processing callbacks (for example, while loading a map), then there is a chance + /// that a client may attempt to connect in that interval and fail due to timeout. + /// + /// If the application does not respond to the connection attempt in a timely manner, + /// and we stop receiving communication from the client, the connection attempt will + /// be timed out locally, transitioning the connection to the + /// k_ESteamNetworkingConnectionState_ProblemDetectedLocally state. The client may also + /// close the connection before it is accepted, and a transition to the + /// k_ESteamNetworkingConnectionState_ClosedByPeer is also possible depending the exact + /// sequence of events. + /// + /// Returns k_EResultInvalidParam if the handle is invalid. + /// Returns k_EResultInvalidState if the connection is not in the appropriate state. + /// (Remember that the connection state could change in between the time that the + /// notification being posted to the queue and when it is received by the application.) + /// + /// 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. + /// Any unread data on the connection is discarded. + /// + /// nReason is an application defined code that will be received on the other + /// end and recorded (when possible) in backend analytics. The value should + /// come from a restricted range. (See ESteamNetConnectionEnd.) If you don't need + /// to communicate any information to the remote host, and do not want analytics to + /// be able to distinguish "normal" connection terminations from "exceptional" ones, + /// You may pass zero, in which case the generic value of + /// k_ESteamNetConnectionEnd_App_Generic will be used. + /// + /// pszDebug is an optional human-readable diagnostic string that will be received + /// by the remote host and recorded (when possible) in backend analytics. + /// + /// If you wish to put the socket into a "linger" state, where an attempt is made to + /// flush any remaining sent data, use bEnableLinger=true. Otherwise reliable data + /// is not flushed. + /// + /// If the connection has already ended and you are just freeing up the + /// connection interface, the reason code, debug string, and linger flag are + /// ignored. + virtual bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger ) = 0; + + /// Destroy a listen socket. All the connections that were accepting on the listen + /// socket are closed ungracefully. + virtual bool CloseListenSocket( HSteamListenSocket hSocket ) = 0; + + /// Set connection user data. the data is returned in the following places + /// - You can query it using GetConnectionUserData. + /// - The SteamNetworkingmessage_t structure. + /// - The SteamNetConnectionInfo_t structure. (Which is a member of SteamNetConnectionStatusChangedCallback_t.) + /// + /// Returns false if the handle is invalid. + virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) = 0; + + /// Fetch connection user data. Returns -1 if handle is invalid + /// or if you haven't set any userdata on the connection. + virtual int64 GetConnectionUserData( HSteamNetConnection hPeer ) = 0; + + /// Set a name for the connection, used mostly for debugging + virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) = 0; + + /// Fetch connection name. Returns false if handle is invalid + virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) = 0; + + /// Send a message to the remote host on the specified connection. + /// + /// nSendFlags determines the delivery guarantees that will be provided, + /// when data should be buffered, etc. E.g. k_nSteamNetworkingSend_Unreliable + /// + /// Note that the semantics we use for messages are not precisely + /// the same as the semantics of a standard "stream" socket. + /// (SOCK_STREAM) For an ordinary stream socket, the boundaries + /// between chunks are not considered relevant, and the sizes of + /// the chunks of data written will not necessarily match up to + /// the sizes of the chunks that are returned by the reads on + /// the other end. The remote host might read a partial chunk, + /// or chunks might be coalesced. For the message semantics + /// used here, however, the sizes WILL match. Each send call + /// will match a successful read call on the remote host + /// one-for-one. If you are porting existing stream-oriented + /// code to the semantics of reliable messages, your code should + /// work the same, since reliable message semantics are more + /// strict than stream semantics. The only caveat is related to + /// performance: there is per-message overhead to retain the + /// message sizes, and so if your code sends many small chunks + /// of data, performance will suffer. Any code based on stream + /// sockets that does not write excessively small chunks will + /// work without any changes. + /// + /// 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) + /// - k_EResultInvalidState: connection is in an invalid state + /// - k_EResultNoConnection: connection has ended + /// - k_EResultIgnored: You used k_nSteamNetworkingSend_NoDelay, and the message was dropped because + /// we were not ready to send it. + /// - k_EResultLimitExceeded: there was already too much data queued to be sent. + /// (See k_ESteamNetworkingConfig_SendBufferSize) + virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags, 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). + /// + /// If Nagle is enabled (it's on by default) then when calling + /// SendMessageToConnection the message will be buffered, up to the Nagle time + /// before being sent, to merge small messages into the same packet. + /// (See k_ESteamNetworkingConfig_NagleTime) + /// + /// Returns: + /// k_EResultInvalidParam: invalid connection handle + /// k_EResultInvalidState: connection is in an invalid state + /// k_EResultNoConnection: connection has ended + /// k_EResultIgnored: We weren't (yet) connected, so this operation has no effect. + virtual EResult FlushMessagesOnConnection( HSteamNetConnection hConn ) = 0; + + /// Fetch the next available message(s) from the connection, if any. + /// Returns the number of messages returned into your array, up to nMaxMessages. + /// If the connection handle is invalid, -1 is returned. + /// + /// The order of the messages returned in the array is relevant. + /// Reliable messages will be received in the order they were sent (and with the + /// same sizes --- see SendMessageToConnection for on this subtle difference from a stream socket). + /// + /// Unreliable messages may be dropped, or delivered out of order with respect to + /// each other or with respect to reliable messages. The same unreliable message + /// may be received multiple times. + /// + /// If any messages are returned, you MUST call SteamNetworkingMessage_t::Release() on each + /// of them free up resources after you are done. It is safe to keep the object alive for + /// a little while (put it into some queue, etc), and you may call Release() from any thread. + virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0; + + /// Returns basic information about the high-level state of the connection. + virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0; + + /// Returns a small set of information about the real-time state of the connection + /// Returns false if the connection handle is invalid, or the connection has ended. + virtual bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) = 0; + + /// Returns detailed connection stats in text format. Useful + /// for dumping to a log, etc. + /// + /// Returns: + /// -1 failure (bad connection handle) + /// 0 OK, your buffer was filled in and '\0'-terminated + /// >0 Your buffer was either nullptr, or it was too small and the text got truncated. + /// Try again with a buffer of at least N bytes. + virtual int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf ) = 0; + + /// Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to. + /// + /// An IPv6 address of ::0 means "any IPv4 or IPv6" + /// An IPv6 address of ::ffff:0000:0000 means "any IPv4" + virtual bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address ) = 0; + + /// Create a pair of connections that are talking to each other, e.g. a loopback connection. + /// This is very useful for testing, or so that your client/server code can work the same + /// even when you are running a local "server". + /// + /// The two connections will immediately be placed into the connected state, and no callbacks + /// will be posted immediately. After this, if you close either connection, the other connection + /// will receive a callback, exactly as if they were communicating over the network. You must + /// close *both* sides in order to fully clean up the resources! + /// + /// By default, internal buffers are used, completely bypassing the network, the chopping up of + /// messages into packets, encryption, copying the payload, etc. This means that loopback + /// packets, by default, will not simulate lag or loss. Passing true for bUseNetworkLoopback will + /// cause the socket pair to send packets through the local network loopback device (127.0.0.1) + /// on ephemeral ports. Fake lag and loss are supported in this case, and CPU time is expended + /// to encrypt and decrypt. + /// + /// If you wish to assign a specific identity to either connection, you may pass a particular + /// identity. Otherwise, if you pass nullptr, the respective connection will assume a generic + /// "localhost" identity. If you use real network loopback, this might be translated to the + /// actual bound loopback port. Otherwise, the port will be zero. + virtual bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 ) = 0; + + /// Get the identity assigned to this interface. + /// E.g. on Steam, this is the user's SteamID, or for the gameserver interface, the SteamID assigned + /// to the gameserver. Returns false and sets the result to an invalid identity if we don't know + /// our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID + /// even if they are not signed into Steam.) + virtual bool GetIdentity( SteamNetworkingIdentity *pIdentity ) = 0; + + /// 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; + + // + // Clients connecting to dedicated servers hosted in a data center, + // using tickets issued by your game coordinator. If you are not + // issuing your own tickets to restrict who can attempt to connect + // to your server, then you won't use these functions. + // + + /// Call this when you receive a ticket from your backend / matchmaking system. Puts the + /// ticket into a persistent cache, and optionally returns the parsed ticket. + /// + /// See stamdatagram_ticketgen.h for more details. + virtual bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0; + + /// Search cache for a ticket to talk to the server on the specified virtual port. + /// If found, returns the number of seconds until the ticket expires, and optionally + /// the complete cracked ticket. Returns 0 if we don't have a ticket. + /// + /// Typically this is useful just to confirm that you have a ticket, before you + /// call ConnectToHostedDedicatedServer to connect to the server. + virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0; + + /// Client call to connect to a server hosted in a Valve data center, on the specified virtual + /// port. You must have placed a ticket for this server into the cache, or else this connect + /// attempt will fail! If you are not issuing your own tickets, then to connect to a dedicated + /// server via SDR in auto-ticket mode, use ConnectP2P. (The server must be configured to allow + /// this type of connection by listening using CreateListenSocketP2P.) + /// + /// You may wonder why tickets are stored in a cache, instead of simply being passed as an argument + /// here. The reason is to make reconnection to a gameserver robust, even if the client computer loses + /// connection to Steam or the central backend, or the app is restarted or crashes, etc. + /// + /// If you use this, you probably want to call ISteamNetworkingUtils::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 ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + + // + // 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. + /// + /// 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; + + /// 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. 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. + /// + /// 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. + /// + /// On a successful exit, k_EResultOK is returned + /// + /// 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. + /// + /// This call MUST be made through the SteamGameServerNetworkingSockets() interface. + /// + /// This function should be used when you are using the ticket generator library + /// to issue your own tickets. Clients connecting to the server on this virtual + /// port will need a ticket, and they must connect using ConnectToHostedDedicatedServer. + /// + /// If you need to set any initial config options, pass them here. See + /// SteamNetworkingConfigValue_t for more about why this is preferable to + /// setting the options "immediately" after creation. + virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + + /// 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 + /// ISteamNetworkingConnectionSignaling::SendSignal. + /// + /// When the remote peer accepts the connection (See + /// ISteamNetworkingSignalingRecvContext::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 nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + + /// Called when custom signaling has received a message. When your + /// signaling channel receives a message, it should save off whatever + /// 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 ISteamNetworkingConnectionSignaling + /// 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; + +// +// 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 callback functions queued for this interface. + /// See k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, etc + /// + /// You don't need to call this if you are using Steam's callback dispatch + /// mechanism (SteamAPI_RunCallbacks and SteamGameserver_RunCallbacks). + virtual void RunCallbacks() = 0; +protected: +// ~ISteamNetworkingSockets(); // Silence some warnings +}; + +#endif // ISTEAMNETWORKINGSOCKETS009 diff --git a/sdk_includes/isteamnetworkingsocketsserialized.h b/sdk_includes/isteamnetworkingsocketsserialized.h index 41debcd..f1589f5 100644 --- a/sdk_includes/isteamnetworkingsocketsserialized.h +++ b/sdk_includes/isteamnetworkingsocketsserialized.h @@ -46,6 +46,22 @@ public: virtual bool BAllowDirectConnectToPeer(SteamNetworkingIdentity const &identity) = 0; }; +class ISteamNetworkingSocketsSerialized005 +{ +public: + virtual void SendP2PRendezvous( CSteamID steamIDRemote, uint32 unConnectionIDSrc, const void *pMsgRendezvous, uint32 cbRendezvous ) = 0; + virtual void SendP2PConnectionFailure( CSteamID steamIDRemote, uint32 unConnectionIDDest, uint32 nReason, const char *pszReason ) = 0; + virtual SteamAPICall_t GetCertAsync() = 0; + virtual int GetNetworkConfigJSON( void *buf, uint32 cbBuf, const char *pszLauncherPartner ) = 0; + virtual void CacheRelayTicket( const void *pTicket, uint32 cbTicket ) = 0; + virtual uint32 GetCachedRelayTicketCount() = 0; + virtual int GetCachedRelayTicket( uint32 idxTicket, void *buf, uint32 cbBuf ) = 0; + virtual void PostConnectionStateMsg( const void *pMsg, uint32 cbMsg ) = 0; + virtual bool GetSTUNServer(int dont_know, char *buf, unsigned int len) = 0; + virtual bool BAllowDirectConnectToPeer(SteamNetworkingIdentity const &identity) = 0; + virtual int BeginAsyncRequestFakeIP(int a) = 0; //not sure if the right return type +}; + struct SteamNetworkingSocketsConfigUpdated_t { enum { k_iCallback = k_iSteamNetworkingCallbacks + 95 }; diff --git a/sdk_includes/isteamremotestorage.h b/sdk_includes/isteamremotestorage.h index 13b8c96..c24894d 100644 --- a/sdk_includes/isteamremotestorage.h +++ b/sdk_includes/isteamremotestorage.h @@ -156,6 +156,28 @@ enum EUGCReadAction k_EUGCRead_Close = 2, }; +enum ERemoteStorageLocalFileChange +{ + k_ERemoteStorageLocalFileChange_Invalid = 0, + + // The file was updated from another device + k_ERemoteStorageLocalFileChange_FileUpdated = 1, + + // The file was deleted by another device + k_ERemoteStorageLocalFileChange_FileDeleted = 2, +}; + +enum ERemoteStorageFilePathType +{ + k_ERemoteStorageFilePathType_Invalid = 0, + + // The file is directly accessed by the game and this is the full path + k_ERemoteStorageFilePathType_Absolute = 1, + + // The file is accessed via the ISteamRemoteStorage API and this is the filename + k_ERemoteStorageFilePathType_APIFilename = 2, +}; + //----------------------------------------------------------------------------- // Purpose: Functions for accessing, reading and writing files stored remotely @@ -238,24 +260,6 @@ class ISteamRemoteStorage virtual int32 GetCachedUGCCount() = 0; virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0; - // The following functions are only necessary on the Playstation 3. On PC & Mac, the Steam client will handle these operations for you - // On Playstation 3, the game controls which files are stored in the cloud, via FilePersist, FileFetch, and FileForget. - -#if defined(_SERVER) - // Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback - virtual void GetFileListFromServer() = 0; - // Indicate this file should be downloaded in the next sync - virtual bool FileFetch( const char *pchFile ) = 0; - // Indicate this file should be persisted in the next sync - virtual bool FilePersist( const char *pchFile ) = 0; - // Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback - virtual bool SynchronizeToClient() = 0; - // Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback - virtual bool SynchronizeToServer() = 0; - // Reset any fetch/persist/etc requests - virtual bool ResetFileRequestState() = 0; -#endif - // publishing UGC STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t ) virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0; @@ -305,9 +309,18 @@ class ISteamRemoteStorage STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t ) virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0; + + // Cloud dynamic state change notification + virtual int32 GetLocalFileChangeCount() = 0; + virtual const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType ) = 0; + + // Indicate to Steam the beginning / end of a set of local file + // operations - for example, writing a game save that requires updating two files. + virtual bool BeginFileWriteBatch() = 0; + virtual bool EndFileWriteBatch() = 0; }; -#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION014" +#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION016" #ifndef STEAM_API_EXPORTS // Global interface accessor @@ -324,61 +337,13 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamRemoteStorage *, SteamRemoteStorage, #error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx #endif -//----------------------------------------------------------------------------- -// Purpose: sent when the local file cache is fully synced with the server for an app -// That means that an application can be started and has all latest files -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncedClient_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 1 }; - AppId_t m_nAppID; - EResult m_eResult; - int m_unNumDownloads; -}; -//----------------------------------------------------------------------------- -// Purpose: sent when the server is fully synced with the local file cache for an app -// That means that we can shutdown Steam and our data is stored on the server -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncedServer_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 2 }; - AppId_t m_nAppID; - EResult m_eResult; - int m_unNumUploads; -}; - -//----------------------------------------------------------------------------- -// Purpose: Status of up and downloads during a sync session -// -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncProgress_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 3 }; - char m_rgchCurrentFile[k_cchFilenameMax]; // Current file being transferred - AppId_t m_nAppID; // App this info relates to - uint32 m_uBytesTransferredThisChunk; // Bytes transferred this chunk - double m_dAppPercentComplete; // Percent complete that this app's transfers are - bool m_bUploading; // if false, downloading -}; // -// IMPORTANT! k_iClientRemoteStorageCallbacks + 4 is used, see iclientremotestorage.h +// IMPORTANT! k_iClientRemoteStorageCallbacks 1 through 6 are used, see iclientremotestorage.h // -//----------------------------------------------------------------------------- -// Purpose: Sent after we've determined the list of files that are out of sync -// with the server. -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncStatusCheck_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 5 }; - AppId_t m_nAppID; - EResult m_eResult; -}; - - //----------------------------------------------------------------------------- // Purpose: The result of a call to FileShare() //----------------------------------------------------------------------------- @@ -405,6 +370,9 @@ struct RemoteStoragePublishFileResult_t bool m_bUserNeedsToAcceptWorkshopLegalAgreement; }; +// k_iClientRemoteStorageCallbacks + 10 is deprecated! Do not reuse + + //----------------------------------------------------------------------------- // Purpose: The result of a call to DeletePublishedFile() @@ -684,6 +652,14 @@ struct RemoteStorageFileReadAsyncComplete_t uint32 m_cubRead; // amount read - will the <= the amount requested }; +//----------------------------------------------------------------------------- +// Purpose: one or more files for this app have changed locally after syncing +// to remote session changes +// Note: only posted if this happens DURING the local app session +//----------------------------------------------------------------------------- +STEAM_CALLBACK_BEGIN( RemoteStorageLocalFileChange_t, k_iClientRemoteStorageCallbacks + 33 ) +STEAM_CALLBACK_END( 0 ) + #pragma pack( pop ) diff --git a/sdk_includes/isteamremotestorage014.h b/sdk_includes/isteamremotestorage014.h new file mode 100644 index 0000000..3ea948b --- /dev/null +++ b/sdk_includes/isteamremotestorage014.h @@ -0,0 +1,214 @@ + +#ifndef ISTEAMREMOTESTORAGE014_H +#define ISTEAMREMOTESTORAGE014_H +#ifdef STEAM_WIN32 +#pragma once +#endif + + +//----------------------------------------------------------------------------- +// Purpose: Functions for accessing, reading and writing files stored remotely +// and cached locally +//----------------------------------------------------------------------------- +class ISteamRemoteStorage014 +{ + public: + // NOTE + // + // Filenames are case-insensitive, and will be converted to lowercase automatically. + // So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then + // iterate the files, the filename returned will be "foo.bar". + // + + // file operations + virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0; + virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0; + + STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t ) + virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0; + + STEAM_CALL_RESULT( RemoteStorageFileReadAsyncComplete_t ) + virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0; + virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0; + + virtual bool FileForget( const char *pchFile ) = 0; + virtual bool FileDelete( const char *pchFile ) = 0; + STEAM_CALL_RESULT( RemoteStorageFileShareResult_t ) + virtual SteamAPICall_t FileShare( const char *pchFile ) = 0; + virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0; + + // file operations that cause network IO + virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0; + virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0; + virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0; + virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0; + + // file information + virtual bool FileExists( const char *pchFile ) = 0; + virtual bool FilePersisted( const char *pchFile ) = 0; + virtual int32 GetFileSize( const char *pchFile ) = 0; + virtual int64 GetFileTimestamp( const char *pchFile ) = 0; + virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0; + + // iteration + virtual int32 GetFileCount() = 0; + virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0; + + // configuration management + virtual bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes ) = 0; + virtual bool IsCloudEnabledForAccount() = 0; + virtual bool IsCloudEnabledForApp() = 0; + virtual void SetCloudEnabledForApp( bool bEnabled ) = 0; + + // user generated content + + // Downloads a UGC file. A priority value of 0 will download the file immediately, + // otherwise it will wait to download the file until all downloads with a lower priority + // value are completed. Downloads with equal priority will occur simultaneously. + STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t ) + virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0; + + // Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false + // or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage + virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0; + + // Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result + virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0; + + // After download, gets the content of the file. + // Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file. + // Larger files can be read in chunks to reduce memory usage (since both sides of the IPC client and the game itself must allocate + // enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail + // unless UGCDownload is called again. + // For especially large files (anything over 100MB) it is a requirement that the file is read in chunks. + virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0; + + // Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead() + virtual int32 GetCachedUGCCount() = 0; + virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0; + + // The following functions are only necessary on the Playstation 3. On PC & Mac, the Steam client will handle these operations for you + // On Playstation 3, the game controls which files are stored in the cloud, via FilePersist, FileFetch, and FileForget. + +#if defined(_SERVER) + // Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback + virtual void GetFileListFromServer() = 0; + // Indicate this file should be downloaded in the next sync + virtual bool FileFetch( const char *pchFile ) = 0; + // Indicate this file should be persisted in the next sync + virtual bool FilePersist( const char *pchFile ) = 0; + // Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback + virtual bool SynchronizeToClient() = 0; + // Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback + virtual bool SynchronizeToServer() = 0; + // Reset any fetch/persist/etc requests + virtual bool ResetFileRequestState() = 0; +#endif + + // publishing UGC + STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t ) + virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0; + virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0; + virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0; + virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0; + virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0; + virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0; + virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; + virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0; + STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t ) + virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0; + // Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0, + // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh. + // A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is. + STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t ) + virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0; + STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t ) + virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; + // enumerate the files that the current user published with this app + STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t ) + virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0; + STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t ) + virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; + STEAM_CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t ) + virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0; + STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t ) + virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; + virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0; + STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t ) + virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0; + STEAM_CALL_RESULT( RemoteStorageUpdateUserPublishedItemVoteResult_t ) + virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0; + STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t ) + virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0; + STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t ) + virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0; + STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t ) + virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0; + STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t ) + virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0; + STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t ) + virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0; + // this method enumerates the public view of workshop files + STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t ) + virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0; + + STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t ) + virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0; +}; + +//----------------------------------------------------------------------------- +// Purpose: sent when the local file cache is fully synced with the server for an app +// That means that an application can be started and has all latest files +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncedClient_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 1 }; + AppId_t m_nAppID; + EResult m_eResult; + int m_unNumDownloads; +}; + +//----------------------------------------------------------------------------- +// Purpose: sent when the server is fully synced with the local file cache for an app +// That means that we can shutdown Steam and our data is stored on the server +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncedServer_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 2 }; + AppId_t m_nAppID; + EResult m_eResult; + int m_unNumUploads; +}; + +//----------------------------------------------------------------------------- +// Purpose: Status of up and downloads during a sync session +// +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncProgress_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 3 }; + char m_rgchCurrentFile[k_cchFilenameMax]; // Current file being transferred + AppId_t m_nAppID; // App this info relates to + uint32 m_uBytesTransferredThisChunk; // Bytes transferred this chunk + double m_dAppPercentComplete; // Percent complete that this app's transfers are + bool m_bUploading; // if false, downloading +}; + +// +// IMPORTANT! k_iClientRemoteStorageCallbacks + 4 is used, see iclientremotestorage.h +// + + +//----------------------------------------------------------------------------- +// Purpose: Sent after we've determined the list of files that are out of sync +// with the server. +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncStatusCheck_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 5 }; + AppId_t m_nAppID; + EResult m_eResult; +}; + + +#endif // ISTEAMREMOTESTORAGE014_H diff --git a/sdk_includes/isteamugc.h b/sdk_includes/isteamugc.h index 9810331..a8e3a1a 100644 --- a/sdk_includes/isteamugc.h +++ b/sdk_includes/isteamugc.h @@ -99,6 +99,7 @@ enum EUGCQuery k_EUGCQuery_RankedByLifetimeAveragePlaytime = 16, k_EUGCQuery_RankedByPlaytimeSessionsTrend = 17, k_EUGCQuery_RankedByLifetimePlaytimeSessions = 18, + k_EUGCQuery_RankedByLastUpdatedDate = 19, }; enum EItemUpdateStatus @@ -360,6 +361,12 @@ public: // delete the item without prompting the user STEAM_CALL_RESULT( DeleteItemResult_t ) virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0; + + // Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not + virtual bool ShowWorkshopEULA() = 0; + // Retrieve information related to the user's acceptance or not of the app's specific Workshop EULA + STEAM_CALL_RESULT( WorkshopEULAStatus_t ) + virtual SteamAPICall_t GetWorkshopEULAStatus() = 0; }; #define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION015" @@ -568,6 +575,31 @@ struct DeleteItemResult_t PublishedFileId_t m_nPublishedFileId; }; + +//----------------------------------------------------------------------------- +// Purpose: signal that the list of subscribed items changed +//----------------------------------------------------------------------------- +struct UserSubscribedItemsListChanged_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 18 }; + AppId_t m_nAppID; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Status of the user's acceptable/rejection of the app's specific Workshop EULA +//----------------------------------------------------------------------------- +struct WorkshopEULAStatus_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 20 }; + EResult m_eResult; + AppId_t m_nAppID; + uint32 m_unVersion; + RTime32 m_rtAction; + bool m_bAccepted; + bool m_bNeedsAction; +}; + #pragma pack( pop ) #endif // ISTEAMUGC_H diff --git a/sdk_includes/isteamutils.h b/sdk_includes/isteamutils.h index cd43cb3..3a75945 100644 --- a/sdk_includes/isteamutils.h +++ b/sdk_includes/isteamutils.h @@ -41,6 +41,14 @@ enum EGamepadTextInputLineMode k_EGamepadTextInputLineModeMultipleLines = 1 }; +enum EFloatingGamepadTextInputMode +{ + k_EFloatingGamepadTextInputModeModeSingleLine = 0, // Enter dismisses the keyboard + k_EFloatingGamepadTextInputModeModeMultipleLines = 1, // User needs to explictly close the keyboard + k_EFloatingGamepadTextInputModeModeEmail = 2, + k_EFloatingGamepadTextInputModeModeNumeric = 3, + +}; // The context where text filtering is being done enum ETextFilteringContext @@ -86,8 +94,8 @@ public: // the destination buffer size should be 4 * height * width * sizeof(char) virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0; - // returns the IP of the reporting server for valve - currently only used in Source engine games - virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0; + // Deprecated. Do not call this. + STEAM_PRIVATE_API( virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0; ) // return the amount of battery power left in the current system in % [0..100], 255 for being on AC power virtual uint8 GetCurrentBatteryPower() = 0; @@ -146,7 +154,7 @@ public: STEAM_CALL_RESULT( CheckFileSignature_t ) virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0; - // Activates the Big Picture text input dialog which only supports gamepad input + // Activates the full-screen text input dialog which takes a initial text string and returns the text the user has typed virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0; // Returns previously entered text & length @@ -203,6 +211,19 @@ public: // 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; + + // returns true if currently running on the Steam Deck device + virtual bool IsSteamRunningOnSteamDeck() = 0; + + // Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game. + // The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field + virtual bool ShowFloatingGamepadTextInput( EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight ) = 0; + + // In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher + virtual void SetGameLauncherMode( bool bLauncherMode ) = 0; + + // Dismisses the floating keyboard. + virtual bool DismissFloatingGamepadTextInput() = 0; }; #define STEAMUTILS_INTERFACE_VERSION "SteamUtils010" @@ -291,7 +312,7 @@ struct CheckFileSignature_t //----------------------------------------------------------------------------- -// Big Picture gamepad text input has been closed +// Full Screen gamepad text input has been closed //----------------------------------------------------------------------------- struct GamepadTextInputDismissed_t { @@ -300,7 +321,20 @@ struct GamepadTextInputDismissed_t uint32 m_unSubmittedText; }; -// k_iSteamUtilsCallbacks + 15 is taken +// k_iSteamUtilsCallbacks + 15 through 35 are taken + +STEAM_CALLBACK_BEGIN( AppResumingFromSuspend_t, k_iSteamUtilsCallbacks + 36 ) +STEAM_CALLBACK_END(0) + +// k_iSteamUtilsCallbacks + 37 is taken + +//----------------------------------------------------------------------------- +// The floating on-screen keyboard has been closed +//----------------------------------------------------------------------------- +struct FloatingGamepadTextInputDismissed_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 38 }; +}; #pragma pack( pop ) diff --git a/sdk_includes/steam_api.h b/sdk_includes/steam_api.h index 3632dd4..8ab7144 100644 --- a/sdk_includes/steam_api.h +++ b/sdk_includes/steam_api.h @@ -110,6 +110,7 @@ #include "isteamnetworkingsockets004.h" #include "isteamnetworkingsockets006.h" #include "isteamnetworkingsockets008.h" +#include "isteamnetworkingsockets009.h" #include "isteamremotestorage.h" #include "isteamremotestorage001.h" #include "isteamremotestorage002.h" @@ -124,6 +125,7 @@ #include "isteamremotestorage011.h" #include "isteamremotestorage012.h" #include "isteamremotestorage013.h" +#include "isteamremotestorage014.h" #include "isteamscreenshots.h" #include "isteammusic.h" #include "isteammusicremote.h" @@ -167,6 +169,7 @@ #include "isteamunifiedmessages.h" #include "isteaminput.h" #include "isteaminput001.h" +#include "isteaminput002.h" #include "isteamremoteplay.h" #include "isteamnetworkingmessages.h" #include "isteamnetworkingsockets.h" diff --git a/sdk_includes/steam_api_flat.h b/sdk_includes/steam_api_flat.h index 2bd1953..0a28ddf 100644 --- a/sdk_includes/steam_api_flat.h +++ b/sdk_includes/steam_api_flat.h @@ -63,6 +63,8 @@ STEAMAPI_API bool SteamAPI_ISteamUser_BLoggedOn( ISteamUser* self ); STEAMAPI_API uint64_steamid SteamAPI_ISteamUser_GetSteamID( ISteamUser* self ); STEAMAPI_API int SteamAPI_ISteamUser_InitiateGameConnection( ISteamUser* self, void * pAuthBlob, int cbMaxAuthBlob, uint64_steamid steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ); STEAMAPI_API void SteamAPI_ISteamUser_TerminateGameConnection( ISteamUser* self, uint32 unIPServer, uint16 usPortServer ); +STEAMAPI_API int SteamAPI_ISteamUser_InitiateGameConnection_DEPRECATED( ISteamUser* self, void * pAuthBlob, int cbMaxAuthBlob, uint64_steamid steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ); +STEAMAPI_API void SteamAPI_ISteamUser_TerminateGameConnection_DEPRECATED( ISteamUser* self, uint32 unIPServer, uint16 usPortServer ); STEAMAPI_API void SteamAPI_ISteamUser_TrackAppUsageEvent( ISteamUser* self, uint64_gameid gameID, int eAppUsageEvent, const char * pchExtraInfo ); STEAMAPI_API bool SteamAPI_ISteamUser_GetUserDataFolder( ISteamUser* self, char * pchBuffer, int cubBuffer ); STEAMAPI_API void SteamAPI_ISteamUser_StartVoiceRecording( ISteamUser* self ); @@ -208,6 +210,9 @@ STEAMAPI_API bool SteamAPI_ISteamUtils_IsSteamChinaLauncher( ISteamUtils* self ) STEAMAPI_API bool SteamAPI_ISteamUtils_InitFilterText( ISteamUtils* self, uint32 unFilterOptions ); STEAMAPI_API int SteamAPI_ISteamUtils_FilterText( ISteamUtils* self, ETextFilteringContext eContext, uint64_steamid sourceSteamID, const char * pchInputMessage, char * pchOutFilteredText, uint32 nByteSizeOutFilteredText ); STEAMAPI_API ESteamIPv6ConnectivityState SteamAPI_ISteamUtils_GetIPv6ConnectivityState( ISteamUtils* self, ESteamIPv6ConnectivityProtocol eProtocol ); +STEAMAPI_API bool SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck( ISteamUtils* self ); +STEAMAPI_API bool SteamAPI_ISteamUtils_ShowModalGamepadTextInput( ISteamUtils* self, EGamepadTextInputLineMode eLineInputMode ); +STEAMAPI_API void SteamAPI_ISteamUtils_SetGameLauncherMode( ISteamUtils* self, bool bLauncherMode ); // ISteamMatchmaking STEAMAPI_API ISteamMatchmaking *SteamAPI_SteamMatchmaking_v009(); @@ -323,6 +328,7 @@ STEAMAPI_API bool SteamAPI_ISteamParties_GetBeaconLocationData( ISteamParties* s // ISteamRemoteStorage STEAMAPI_API ISteamRemoteStorage *SteamAPI_SteamRemoteStorage_v014(); +STEAMAPI_API ISteamRemoteStorage *SteamAPI_SteamRemoteStorage_v016(); STEAMAPI_API bool SteamAPI_ISteamRemoteStorage_FileWrite( ISteamRemoteStorage* self, const char * pchFile, const void * pvData, int32 cubData ); STEAMAPI_API int32 SteamAPI_ISteamRemoteStorage_FileRead( ISteamRemoteStorage* self, const char * pchFile, void * pvData, int32 cubDataToRead ); STEAMAPI_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileWriteAsync( ISteamRemoteStorage* self, const char * pchFile, const void * pvData, uint32 cubData ); @@ -378,6 +384,11 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAct STEAMAPI_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( ISteamRemoteStorage* self, EWorkshopFileAction eAction, uint32 unStartIndex ); STEAMAPI_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( ISteamRemoteStorage* self, EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t * pTags, SteamParamStringArray_t * pUserTags ); STEAMAPI_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( ISteamRemoteStorage* self, UGCHandle_t hContent, const char * pchLocation, uint32 unPriority ); +STEAMAPI_API int32 SteamAPI_ISteamRemoteStorage_GetLocalFileChangeCount( ISteamRemoteStorage* self ); +STEAMAPI_API const char * SteamAPI_ISteamRemoteStorage_GetLocalFileChange( ISteamRemoteStorage* self, int iFile, ERemoteStorageLocalFileChange * pEChangeType, ERemoteStorageFilePathType * pEFilePathType ); +STEAMAPI_API bool SteamAPI_ISteamRemoteStorage_BeginFileWriteBatch( ISteamRemoteStorage* self ); +STEAMAPI_API bool SteamAPI_ISteamRemoteStorage_EndFileWriteBatch( ISteamRemoteStorage* self ); + // ISteamUserStats STEAMAPI_API ISteamUserStats *SteamAPI_SteamUserStats_v012(); @@ -578,10 +589,16 @@ STEAMAPI_API bool SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( ISteamHTTP* sel // ISteamInput STEAMAPI_API ISteamInput *SteamAPI_SteamInput_v001(); STEAMAPI_API ISteamInput *SteamAPI_SteamInput_v002(); -STEAMAPI_API bool SteamAPI_ISteamInput_Init( ISteamInput* self ); +STEAMAPI_API ISteamInput *SteamAPI_SteamInput_v005(); +STEAMAPI_API bool SteamAPI_ISteamInput_Init( ISteamInput* self, bool bExplicitlyCallRunFrame ); STEAMAPI_API bool SteamAPI_ISteamInput_Shutdown( ISteamInput* self ); -STEAMAPI_API void SteamAPI_ISteamInput_RunFrame( ISteamInput* self ); +STEAMAPI_API bool SteamAPI_ISteamInput_SetInputActionManifestFilePath( ISteamInput* self, const char * pchInputActionManifestAbsolutePath ); +STEAMAPI_API void SteamAPI_ISteamInput_RunFrame( ISteamInput* self, bool bReservedValue ); +STEAMAPI_API bool SteamAPI_ISteamInput_BWaitForData( ISteamInput* self, bool bWaitForever, uint32 unTimeout ); +STEAMAPI_API bool SteamAPI_ISteamInput_BNewDataAvailable( ISteamInput* self ); STEAMAPI_API int SteamAPI_ISteamInput_GetConnectedControllers( ISteamInput* self, InputHandle_t * handlesOut ); +STEAMAPI_API void SteamAPI_ISteamInput_EnableDeviceCallbacks( ISteamInput* self ); +STEAMAPI_API void SteamAPI_ISteamInput_EnableActionEventCallbacks( ISteamInput* self, SteamInputActionEventCallbackPointer pCallback ); STEAMAPI_API InputActionSetHandle_t SteamAPI_ISteamInput_GetActionSetHandle( ISteamInput* self, const char * pszActionSetName ); STEAMAPI_API void SteamAPI_ISteamInput_ActivateActionSet( ISteamInput* self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle ); STEAMAPI_API InputActionSetHandle_t SteamAPI_ISteamInput_GetCurrentActionSet( ISteamInput* self, InputHandle_t inputHandle ); @@ -592,17 +609,26 @@ STEAMAPI_API int SteamAPI_ISteamInput_GetActiveActionSetLayers( ISteamInput* sel STEAMAPI_API InputDigitalActionHandle_t SteamAPI_ISteamInput_GetDigitalActionHandle( ISteamInput* self, const char * pszActionName ); STEAMAPI_API InputDigitalActionData_t SteamAPI_ISteamInput_GetDigitalActionData( ISteamInput* self, InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle ); STEAMAPI_API int SteamAPI_ISteamInput_GetDigitalActionOrigins( ISteamInput* self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin * originsOut ); +STEAMAPI_API const char * SteamAPI_ISteamInput_GetStringForDigitalActionName( ISteamInput* self, InputDigitalActionHandle_t eActionHandle ); STEAMAPI_API InputAnalogActionHandle_t SteamAPI_ISteamInput_GetAnalogActionHandle( ISteamInput* self, const char * pszActionName ); STEAMAPI_API InputAnalogActionData_t SteamAPI_ISteamInput_GetAnalogActionData( ISteamInput* self, InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle ); STEAMAPI_API int SteamAPI_ISteamInput_GetAnalogActionOrigins( ISteamInput* self, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin * originsOut ); +STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphPNGForActionOrigin( ISteamInput* self, EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags ); STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphForActionOrigin( ISteamInput* self, EInputActionOrigin eOrigin ); +STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphSVGForActionOrigin( ISteamInput* self, EInputActionOrigin eOrigin, uint32 unFlags ); +STEAMAPI_API const char * SteamAPI_ISteamInput_GetGlyphForActionOrigin_Legacy( ISteamInput* self, EInputActionOrigin eOrigin ); STEAMAPI_API const char * SteamAPI_ISteamInput_GetStringForActionOrigin( ISteamInput* self, EInputActionOrigin eOrigin ); +STEAMAPI_API const char * SteamAPI_ISteamInput_GetStringForAnalogActionName( ISteamInput* self, InputAnalogActionHandle_t eActionHandle ); STEAMAPI_API void SteamAPI_ISteamInput_StopAnalogActionMomentum( ISteamInput* self, InputHandle_t inputHandle, InputAnalogActionHandle_t eAction ); STEAMAPI_API InputMotionData_t SteamAPI_ISteamInput_GetMotionData( ISteamInput* self, InputHandle_t inputHandle ); STEAMAPI_API void SteamAPI_ISteamInput_TriggerVibration( ISteamInput* self, InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ); +STEAMAPI_API void SteamAPI_ISteamInput_TriggerVibrationExtended( ISteamInput* self, InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed, unsigned short usLeftTriggerSpeed, unsigned short usRightTriggerSpeed ); +STEAMAPI_API void SteamAPI_ISteamInput_TriggerSimpleHapticEvent( ISteamInput* self, InputHandle_t inputHandle, EControllerHapticLocation eHapticLocation, uint8 nIntensity, char nGainDB, uint8 nOtherIntensity, char nOtherGainDB ); STEAMAPI_API void SteamAPI_ISteamInput_SetLEDColor( ISteamInput* self, InputHandle_t inputHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ); STEAMAPI_API void SteamAPI_ISteamInput_TriggerHapticPulse( ISteamInput* self, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ); STEAMAPI_API void SteamAPI_ISteamInput_TriggerRepeatedHapticPulse( ISteamInput* self, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ); +STEAMAPI_API void SteamAPI_ISteamInput_Legacy_TriggerHapticPulse( ISteamInput* self, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ); +STEAMAPI_API void SteamAPI_ISteamInput_Legacy_TriggerRepeatedHapticPulse( ISteamInput* self, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ); STEAMAPI_API bool SteamAPI_ISteamInput_ShowBindingPanel( ISteamInput* self, InputHandle_t inputHandle ); STEAMAPI_API ESteamInputType SteamAPI_ISteamInput_GetInputTypeForHandle( ISteamInput* self, InputHandle_t inputHandle ); STEAMAPI_API InputHandle_t SteamAPI_ISteamInput_GetControllerForGamepadIndex( ISteamInput* self, int nIndex ); @@ -613,6 +639,7 @@ STEAMAPI_API EInputActionOrigin SteamAPI_ISteamInput_GetActionOriginFromXboxOrig STEAMAPI_API EInputActionOrigin SteamAPI_ISteamInput_TranslateActionOrigin( ISteamInput* self, ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin ); STEAMAPI_API bool SteamAPI_ISteamInput_GetDeviceBindingRevision( ISteamInput* self, InputHandle_t inputHandle, int * pMajor, int * pMinor ); STEAMAPI_API uint32 SteamAPI_ISteamInput_GetRemotePlaySessionID( ISteamInput* self, InputHandle_t inputHandle ); +STEAMAPI_API uint16 SteamAPI_ISteamInput_GetSessionInputConfigurationSettings( ISteamInput* self ); // ISteamController STEAMAPI_API ISteamController *SteamAPI_SteamController_v007(); @@ -739,6 +766,8 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_AddAppDependency( ISteamUGC* self STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_RemoveAppDependency( ISteamUGC* self, PublishedFileId_t nPublishedFileID, AppId_t nAppID ); STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_GetAppDependencies( ISteamUGC* self, PublishedFileId_t nPublishedFileID ); STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_DeleteItem( ISteamUGC* self, PublishedFileId_t nPublishedFileID ); +STEAMAPI_API bool SteamAPI_ISteamUGC_ShowWorkshopEULA( ISteamUGC* self ); +STEAMAPI_API SteamAPICall_t SteamAPI_ISteamUGC_GetWorkshopEULAStatus( ISteamUGC* self ); // ISteamAppList STEAMAPI_API ISteamAppList *SteamAPI_SteamAppList_v001(); @@ -936,6 +965,7 @@ STEAMAPI_API void SteamAPI_ISteamNetworkingCustomSignalingRecvContext_SendReject // ISteamNetworkingUtils STEAMAPI_API ISteamNetworkingUtils *SteamAPI_SteamNetworkingUtils_SteamAPI_v003(); +STEAMAPI_API ISteamNetworkingUtils *SteamAPI_SteamNetworkingUtils_SteamAPI_v004(); STEAMAPI_API ISteamNetworkingUtils *SteamAPI_SteamNetworkingUtils_v003(); STEAMAPI_API SteamNetworkingMessage_t * SteamAPI_ISteamNetworkingUtils_AllocateMessage( ISteamNetworkingUtils* self, int cbAllocateBuffer ); STEAMAPI_API void SteamAPI_ISteamNetworkingUtils_InitRelayNetworkAccess( ISteamNetworkingUtils* self ); @@ -976,6 +1006,7 @@ STEAMAPI_API bool SteamAPI_ISteamNetworkingUtils_SteamNetworkingIdentity_ParseSt // ISteamGameServer STEAMAPI_API ISteamGameServer *SteamAPI_SteamGameServer_v013(); +STEAMAPI_API ISteamGameServer *SteamAPI_SteamGameServer_v014(); STEAMAPI_API void SteamAPI_ISteamGameServer_SetProduct( ISteamGameServer* self, const char * pszProduct ); STEAMAPI_API void SteamAPI_ISteamGameServer_SetGameDescription( ISteamGameServer* self, const char * pszGameDescription ); STEAMAPI_API void SteamAPI_ISteamGameServer_SetModDir( ISteamGameServer* self, const char * pszModDir ); @@ -1003,6 +1034,7 @@ STEAMAPI_API bool SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( ISte STEAMAPI_API uint64_steamid SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( ISteamGameServer* self ); STEAMAPI_API void SteamAPI_ISteamGameServer_SendUserDisconnect( ISteamGameServer* self, uint64_steamid steamIDUser ); STEAMAPI_API bool SteamAPI_ISteamGameServer_BUpdateUserData( ISteamGameServer* self, uint64_steamid steamIDUser, const char * pchPlayerName, uint32 uScore ); +STEAMAPI_API void SteamAPI_ISteamGameServer_SetAdvertiseServerActive( ISteamGameServer* self, bool bActive ); STEAMAPI_API HAuthTicket SteamAPI_ISteamGameServer_GetAuthSessionTicket( ISteamGameServer* self, void * pTicket, int cbMaxTicket, uint32 * pcbTicket ); STEAMAPI_API EBeginAuthSessionResult SteamAPI_ISteamGameServer_BeginAuthSession( ISteamGameServer* self, const void * pAuthTicket, int cbAuthTicket, uint64_steamid steamID ); STEAMAPI_API void SteamAPI_ISteamGameServer_EndAuthSession( ISteamGameServer* self, uint64_steamid steamID ); @@ -1019,6 +1051,9 @@ STEAMAPI_API void SteamAPI_ISteamGameServer_SetHeartbeatInterval( ISteamGameServ STEAMAPI_API void SteamAPI_ISteamGameServer_ForceHeartbeat( ISteamGameServer* self ); STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_AssociateWithClan( ISteamGameServer* self, uint64_steamid steamIDClan ); STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( ISteamGameServer* self, uint64_steamid steamIDNewPlayer ); +STEAMAPI_API bool SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate_DEPRECATED( ISteamGameServer* self, uint32 unIPClient, const void * pvAuthBlob, uint32 cubAuthBlobSize, CSteamID * pSteamIDUser ); +STEAMAPI_API void SteamAPI_ISteamGameServer_SendUserDisconnect_DEPRECATED( ISteamGameServer* self, uint64_steamid steamIDUser ); + // ISteamGameServerStats STEAMAPI_API ISteamGameServerStats *SteamAPI_SteamGameServerStats_v001(); diff --git a/sdk_includes/steam_api_internal.h b/sdk_includes/steam_api_internal.h index e743324..5c89097 100644 --- a/sdk_includes/steam_api_internal.h +++ b/sdk_includes/steam_api_internal.h @@ -311,11 +311,36 @@ enum { k_iClientSTARCallbacks = 5600 }; enum { k_iSteamRemotePlayCallbacks = 5700 }; enum { k_iClientCompatCallbacks = 5800 }; enum { k_iSteamChatCallbacks = 5900 }; +enum { k_iClientNetworkingUtilsCallbacks = 6000 }; +enum { k_iClientSystemManagerCallbacks = 6100 }; +enum { k_iClientStorageDeviceManagerCallbacks = 6200 }; #ifdef _MSVC_VER #pragma warning( pop ) #endif +// Macros used to annotate various Steamworks interfaces to generate the +// flat API +#ifdef API_GEN +# define STEAM_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR ))) +#else +# define STEAM_CLANG_ATTR(ATTR) +#endif + +#define STEAM_OUT_STRUCT() STEAM_CLANG_ATTR( "out_struct: ;" ) +#define STEAM_OUT_STRING() STEAM_CLANG_ATTR( "out_string: ;" ) +#define STEAM_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) STEAM_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" ) +#define STEAM_OUT_ARRAY_COUNT(COUNTER, DESC) STEAM_CLANG_ATTR( "out_array_count:" #COUNTER ";desc:" #DESC ) +#define STEAM_ARRAY_COUNT(COUNTER) STEAM_CLANG_ATTR( "array_count:" #COUNTER ";" ) +#define STEAM_ARRAY_COUNT_D(COUNTER, DESC) STEAM_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC ) +#define STEAM_BUFFER_COUNT(COUNTER) STEAM_CLANG_ATTR( "buffer_count:" #COUNTER ";" ) +#define STEAM_OUT_BUFFER_COUNT(COUNTER) STEAM_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" ) +#define STEAM_OUT_STRING_COUNT(COUNTER) STEAM_CLANG_ATTR( "out_string_count:" #COUNTER ";" ) +#define STEAM_DESC(DESC) STEAM_CLANG_ATTR("desc:" #DESC ";") +#define STEAM_CALL_RESULT(RESULT_TYPE) STEAM_CLANG_ATTR("callresult:" #RESULT_TYPE ";") +#define STEAM_CALL_BACK(RESULT_TYPE) STEAM_CLANG_ATTR("callback:" #RESULT_TYPE ";") +#define STEAM_FLAT_NAME(NAME) STEAM_CLANG_ATTR("flat_name:" #NAME ";") + // CSteamAPIContext encapsulates the Steamworks API global accessors into // a single object. // diff --git a/sdk_includes/steam_gameserver.h b/sdk_includes/steam_gameserver.h index e494f7e..c913f12 100644 --- a/sdk_includes/steam_gameserver.h +++ b/sdk_includes/steam_gameserver.h @@ -12,6 +12,7 @@ #include "steam_api.h" #include "isteamgameserver.h" +#include "isteamgameserver013.h" #include "isteamgameserver012.h" #include "isteamgameserver011.h" #include "isteamgameserver010.h" @@ -29,10 +30,13 @@ enum EServerMode }; /// Pass to SteamGameServer_Init to indicate that the same UDP port will be used for game traffic -/// UDP queries. In this case, Steam will not open up a socket to handle server browser queries, -/// and you must use ISteamGameServer::HandleIncomingPacket and ISteamGameServer::GetNextOutgoingPacket -/// to handle packets related to server discovery on your socket. -#define MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE ((uint16)-1) +/// UDP queries for server browser pings and LAN discovery. In this case, Steam will not open up a +/// socket to handle server browser queries, and you must use ISteamGameServer::HandleIncomingPacket +/// and ISteamGameServer::GetNextOutgoingPacket to handle packets related to server discovery on your socket. +const uint16 STEAMGAMESERVER_QUERY_PORT_SHARED = 0xffff; + +// DEPRECATED: This old name was really confusing. +#define MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE ((uint16)-1) // Initialize SteamGameServer client and interface objects, and set server properties which may not be changed. // @@ -51,9 +55,10 @@ enum EServerMode // - usGamePort is the port that clients will connect to for gameplay. You will usually open up your // own socket bound to this port. // - usQueryPort is the port that will manage server browser related duties and info -// pings from clients. If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE for usQueryPort, then it +// pings from clients. If you pass STEAMGAMESERVER_QUERY_PORT_SHARED for usQueryPort, then it // will use "GameSocketShare" mode, which means that the game is responsible for sending and receiving -// UDP packets for the master server updater. See references to GameSocketShare in isteamgameserver.h. +// UDP packets for the master server updater. (See ISteamGameServer::HandleIncomingPacket and +// ISteamGameServer::GetNextOutgoingPacket.) // - The version string should be in the form x.x.x.x, and is used by the master server to detect when the // server is out of date. (Only servers with the latest version will be listed.) #ifndef STEAM_API_EXPORTS diff --git a/sdk_includes/steamclientpublic.h b/sdk_includes/steamclientpublic.h index 4d5aedf..6f9962f 100644 --- a/sdk_includes/steamclientpublic.h +++ b/sdk_includes/steamclientpublic.h @@ -145,6 +145,9 @@ enum EResult k_EResultNoLauncherSpecified = 117, // No launcher was specified, but a launcher was needed to choose correct realm for operation. k_EResultMustAgreeToSSA = 118, // User must agree to china SSA or global SSA before login k_EResultLauncherMigrated = 119, // The specified launcher type is no longer supported; the user should be directed elsewhere + k_EResultSteamRealmMismatch = 120, // The user's realm does not match the realm of the requested resource + k_EResultInvalidSignature = 121, // signature check did not match + k_EResultParseFailure = 122, // Failed to parse input }; // Error codes for use with the voice functions diff --git a/sdk_includes/steamnetworkingtypes.h b/sdk_includes/steamnetworkingtypes.h index 6616a1f..62bd65e 100644 --- a/sdk_includes/steamnetworkingtypes.h +++ b/sdk_includes/steamnetworkingtypes.h @@ -1057,31 +1057,10 @@ enum ESteamNetworkingConfigValue { k_ESteamNetworkingConfig_Invalid = 0, - /// [global float, 0--100] Randomly discard N pct of packets instead of sending/recv - /// This is a global option only, since it is applied at a low level - /// where we don't have much context - k_ESteamNetworkingConfig_FakePacketLoss_Send = 2, - k_ESteamNetworkingConfig_FakePacketLoss_Recv = 3, - /// [global int32]. Delay all outbound/inbound packets by N ms - k_ESteamNetworkingConfig_FakePacketLag_Send = 4, - k_ESteamNetworkingConfig_FakePacketLag_Recv = 5, - - /// [global float] 0-100 Percentage of packets we will add additional delay - /// to (causing them to be reordered) - k_ESteamNetworkingConfig_FakePacketReorder_Send = 6, - k_ESteamNetworkingConfig_FakePacketReorder_Recv = 7, - - /// [global int32] Extra delay, in ms, to apply to reordered packets. - k_ESteamNetworkingConfig_FakePacketReorder_Time = 8, - - /// [global float 0--100] Globally duplicate some percentage of packets we send - k_ESteamNetworkingConfig_FakePacketDup_Send = 26, - k_ESteamNetworkingConfig_FakePacketDup_Recv = 27, - - /// [global int32] Amount of delay, in ms, to delay duplicated packets. - /// (We chose a random delay between 0 and this value) - k_ESteamNetworkingConfig_FakePacketDup_TimeMax = 28, +// +// Connection options +// /// [connection int32] Timeout value (in ms) to use when first connecting k_ESteamNetworkingConfig_TimeoutInitial = 24, @@ -1094,6 +1073,41 @@ enum ESteamNetworkingConfigValue /// Default is 512k (524288 bytes) k_ESteamNetworkingConfig_SendBufferSize = 9, + /// [connection int64] Get/set userdata as a configuration option. + /// The default value is -1. You may want to set the user data as + /// a config value, instead of using ISteamNetworkingSockets::SetConnectionUserData + /// in two specific instances: + /// + /// - You wish to set the userdata atomically when creating + /// an outbound connection, so that the userdata is filled in properly + /// for any callbacks that happen. However, note that this trick + /// only works for connections initiated locally! For incoming + /// connections, multiple state transitions may happen and + /// callbacks be queued, before you are able to service the first + /// callback! Be careful! + /// + /// - You can set the default userdata for all newly created connections + /// by setting this value at a higher level (e.g. on the listen + /// socket or at the global level.) Then this default + /// value will be inherited when the connection is created. + /// This is useful in case -1 is a valid userdata value, and you + /// wish to use something else as the default value so you can + /// tell if it has been set or not. + /// + /// HOWEVER: once a connection is created, the effective value is + /// then bound to the connection. Unlike other connection options, + /// if you change it again at a higher level, the new value will not + /// be inherited by connections. + /// + /// Using the userdata field in callback structs is not advised because + /// of tricky race conditions. Instead, you might try one of these methods: + /// + /// - Use a separate map with the HSteamNetConnection as the key. + /// - Fetch the userdata from the connection in your callback + /// using ISteamNetworkingSockets::GetConnectionUserData, to + // ensure you have the current value. + k_ESteamNetworkingConfig_ConnectionUserData = 40, + /// [connection int32] Minimum/maximum send rate clamp, 0 is no limit. /// This value will control the min/max allowed sending rate that /// bandwidth estimation is allowed to reach. Default is 0 (no-limit) @@ -1253,6 +1267,58 @@ enum ESteamNetworkingConfigValue /// This value should not be read or written in any other context. k_ESteamNetworkingConfig_LocalVirtualPort = 38, +// +// Simulating network conditions +// +// These are global (not per-connection) because they apply at +// a relatively low UDP layer. +// + + /// [global float, 0--100] Randomly discard N pct of packets instead of sending/recv + /// This is a global option only, since it is applied at a low level + /// where we don't have much context + k_ESteamNetworkingConfig_FakePacketLoss_Send = 2, + k_ESteamNetworkingConfig_FakePacketLoss_Recv = 3, + + /// [global int32]. Delay all outbound/inbound packets by N ms + k_ESteamNetworkingConfig_FakePacketLag_Send = 4, + k_ESteamNetworkingConfig_FakePacketLag_Recv = 5, + + /// [global float] 0-100 Percentage of packets we will add additional delay + /// to (causing them to be reordered) + k_ESteamNetworkingConfig_FakePacketReorder_Send = 6, + k_ESteamNetworkingConfig_FakePacketReorder_Recv = 7, + + /// [global int32] Extra delay, in ms, to apply to reordered packets. + k_ESteamNetworkingConfig_FakePacketReorder_Time = 8, + + /// [global float 0--100] Globally duplicate some percentage of packets we send + k_ESteamNetworkingConfig_FakePacketDup_Send = 26, + k_ESteamNetworkingConfig_FakePacketDup_Recv = 27, + + /// [global int32] Amount of delay, in ms, to delay duplicated packets. + /// (We chose a random delay between 0 and this value) + k_ESteamNetworkingConfig_FakePacketDup_TimeMax = 28, + + /// [global int32] Trace every UDP packet, similar to Wireshark or tcpdump. + /// Value is max number of bytes to dump. -1 disables tracing. + // 0 only traces the info but no actual data bytes + k_ESteamNetworkingConfig_PacketTraceMaxBytes = 41, + + + // [global int32] Global UDP token bucket rate limits. + // "Rate" refers to the steady state rate. (Bytes/sec, the + // rate that tokens are put into the bucket.) "Burst" + // refers to the max amount that could be sent in a single + // burst. (In bytes, the max capacity of the bucket.) + // Rate=0 disables the limiter entirely, which is the default. + // Burst=0 disables burst. (This is not realistic. A + // burst of at least 4K is recommended; the default is higher.) + k_ESteamNetworkingConfig_FakeRateLimit_Send_Rate = 42, + k_ESteamNetworkingConfig_FakeRateLimit_Send_Burst = 43, + k_ESteamNetworkingConfig_FakeRateLimit_Recv_Rate = 44, + k_ESteamNetworkingConfig_FakeRateLimit_Recv_Burst = 45, + // // Callbacks //