steamclientpublic.h 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. //========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef STEAMCLIENTPUBLIC_H
  7. #define STEAMCLIENTPUBLIC_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //lint -save -e1931 -e1927 -e1924 -e613 -e726
  12. // This header file defines the interface between the calling application and the code that
  13. // knows how to communicate with the connection manager (CM) from the Steam service
  14. // This header file is intended to be portable; ideally this 1 header file plus a lib or dll
  15. // is all you need to integrate the client library into some other tree. So please avoid
  16. // including or requiring other header files if possible. This header should only describe the
  17. // interface layer, no need to include anything about the implementation.
  18. #include "steamtypes.h"
  19. #include "steamuniverse.h"
  20. // General result codes
  21. enum EResult
  22. {
  23. k_EResultOK = 1, // success
  24. k_EResultFail = 2, // generic failure
  25. k_EResultNoConnection = 3, // no/failed network connection
  26. // k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
  27. k_EResultInvalidPassword = 5, // password/ticket is invalid
  28. k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere
  29. k_EResultInvalidProtocolVer = 7, // protocol version is incorrect
  30. k_EResultInvalidParam = 8, // a parameter is incorrect
  31. k_EResultFileNotFound = 9, // file was not found
  32. k_EResultBusy = 10, // called method busy - action not taken
  33. k_EResultInvalidState = 11, // called object was in an invalid state
  34. k_EResultInvalidName = 12, // name is invalid
  35. k_EResultInvalidEmail = 13, // email is invalid
  36. k_EResultDuplicateName = 14, // name is not unique
  37. k_EResultAccessDenied = 15, // access is denied
  38. k_EResultTimeout = 16, // operation timed out
  39. k_EResultBanned = 17, // VAC2 banned
  40. k_EResultAccountNotFound = 18, // account not found
  41. k_EResultInvalidSteamID = 19, // steamID is invalid
  42. k_EResultServiceUnavailable = 20, // The requested service is currently unavailable
  43. k_EResultNotLoggedOn = 21, // The user is not logged on
  44. k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party)
  45. k_EResultEncryptionFailure = 23, // Encryption or Decryption failed
  46. k_EResultInsufficientPrivilege = 24, // Insufficient privilege
  47. k_EResultLimitExceeded = 25, // Too much of a good thing
  48. k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes)
  49. k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired
  50. k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again
  51. k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time
  52. k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user
  53. k_EResultIPNotFound = 31, // IP address not found
  54. k_EResultPersistFailed = 32, // failed to write change to the data store
  55. k_EResultLockingFailed = 33, // failed to acquire access lock for this operation
  56. k_EResultLogonSessionReplaced = 34,
  57. k_EResultConnectFailed = 35,
  58. k_EResultHandshakeFailed = 36,
  59. k_EResultIOFailure = 37,
  60. k_EResultRemoteDisconnect = 38,
  61. k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested
  62. k_EResultBlocked = 40, // a user didn't allow it
  63. k_EResultIgnored = 41, // target is ignoring sender
  64. k_EResultNoMatch = 42, // nothing matching the request found
  65. k_EResultAccountDisabled = 43,
  66. k_EResultServiceReadOnly = 44, // this service is not accepting content changes right now
  67. k_EResultAccountNotFeatured = 45, // account doesn't have value, so this feature isn't available
  68. k_EResultAdministratorOK = 46, // allowed to take this action, but only because requester is admin
  69. k_EResultContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol.
  70. k_EResultTryAnotherCM = 48, // The current CM can't service the user making a request, user should try another.
  71. k_EResultPasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed.
  72. k_EResultAlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait
  73. k_EResultSuspended = 51, // Long running operation (content download) suspended/paused
  74. k_EResultCancelled = 52, // Operation canceled (typically by user: content download)
  75. k_EResultDataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable
  76. k_EResultDiskFull = 54, // Operation canceled - not enough disk space.
  77. k_EResultRemoteCallFailed = 55, // an remote call or IPC call failed
  78. k_EResultPasswordUnset = 56, // Password could not be verified as it's unset server side
  79. k_EResultExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account
  80. k_EResultPSNTicketInvalid = 58, // PSN ticket was invalid
  81. k_EResultExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first
  82. k_EResultRemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files
  83. k_EResultIllegalPassword = 61, // The requested new password is not legal
  84. k_EResultSameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer )
  85. k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure
  86. k_EResultCannotUseOldPassword = 64, // The requested new password is not legal
  87. k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid
  88. k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
  89. k_EResultHardwareNotCapableOfIPT = 67, //
  90. k_EResultIPTInitError = 68, //
  91. k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
  92. k_EResultFacebookQueryError = 70, // Facebook query returned an error
  93. k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired
  94. k_EResultIPLoginRestrictionFailed = 72,
  95. k_EResultAccountLockedDown = 73,
  96. k_EResultAccountLogonDeniedVerifiedEmailRequired = 74,
  97. k_EResultNoMatchingURL = 75,
  98. k_EResultBadResponse = 76, // parse failure, missing field, etc.
  99. k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password
  100. k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range
  101. k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen
  102. k_EResultDisabled = 80, // The requested service has been configured to be unavailable
  103. k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid !
  104. k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action
  105. k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted
  106. k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
  107. k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
  108. k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted
  109. k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
  110. k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch
  111. k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
  112. k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
  113. k_EResultNotModified = 91, // data not modified
  114. k_EResultNoMobileDevice = 92, // the account does not have a mobile device associated with it
  115. k_EResultTimeNotSynced = 93, // the time presented is out of range or tolerance
  116. k_EResultSmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.)
  117. k_EResultAccountLimitExceeded = 95, // Too many accounts access this resource
  118. k_EResultAccountActivityLimitExceeded = 96, // Too many changes to this account
  119. k_EResultPhoneActivityLimitExceeded = 97, // Too many changes to this phone
  120. k_EResultRefundToWallet = 98, // Cannot refund to payment method, must use wallet
  121. k_EResultEmailSendFailure = 99, // Cannot send an email
  122. k_EResultNotSettled = 100, // Can't perform operation till payment has settled
  123. k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha
  124. k_EResultGSLTDenied = 102, // a game server login token owned by this token's owner has been banned
  125. k_EResultGSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
  126. k_EResultInvalidItemType = 104, // the type of thing we were requested to act on is invalid
  127. k_EResultIPBanned = 105, // the ip address has been banned from taking this action
  128. k_EResultGSLTExpired = 106, // this token has expired from disuse; can be reset for use
  129. };
  130. // Error codes for use with the voice functions
  131. enum EVoiceResult
  132. {
  133. k_EVoiceResultOK = 0,
  134. k_EVoiceResultNotInitialized = 1,
  135. k_EVoiceResultNotRecording = 2,
  136. k_EVoiceResultNoData = 3,
  137. k_EVoiceResultBufferTooSmall = 4,
  138. k_EVoiceResultDataCorrupted = 5,
  139. k_EVoiceResultRestricted = 6,
  140. k_EVoiceResultUnsupportedCodec = 7,
  141. k_EVoiceResultReceiverOutOfDate = 8,
  142. k_EVoiceResultReceiverDidNotAnswer = 9,
  143. };
  144. // Result codes to GSHandleClientDeny/Kick
  145. enum EDenyReason
  146. {
  147. k_EDenyInvalid = 0,
  148. k_EDenyInvalidVersion = 1,
  149. k_EDenyGeneric = 2,
  150. k_EDenyNotLoggedOn = 3,
  151. k_EDenyNoLicense = 4,
  152. k_EDenyCheater = 5,
  153. k_EDenyLoggedInElseWhere = 6,
  154. k_EDenyUnknownText = 7,
  155. k_EDenyIncompatibleAnticheat = 8,
  156. k_EDenyMemoryCorruption = 9,
  157. k_EDenyIncompatibleSoftware = 10,
  158. k_EDenySteamConnectionLost = 11,
  159. k_EDenySteamConnectionError = 12,
  160. k_EDenySteamResponseTimedOut = 13,
  161. k_EDenySteamValidationStalled = 14,
  162. k_EDenySteamOwnerLeftGuestUser = 15,
  163. };
  164. // return type of GetAuthSessionTicket
  165. typedef uint32 HAuthTicket;
  166. const HAuthTicket k_HAuthTicketInvalid = 0;
  167. // results from BeginAuthSession
  168. enum EBeginAuthSessionResult
  169. {
  170. k_EBeginAuthSessionResultOK = 0, // Ticket is valid for this game and this steamID.
  171. k_EBeginAuthSessionResultInvalidTicket = 1, // Ticket is not valid.
  172. k_EBeginAuthSessionResultDuplicateRequest = 2, // A ticket has already been submitted for this steamID
  173. k_EBeginAuthSessionResultInvalidVersion = 3, // Ticket is from an incompatible interface version
  174. k_EBeginAuthSessionResultGameMismatch = 4, // Ticket is not for this game
  175. k_EBeginAuthSessionResultExpiredTicket = 5, // Ticket has expired
  176. };
  177. // Callback values for callback ValidateAuthTicketResponse_t which is a response to BeginAuthSession
  178. enum EAuthSessionResponse
  179. {
  180. k_EAuthSessionResponseOK = 0, // Steam has verified the user is online, the ticket is valid and ticket has not been reused.
  181. k_EAuthSessionResponseUserNotConnectedToSteam = 1, // The user in question is not connected to steam
  182. k_EAuthSessionResponseNoLicenseOrExpired = 2, // The license has expired.
  183. k_EAuthSessionResponseVACBanned = 3, // The user is VAC banned for this game.
  184. k_EAuthSessionResponseLoggedInElseWhere = 4, // The user account has logged in elsewhere and the session containing the game instance has been disconnected.
  185. k_EAuthSessionResponseVACCheckTimedOut = 5, // VAC has been unable to perform anti-cheat checks on this user
  186. k_EAuthSessionResponseAuthTicketCanceled = 6, // The ticket has been canceled by the issuer
  187. k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid.
  188. k_EAuthSessionResponseAuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam.
  189. k_EAuthSessionResponsePublisherIssuedBan = 9, // The user is banned for this game. The ban came via the web api and not VAC
  190. };
  191. // results from UserHasLicenseForApp
  192. enum EUserHasLicenseForAppResult
  193. {
  194. k_EUserHasLicenseResultHasLicense = 0, // User has a license for specified app
  195. k_EUserHasLicenseResultDoesNotHaveLicense = 1, // User does not have a license for the specified app
  196. k_EUserHasLicenseResultNoAuth = 2, // User has not been authenticated
  197. };
  198. // Steam account types
  199. enum EAccountType
  200. {
  201. k_EAccountTypeInvalid = 0,
  202. k_EAccountTypeIndividual = 1, // single user account
  203. k_EAccountTypeMultiseat = 2, // multiseat (e.g. cybercafe) account
  204. k_EAccountTypeGameServer = 3, // game server account
  205. k_EAccountTypeAnonGameServer = 4, // anonymous game server account
  206. k_EAccountTypePending = 5, // pending
  207. k_EAccountTypeContentServer = 6, // content server
  208. k_EAccountTypeClan = 7,
  209. k_EAccountTypeChat = 8,
  210. k_EAccountTypeConsoleUser = 9, // Fake SteamID for local PSN account on PS3 or Live account on 360, etc.
  211. k_EAccountTypeAnonUser = 10,
  212. // Max of 16 items in this field
  213. k_EAccountTypeMax
  214. };
  215. //-----------------------------------------------------------------------------
  216. // Purpose:
  217. //-----------------------------------------------------------------------------
  218. enum EAppReleaseState
  219. {
  220. k_EAppReleaseState_Unknown = 0, // unknown, required appinfo or license info is missing
  221. k_EAppReleaseState_Unavailable = 1, // even if user 'just' owns it, can see game at all
  222. k_EAppReleaseState_Prerelease = 2, // can be purchased and is visible in games list, nothing else. Common appInfo section released
  223. k_EAppReleaseState_PreloadOnly = 3, // owners can preload app, not play it. AppInfo fully released.
  224. k_EAppReleaseState_Released = 4, // owners can download and play app.
  225. };
  226. //-----------------------------------------------------------------------------
  227. // Purpose:
  228. //-----------------------------------------------------------------------------
  229. enum EAppOwnershipFlags
  230. {
  231. k_EAppOwnershipFlags_None = 0x0000, // unknown
  232. k_EAppOwnershipFlags_OwnsLicense = 0x0001, // owns license for this game
  233. k_EAppOwnershipFlags_FreeLicense = 0x0002, // not paid for game
  234. k_EAppOwnershipFlags_RegionRestricted = 0x0004, // owns app, but not allowed to play in current region
  235. k_EAppOwnershipFlags_LowViolence = 0x0008, // only low violence version
  236. k_EAppOwnershipFlags_InvalidPlatform = 0x0010, // app not supported on current platform
  237. k_EAppOwnershipFlags_SharedLicense = 0x0020, // license was granted by authorized local device
  238. k_EAppOwnershipFlags_FreeWeekend = 0x0040, // owned by a free weekend licenses
  239. k_EAppOwnershipFlags_RetailLicense = 0x0080, // has a retail license for game, (CD-Key etc)
  240. k_EAppOwnershipFlags_LicenseLocked = 0x0100, // shared license is locked (in use) by other user
  241. k_EAppOwnershipFlags_LicensePending = 0x0200, // owns app, but transaction is still pending. Can't install or play
  242. k_EAppOwnershipFlags_LicenseExpired = 0x0400, // doesn't own app anymore since license expired
  243. k_EAppOwnershipFlags_LicensePermanent = 0x0800, // permanent license, not borrowed, or guest or freeweekend etc
  244. k_EAppOwnershipFlags_LicenseRecurring = 0x1000, // Recurring license, user is charged periodically
  245. k_EAppOwnershipFlags_LicenseCanceled = 0x2000, // Mark as canceled, but might be still active if recurring
  246. k_EAppOwnershipFlags_AutoGrant = 0x4000, // Ownership is based on any kind of autogrant license
  247. k_EAppOwnershipFlags_PendingGift = 0x8000, // user has pending gift to redeem
  248. k_EAppOwnershipFlags_RentalNotActivated = 0x10000, // Rental hasn't been activated yet
  249. k_EAppOwnershipFlags_Rental = 0x20000, // Is a rental
  250. };
  251. //-----------------------------------------------------------------------------
  252. // Purpose: designed as flags to allow filters masks
  253. //-----------------------------------------------------------------------------
  254. enum EAppType
  255. {
  256. k_EAppType_Invalid = 0x000, // unknown / invalid
  257. k_EAppType_Game = 0x001, // playable game, default type
  258. k_EAppType_Application = 0x002, // software application
  259. k_EAppType_Tool = 0x004, // SDKs, editors & dedicated servers
  260. k_EAppType_Demo = 0x008, // game demo
  261. k_EAppType_Media_DEPRECATED = 0x010, // legacy - was used for game trailers, which are now just videos on the web
  262. k_EAppType_DLC = 0x020, // down loadable content
  263. k_EAppType_Guide = 0x040, // game guide, PDF etc
  264. k_EAppType_Driver = 0x080, // hardware driver updater (ATI, Razor etc)
  265. k_EAppType_Config = 0x100, // hidden app used to config Steam features (backpack, sales, etc)
  266. k_EAppType_Hardware = 0x200, // a hardware device (Steam Machine, Steam Controller, Steam Link, etc.)
  267. k_EAppType_Franchise = 0x400, // A hub for collections of multiple apps, eg films, series, games
  268. k_EAppType_Video = 0x800, // A video component of either a Film or TVSeries (may be the feature, an episode, preview, making-of, etc)
  269. k_EAppType_Plugin = 0x1000, // Plug-in types for other Apps
  270. k_EAppType_Music = 0x2000, // Music files
  271. k_EAppType_Series = 0x4000, // Container app for video series
  272. k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only
  273. k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace
  274. };
  275. //-----------------------------------------------------------------------------
  276. // types of user game stats fields
  277. // WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE
  278. //-----------------------------------------------------------------------------
  279. enum ESteamUserStatType
  280. {
  281. k_ESteamUserStatTypeINVALID = 0,
  282. k_ESteamUserStatTypeINT = 1,
  283. k_ESteamUserStatTypeFLOAT = 2,
  284. // Read as FLOAT, set with count / session length
  285. k_ESteamUserStatTypeAVGRATE = 3,
  286. k_ESteamUserStatTypeACHIEVEMENTS = 4,
  287. k_ESteamUserStatTypeGROUPACHIEVEMENTS = 5,
  288. // max, for sanity checks
  289. k_ESteamUserStatTypeMAX
  290. };
  291. //-----------------------------------------------------------------------------
  292. // Purpose: Chat Entry Types (previously was only friend-to-friend message types)
  293. //-----------------------------------------------------------------------------
  294. enum EChatEntryType
  295. {
  296. k_EChatEntryTypeInvalid = 0,
  297. k_EChatEntryTypeChatMsg = 1, // Normal text message from another user
  298. k_EChatEntryTypeTyping = 2, // Another user is typing (not used in multi-user chat)
  299. k_EChatEntryTypeInviteGame = 3, // Invite from other user into that users current game
  300. k_EChatEntryTypeEmote = 4, // text emote message (deprecated, should be treated as ChatMsg)
  301. //k_EChatEntryTypeLobbyGameStart = 5, // lobby game is starting (dead - listen for LobbyGameCreated_t callback instead)
  302. k_EChatEntryTypeLeftConversation = 6, // user has left the conversation ( closed chat window )
  303. // Above are previous FriendMsgType entries, now merged into more generic chat entry types
  304. k_EChatEntryTypeEntered = 7, // user has entered the conversation (used in multi-user chat and group chat)
  305. k_EChatEntryTypeWasKicked = 8, // user was kicked (data: 64-bit steamid of actor performing the kick)
  306. k_EChatEntryTypeWasBanned = 9, // user was banned (data: 64-bit steamid of actor performing the ban)
  307. k_EChatEntryTypeDisconnected = 10, // user disconnected
  308. k_EChatEntryTypeHistoricalChat = 11, // a chat message from user's chat history or offilne message
  309. //k_EChatEntryTypeReserved1 = 12, // No longer used
  310. //k_EChatEntryTypeReserved2 = 13, // No longer used
  311. k_EChatEntryTypeLinkBlocked = 14, // a link was removed by the chat filter.
  312. };
  313. //-----------------------------------------------------------------------------
  314. // Purpose: Chat Room Enter Responses
  315. //-----------------------------------------------------------------------------
  316. enum EChatRoomEnterResponse
  317. {
  318. k_EChatRoomEnterResponseSuccess = 1, // Success
  319. k_EChatRoomEnterResponseDoesntExist = 2, // Chat doesn't exist (probably closed)
  320. k_EChatRoomEnterResponseNotAllowed = 3, // General Denied - You don't have the permissions needed to join the chat
  321. k_EChatRoomEnterResponseFull = 4, // Chat room has reached its maximum size
  322. k_EChatRoomEnterResponseError = 5, // Unexpected Error
  323. k_EChatRoomEnterResponseBanned = 6, // You are banned from this chat room and may not join
  324. k_EChatRoomEnterResponseLimited = 7, // Joining this chat is not allowed because you are a limited user (no value on account)
  325. k_EChatRoomEnterResponseClanDisabled = 8, // Attempt to join a clan chat when the clan is locked or disabled
  326. k_EChatRoomEnterResponseCommunityBan = 9, // Attempt to join a chat when the user has a community lock on their account
  327. k_EChatRoomEnterResponseMemberBlockedYou = 10, // Join failed - some member in the chat has blocked you from joining
  328. k_EChatRoomEnterResponseYouBlockedMember = 11, // Join failed - you have blocked some member already in the chat
  329. // k_EChatRoomEnterResponseNoRankingDataLobby = 12, // No longer used
  330. // k_EChatRoomEnterResponseNoRankingDataUser = 13, // No longer used
  331. // k_EChatRoomEnterResponseRankOutOfRange = 14, // No longer used
  332. };
  333. typedef void (*PFNLegacyKeyRegistration)( const char *pchCDKey, const char *pchInstallPath );
  334. typedef bool (*PFNLegacyKeyInstalled)();
  335. const unsigned int k_unSteamAccountIDMask = 0xFFFFFFFF;
  336. const unsigned int k_unSteamAccountInstanceMask = 0x000FFFFF;
  337. // we allow 3 simultaneous user account instances right now, 1= desktop, 2 = console, 4 = web, 0 = all
  338. const unsigned int k_unSteamUserDesktopInstance = 1;
  339. const unsigned int k_unSteamUserConsoleInstance = 2;
  340. const unsigned int k_unSteamUserWebInstance = 4;
  341. // Special flags for Chat accounts - they go in the top 8 bits
  342. // of the steam ID's "instance", leaving 12 for the actual instances
  343. enum EChatSteamIDInstanceFlags
  344. {
  345. k_EChatAccountInstanceMask = 0x00000FFF, // top 8 bits are flags
  346. k_EChatInstanceFlagClan = ( k_unSteamAccountInstanceMask + 1 ) >> 1, // top bit
  347. k_EChatInstanceFlagLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 2, // next one down, etc
  348. k_EChatInstanceFlagMMSLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 3, // next one down, etc
  349. // Max of 8 flags
  350. };
  351. //-----------------------------------------------------------------------------
  352. // Purpose: Marketing message flags that change how a client should handle them
  353. //-----------------------------------------------------------------------------
  354. enum EMarketingMessageFlags
  355. {
  356. k_EMarketingMessageFlagsNone = 0,
  357. k_EMarketingMessageFlagsHighPriority = 1 << 0,
  358. k_EMarketingMessageFlagsPlatformWindows = 1 << 1,
  359. k_EMarketingMessageFlagsPlatformMac = 1 << 2,
  360. k_EMarketingMessageFlagsPlatformLinux = 1 << 3,
  361. //aggregate flags
  362. k_EMarketingMessageFlagsPlatformRestrictions =
  363. k_EMarketingMessageFlagsPlatformWindows |
  364. k_EMarketingMessageFlagsPlatformMac |
  365. k_EMarketingMessageFlagsPlatformLinux,
  366. };
  367. //-----------------------------------------------------------------------------
  368. // Purpose: Possible positions to tell the overlay to show notifications in
  369. //-----------------------------------------------------------------------------
  370. enum ENotificationPosition
  371. {
  372. k_EPositionTopLeft = 0,
  373. k_EPositionTopRight = 1,
  374. k_EPositionBottomLeft = 2,
  375. k_EPositionBottomRight = 3,
  376. };
  377. //-----------------------------------------------------------------------------
  378. // Purpose: Broadcast upload result details
  379. //-----------------------------------------------------------------------------
  380. enum EBroadcastUploadResult
  381. {
  382. k_EBroadcastUploadResultNone = 0, // broadcast state unknown
  383. k_EBroadcastUploadResultOK = 1, // broadcast was good, no problems
  384. k_EBroadcastUploadResultInitFailed = 2, // broadcast init failed
  385. k_EBroadcastUploadResultFrameFailed = 3, // broadcast frame upload failed
  386. k_EBroadcastUploadResultTimeout = 4, // broadcast upload timed out
  387. k_EBroadcastUploadResultBandwidthExceeded = 5, // broadcast send too much data
  388. k_EBroadcastUploadResultLowFPS = 6, // broadcast FPS too low
  389. k_EBroadcastUploadResultMissingKeyFrames = 7, // broadcast sending not enough key frames
  390. k_EBroadcastUploadResultNoConnection = 8, // broadcast client failed to connect to relay
  391. k_EBroadcastUploadResultRelayFailed = 9, // relay dropped the upload
  392. k_EBroadcastUploadResultSettingsChanged = 10, // the client changed broadcast settings
  393. k_EBroadcastUploadResultMissingAudio = 11, // client failed to send audio data
  394. k_EBroadcastUploadResultTooFarBehind = 12, // clients was too slow uploading
  395. k_EBroadcastUploadResultTranscodeBehind = 13, // server failed to keep up with transcode
  396. };
  397. //-----------------------------------------------------------------------------
  398. // Purpose: codes for well defined launch options
  399. //-----------------------------------------------------------------------------
  400. enum ELaunchOptionType
  401. {
  402. k_ELaunchOptionType_None = 0, // unknown what launch option does
  403. k_ELaunchOptionType_Default = 1, // runs the game, app, whatever in default mode
  404. k_ELaunchOptionType_SafeMode = 2, // runs the game in safe mode
  405. k_ELaunchOptionType_Multiplayer = 3, // runs the game in multiplayer mode
  406. k_ELaunchOptionType_Config = 4, // runs config tool for this game
  407. k_ELaunchOptionType_OpenVR = 5, // runs game in VR mode using OpenVR
  408. k_ELaunchOptionType_Server = 6, // runs dedicated server for this game
  409. k_ELaunchOptionType_Editor = 7, // runs game editor
  410. k_ELaunchOptionType_Manual = 8, // shows game manual
  411. k_ELaunchOptionType_Benchmark = 9, // runs game benchmark
  412. k_ELaunchOptionType_Option1 = 10, // generic run option, uses description field for game name
  413. k_ELaunchOptionType_Option2 = 11, // generic run option, uses description field for game name
  414. k_ELaunchOptionType_Option3 = 12, // generic run option, uses description field for game name
  415. k_ELaunchOptionType_OculusVR = 13, // runs game in VR mode using the Oculus SDK
  416. k_ELaunchOptionType_OpenVROverlay = 14, // runs an OpenVR dashboard overlay
  417. k_ELaunchOptionType_OSVR = 15, // runs game in VR mode using the OSVR SDK
  418. k_ELaunchOptionType_Dialog = 1000, // show launch options dialog
  419. };
  420. //-----------------------------------------------------------------------------
  421. // Purpose: true if this launch option is any of the vr launching types
  422. //-----------------------------------------------------------------------------
  423. static inline bool BIsVRLaunchOptionType( const ELaunchOptionType eType )
  424. {
  425. return eType == k_ELaunchOptionType_OpenVR
  426. || eType == k_ELaunchOptionType_OpenVROverlay
  427. || eType == k_ELaunchOptionType_OculusVR
  428. || eType == k_ELaunchOptionType_OSVR;
  429. }
  430. //-----------------------------------------------------------------------------
  431. // Purpose: code points for VR HMD vendors and models
  432. // WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN A DATABASE
  433. //-----------------------------------------------------------------------------
  434. enum EVRHMDType
  435. {
  436. k_eEVRHMDType_None = -1, // unknown vendor and model
  437. k_eEVRHMDType_Unknown = 0, // unknown vendor and model
  438. k_eEVRHMDType_HTC_Dev = 1, // original HTC dev kits
  439. k_eEVRHMDType_HTC_VivePre = 2, // htc vive pre
  440. k_eEVRHMDType_HTC_Vive = 3, // htc vive consumer release
  441. k_eEVRHMDType_HTC_Unknown = 20, // unknown htc hmd
  442. k_eEVRHMDType_Oculus_DK1 = 21, // Oculus DK1
  443. k_eEVRHMDType_Oculus_DK2 = 22, // Oculus DK2
  444. k_eEVRHMDType_Oculus_Rift = 23, // Oculus rift
  445. k_eEVRHMDType_Oculus_Unknown = 40, // // Oculus unknown HMD
  446. };
  447. //-----------------------------------------------------------------------------
  448. // Purpose: Steam Controller models
  449. // WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN A DATABASE
  450. //-----------------------------------------------------------------------------
  451. enum EControllerType
  452. {
  453. k_eControllerType_None = -1,
  454. k_eControllerType_Unknown = 0,
  455. // Steam Controllers
  456. k_eControllerType_UnknownSteamController = 1,
  457. k_eControllerType_SteamController = 2,
  458. // Other Controllers
  459. k_eControllerType_UnknownNonSteamController = 30,
  460. k_eControllerType_XBox360Controller = 31,
  461. k_eControllerType_XBoxOneController = 32,
  462. k_eControllerType_PS3Controller = 33,
  463. k_eControllerType_PS4Controller = 34,
  464. k_eControllerType_WiiController = 35,
  465. k_eControllerType_AppleController = 36
  466. };
  467. //-----------------------------------------------------------------------------
  468. // Purpose: true if this is from an Oculus HMD
  469. //-----------------------------------------------------------------------------
  470. static inline bool BIsOculusHMD( EVRHMDType eType )
  471. {
  472. return eType == k_eEVRHMDType_Oculus_DK1 || eType == k_eEVRHMDType_Oculus_DK2 || eType == k_eEVRHMDType_Oculus_Rift || eType == k_eEVRHMDType_Oculus_Unknown;
  473. }
  474. //-----------------------------------------------------------------------------
  475. // Purpose: true if this is from an Vive HMD
  476. //-----------------------------------------------------------------------------
  477. static inline bool BIsViveHMD( EVRHMDType eType )
  478. {
  479. return eType == k_eEVRHMDType_HTC_Dev || eType == k_eEVRHMDType_HTC_VivePre || eType == k_eEVRHMDType_HTC_Vive || eType == k_eEVRHMDType_HTC_Unknown;
  480. }
  481. #pragma pack( push, 1 )
  482. #define CSTEAMID_DEFINED
  483. // Steam ID structure (64 bits total)
  484. class CSteamID
  485. {
  486. public:
  487. //-----------------------------------------------------------------------------
  488. // Purpose: Constructor
  489. //-----------------------------------------------------------------------------
  490. CSteamID()
  491. {
  492. m_steamid.m_comp.m_unAccountID = 0;
  493. m_steamid.m_comp.m_EAccountType = k_EAccountTypeInvalid;
  494. m_steamid.m_comp.m_EUniverse = k_EUniverseInvalid;
  495. m_steamid.m_comp.m_unAccountInstance = 0;
  496. }
  497. //-----------------------------------------------------------------------------
  498. // Purpose: Constructor
  499. // Input : unAccountID - 32-bit account ID
  500. // eUniverse - Universe this account belongs to
  501. // eAccountType - Type of account
  502. //-----------------------------------------------------------------------------
  503. CSteamID( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType )
  504. {
  505. Set( unAccountID, eUniverse, eAccountType );
  506. }
  507. //-----------------------------------------------------------------------------
  508. // Purpose: Constructor
  509. // Input : unAccountID - 32-bit account ID
  510. // unAccountInstance - instance
  511. // eUniverse - Universe this account belongs to
  512. // eAccountType - Type of account
  513. //-----------------------------------------------------------------------------
  514. CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType )
  515. {
  516. #if defined(_SERVER) && defined(Assert)
  517. Assert( ! ( ( k_EAccountTypeIndividual == eAccountType ) && ( unAccountInstance > k_unSteamUserWebInstance ) ) ); // enforce that for individual accounts, instance is always 1
  518. #endif // _SERVER
  519. InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType );
  520. }
  521. //-----------------------------------------------------------------------------
  522. // Purpose: Constructor
  523. // Input : ulSteamID - 64-bit representation of a Steam ID
  524. // Note: Will not accept a uint32 or int32 as input, as that is a probable mistake.
  525. // See the stubbed out overloads in the private: section for more info.
  526. //-----------------------------------------------------------------------------
  527. CSteamID( uint64 ulSteamID )
  528. {
  529. SetFromUint64( ulSteamID );
  530. }
  531. #ifdef INT64_DIFFERENT_FROM_INT64_T
  532. CSteamID( uint64_t ulSteamID )
  533. {
  534. SetFromUint64( (uint64)ulSteamID );
  535. }
  536. #endif
  537. //-----------------------------------------------------------------------------
  538. // Purpose: Sets parameters for steam ID
  539. // Input : unAccountID - 32-bit account ID
  540. // eUniverse - Universe this account belongs to
  541. // eAccountType - Type of account
  542. //-----------------------------------------------------------------------------
  543. void Set( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType )
  544. {
  545. m_steamid.m_comp.m_unAccountID = unAccountID;
  546. m_steamid.m_comp.m_EUniverse = eUniverse;
  547. m_steamid.m_comp.m_EAccountType = eAccountType;
  548. if ( eAccountType == k_EAccountTypeClan || eAccountType == k_EAccountTypeGameServer )
  549. {
  550. m_steamid.m_comp.m_unAccountInstance = 0;
  551. }
  552. else
  553. {
  554. // by default we pick the desktop instance
  555. m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance;
  556. }
  557. }
  558. //-----------------------------------------------------------------------------
  559. // Purpose: Sets parameters for steam ID
  560. // Input : unAccountID - 32-bit account ID
  561. // eUniverse - Universe this account belongs to
  562. // eAccountType - Type of account
  563. //-----------------------------------------------------------------------------
  564. void InstancedSet( uint32 unAccountID, uint32 unInstance, EUniverse eUniverse, EAccountType eAccountType )
  565. {
  566. m_steamid.m_comp.m_unAccountID = unAccountID;
  567. m_steamid.m_comp.m_EUniverse = eUniverse;
  568. m_steamid.m_comp.m_EAccountType = eAccountType;
  569. m_steamid.m_comp.m_unAccountInstance = unInstance;
  570. }
  571. //-----------------------------------------------------------------------------
  572. // Purpose: Initializes a steam ID from its 52 bit parts and universe/type
  573. // Input : ulIdentifier - 52 bits of goodness
  574. //-----------------------------------------------------------------------------
  575. void FullSet( uint64 ulIdentifier, EUniverse eUniverse, EAccountType eAccountType )
  576. {
  577. m_steamid.m_comp.m_unAccountID = ( ulIdentifier & k_unSteamAccountIDMask ); // account ID is low 32 bits
  578. m_steamid.m_comp.m_unAccountInstance = ( ( ulIdentifier >> 32 ) & k_unSteamAccountInstanceMask ); // account instance is next 20 bits
  579. m_steamid.m_comp.m_EUniverse = eUniverse;
  580. m_steamid.m_comp.m_EAccountType = eAccountType;
  581. }
  582. //-----------------------------------------------------------------------------
  583. // Purpose: Initializes a steam ID from its 64-bit representation
  584. // Input : ulSteamID - 64-bit representation of a Steam ID
  585. //-----------------------------------------------------------------------------
  586. void SetFromUint64( uint64 ulSteamID )
  587. {
  588. m_steamid.m_unAll64Bits = ulSteamID;
  589. }
  590. //-----------------------------------------------------------------------------
  591. // Purpose: Clear all fields, leaving an invalid ID.
  592. //-----------------------------------------------------------------------------
  593. void Clear()
  594. {
  595. m_steamid.m_comp.m_unAccountID = 0;
  596. m_steamid.m_comp.m_EAccountType = k_EAccountTypeInvalid;
  597. m_steamid.m_comp.m_EUniverse = k_EUniverseInvalid;
  598. m_steamid.m_comp.m_unAccountInstance = 0;
  599. }
  600. #if defined( INCLUDED_STEAM2_USERID_STRUCTS )
  601. //-----------------------------------------------------------------------------
  602. // Purpose: Initializes a steam ID from a Steam2 ID structure
  603. // Input: pTSteamGlobalUserID - Steam2 ID to convert
  604. // eUniverse - universe this ID belongs to
  605. //-----------------------------------------------------------------------------
  606. void SetFromSteam2( TSteamGlobalUserID *pTSteamGlobalUserID, EUniverse eUniverse )
  607. {
  608. m_steamid.m_comp.m_unAccountID = pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits * 2 +
  609. pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits;
  610. m_steamid.m_comp.m_EUniverse = eUniverse; // set the universe
  611. m_steamid.m_comp.m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual
  612. m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance; // Steam2 only knew desktop instances
  613. }
  614. //-----------------------------------------------------------------------------
  615. // Purpose: Fills out a Steam2 ID structure
  616. // Input: pTSteamGlobalUserID - Steam2 ID to write to
  617. //-----------------------------------------------------------------------------
  618. void ConvertToSteam2( TSteamGlobalUserID *pTSteamGlobalUserID ) const
  619. {
  620. // only individual accounts have any meaning in Steam 2, only they can be mapped
  621. // Assert( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual );
  622. pTSteamGlobalUserID->m_SteamInstanceID = 0;
  623. pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits = m_steamid.m_comp.m_unAccountID % 2;
  624. pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits = m_steamid.m_comp.m_unAccountID / 2;
  625. }
  626. #endif // defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H )
  627. //-----------------------------------------------------------------------------
  628. // Purpose: Converts steam ID to its 64-bit representation
  629. // Output : 64-bit representation of a Steam ID
  630. //-----------------------------------------------------------------------------
  631. uint64 ConvertToUint64() const
  632. {
  633. return m_steamid.m_unAll64Bits;
  634. }
  635. //-----------------------------------------------------------------------------
  636. // Purpose: Converts the static parts of a steam ID to a 64-bit representation.
  637. // For multiseat accounts, all instances of that account will have the
  638. // same static account key, so they can be grouped together by the static
  639. // account key.
  640. // Output : 64-bit static account key
  641. //-----------------------------------------------------------------------------
  642. uint64 GetStaticAccountKey() const
  643. {
  644. // note we do NOT include the account instance (which is a dynamic property) in the static account key
  645. return (uint64) ( ( ( (uint64) m_steamid.m_comp.m_EUniverse ) << 56 ) + ((uint64) m_steamid.m_comp.m_EAccountType << 52 ) + m_steamid.m_comp.m_unAccountID );
  646. }
  647. //-----------------------------------------------------------------------------
  648. // Purpose: create an anonymous game server login to be filled in by the AM
  649. //-----------------------------------------------------------------------------
  650. void CreateBlankAnonLogon( EUniverse eUniverse )
  651. {
  652. m_steamid.m_comp.m_unAccountID = 0;
  653. m_steamid.m_comp.m_EAccountType = k_EAccountTypeAnonGameServer;
  654. m_steamid.m_comp.m_EUniverse = eUniverse;
  655. m_steamid.m_comp.m_unAccountInstance = 0;
  656. }
  657. //-----------------------------------------------------------------------------
  658. // Purpose: create an anonymous game server login to be filled in by the AM
  659. //-----------------------------------------------------------------------------
  660. void CreateBlankAnonUserLogon( EUniverse eUniverse )
  661. {
  662. m_steamid.m_comp.m_unAccountID = 0;
  663. m_steamid.m_comp.m_EAccountType = k_EAccountTypeAnonUser;
  664. m_steamid.m_comp.m_EUniverse = eUniverse;
  665. m_steamid.m_comp.m_unAccountInstance = 0;
  666. }
  667. //-----------------------------------------------------------------------------
  668. // Purpose: Is this an anonymous game server login that will be filled in?
  669. //-----------------------------------------------------------------------------
  670. bool BBlankAnonAccount() const
  671. {
  672. return m_steamid.m_comp.m_unAccountID == 0 && BAnonAccount() && m_steamid.m_comp.m_unAccountInstance == 0;
  673. }
  674. //-----------------------------------------------------------------------------
  675. // Purpose: Is this a game server account id? (Either persistent or anonymous)
  676. //-----------------------------------------------------------------------------
  677. bool BGameServerAccount() const
  678. {
  679. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer || m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer;
  680. }
  681. //-----------------------------------------------------------------------------
  682. // Purpose: Is this a persistent (not anonymous) game server account id?
  683. //-----------------------------------------------------------------------------
  684. bool BPersistentGameServerAccount() const
  685. {
  686. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer;
  687. }
  688. //-----------------------------------------------------------------------------
  689. // Purpose: Is this an anonymous game server account id?
  690. //-----------------------------------------------------------------------------
  691. bool BAnonGameServerAccount() const
  692. {
  693. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer;
  694. }
  695. //-----------------------------------------------------------------------------
  696. // Purpose: Is this a content server account id?
  697. //-----------------------------------------------------------------------------
  698. bool BContentServerAccount() const
  699. {
  700. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeContentServer;
  701. }
  702. //-----------------------------------------------------------------------------
  703. // Purpose: Is this a clan account id?
  704. //-----------------------------------------------------------------------------
  705. bool BClanAccount() const
  706. {
  707. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeClan;
  708. }
  709. //-----------------------------------------------------------------------------
  710. // Purpose: Is this a chat account id?
  711. //-----------------------------------------------------------------------------
  712. bool BChatAccount() const
  713. {
  714. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeChat;
  715. }
  716. //-----------------------------------------------------------------------------
  717. // Purpose: Is this a chat account id?
  718. //-----------------------------------------------------------------------------
  719. bool IsLobby() const
  720. {
  721. return ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeChat )
  722. && ( m_steamid.m_comp.m_unAccountInstance & k_EChatInstanceFlagLobby );
  723. }
  724. //-----------------------------------------------------------------------------
  725. // Purpose: Is this an individual user account id?
  726. //-----------------------------------------------------------------------------
  727. bool BIndividualAccount() const
  728. {
  729. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual || m_steamid.m_comp.m_EAccountType == k_EAccountTypeConsoleUser;
  730. }
  731. //-----------------------------------------------------------------------------
  732. // Purpose: Is this an anonymous account?
  733. //-----------------------------------------------------------------------------
  734. bool BAnonAccount() const
  735. {
  736. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonUser || m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer;
  737. }
  738. //-----------------------------------------------------------------------------
  739. // Purpose: Is this an anonymous user account? ( used to create an account or reset a password )
  740. //-----------------------------------------------------------------------------
  741. bool BAnonUserAccount() const
  742. {
  743. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonUser;
  744. }
  745. //-----------------------------------------------------------------------------
  746. // Purpose: Is this a faked up Steam ID for a PSN friend account?
  747. //-----------------------------------------------------------------------------
  748. bool BConsoleUserAccount() const
  749. {
  750. return m_steamid.m_comp.m_EAccountType == k_EAccountTypeConsoleUser;
  751. }
  752. // simple accessors
  753. void SetAccountID( uint32 unAccountID ) { m_steamid.m_comp.m_unAccountID = unAccountID; }
  754. void SetAccountInstance( uint32 unInstance ){ m_steamid.m_comp.m_unAccountInstance = unInstance; }
  755. void ClearIndividualInstance() { if ( BIndividualAccount() ) m_steamid.m_comp.m_unAccountInstance = 0; }
  756. bool HasNoIndividualInstance() const { return BIndividualAccount() && (m_steamid.m_comp.m_unAccountInstance==0); }
  757. AccountID_t GetAccountID() const { return m_steamid.m_comp.m_unAccountID; }
  758. uint32 GetUnAccountInstance() const { return m_steamid.m_comp.m_unAccountInstance; }
  759. EAccountType GetEAccountType() const { return ( EAccountType ) m_steamid.m_comp.m_EAccountType; }
  760. EUniverse GetEUniverse() const { return m_steamid.m_comp.m_EUniverse; }
  761. void SetEUniverse( EUniverse eUniverse ) { m_steamid.m_comp.m_EUniverse = eUniverse; }
  762. bool IsValid() const;
  763. // this set of functions is hidden, will be moved out of class
  764. explicit CSteamID( const char *pchSteamID, EUniverse eDefaultUniverse = k_EUniverseInvalid );
  765. const char * Render() const; // renders this steam ID to string
  766. static const char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string
  767. void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse );
  768. // SetFromString allows many partially-correct strings, constraining how
  769. // we might be able to change things in the future.
  770. // SetFromStringStrict requires the exact string forms that we support
  771. // and is preferred when the caller knows it's safe to be strict.
  772. // Returns whether the string parsed correctly.
  773. bool SetFromStringStrict( const char *pchSteamID, EUniverse eDefaultUniverse );
  774. bool SetFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse );
  775. inline bool operator==( const CSteamID &val ) const { return m_steamid.m_unAll64Bits == val.m_steamid.m_unAll64Bits; }
  776. inline bool operator!=( const CSteamID &val ) const { return !operator==( val ); }
  777. inline bool operator<( const CSteamID &val ) const { return m_steamid.m_unAll64Bits < val.m_steamid.m_unAll64Bits; }
  778. inline bool operator>( const CSteamID &val ) const { return m_steamid.m_unAll64Bits > val.m_steamid.m_unAll64Bits; }
  779. // DEBUG function
  780. bool BValidExternalSteamID() const;
  781. private:
  782. // These are defined here to prevent accidental implicit conversion of a u32AccountID to a CSteamID.
  783. // If you get a compiler error about an ambiguous constructor/function then it may be because you're
  784. // passing a 32-bit int to a function that takes a CSteamID. You should explicitly create the SteamID
  785. // using the correct Universe and account Type/Instance values.
  786. CSteamID( uint32 );
  787. CSteamID( int32 );
  788. // 64 bits total
  789. union SteamID_t
  790. {
  791. struct SteamIDComponent_t
  792. {
  793. #ifdef VALVE_BIG_ENDIAN
  794. EUniverse m_EUniverse : 8; // universe this account belongs to
  795. unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference
  796. unsigned int m_unAccountInstance : 20; // dynamic instance ID
  797. uint32 m_unAccountID : 32; // unique account identifier
  798. #else
  799. uint32 m_unAccountID : 32; // unique account identifier
  800. unsigned int m_unAccountInstance : 20; // dynamic instance ID
  801. unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference
  802. EUniverse m_EUniverse : 8; // universe this account belongs to
  803. #endif
  804. } m_comp;
  805. uint64 m_unAll64Bits;
  806. } m_steamid;
  807. };
  808. inline bool CSteamID::IsValid() const
  809. {
  810. if ( m_steamid.m_comp.m_EAccountType <= k_EAccountTypeInvalid || m_steamid.m_comp.m_EAccountType >= k_EAccountTypeMax )
  811. return false;
  812. if ( m_steamid.m_comp.m_EUniverse <= k_EUniverseInvalid || m_steamid.m_comp.m_EUniverse >= k_EUniverseMax )
  813. return false;
  814. if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual )
  815. {
  816. if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance > k_unSteamUserWebInstance )
  817. return false;
  818. }
  819. if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeClan )
  820. {
  821. if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance != 0 )
  822. return false;
  823. }
  824. if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer )
  825. {
  826. if ( m_steamid.m_comp.m_unAccountID == 0 )
  827. return false;
  828. // Any limit on instances? We use them for local users and bots
  829. }
  830. return true;
  831. }
  832. // generic invalid CSteamID
  833. #define k_steamIDNil CSteamID()
  834. // This steamID comes from a user game connection to an out of date GS that hasnt implemented the protocol
  835. // to provide its steamID
  836. #define k_steamIDOutofDateGS CSteamID( 0, 0, k_EUniverseInvalid, k_EAccountTypeInvalid )
  837. // This steamID comes from a user game connection to an sv_lan GS
  838. #define k_steamIDLanModeGS CSteamID( 0, 0, k_EUniversePublic, k_EAccountTypeInvalid )
  839. // This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized
  840. // its steam3 component and started logging on.
  841. #define k_steamIDNotInitYetGS CSteamID( 1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid )
  842. // This steamID can come from a user game connection to a GS that isn't using the steam authentication system but still
  843. // wants to support the "Join Game" option in the friends list
  844. #define k_steamIDNonSteamGS CSteamID( 2, 0, k_EUniverseInvalid, k_EAccountTypeInvalid )
  845. #ifdef STEAM
  846. // Returns the matching chat steamID, with the default instance of 0
  847. // If the steamID passed in is already of type k_EAccountTypeChat it will be returned with the same instance
  848. CSteamID ChatIDFromSteamID( const CSteamID &steamID );
  849. // Returns the matching clan steamID, with the default instance of 0
  850. // If the steamID passed in is already of type k_EAccountTypeClan it will be returned with the same instance
  851. CSteamID ClanIDFromSteamID( const CSteamID &steamID );
  852. // Asserts steamID type before conversion
  853. CSteamID ChatIDFromClanID( const CSteamID &steamIDClan );
  854. // Asserts steamID type before conversion
  855. CSteamID ClanIDFromChatID( const CSteamID &steamIDChat );
  856. #endif // _STEAM
  857. //-----------------------------------------------------------------------------
  858. // Purpose: encapsulates an appID/modID pair
  859. //-----------------------------------------------------------------------------
  860. class CGameID
  861. {
  862. public:
  863. CGameID()
  864. {
  865. m_gameID.m_nType = k_EGameIDTypeApp;
  866. m_gameID.m_nAppID = k_uAppIdInvalid;
  867. m_gameID.m_nModID = 0;
  868. }
  869. explicit CGameID( uint64 ulGameID )
  870. {
  871. m_ulGameID = ulGameID;
  872. }
  873. #ifdef INT64_DIFFERENT_FROM_INT64_T
  874. CGameID( uint64_t ulGameID )
  875. {
  876. m_ulGameID = (uint64)ulGameID;
  877. }
  878. #endif
  879. explicit CGameID( int32 nAppID )
  880. {
  881. m_ulGameID = 0;
  882. m_gameID.m_nAppID = nAppID;
  883. }
  884. explicit CGameID( uint32 nAppID )
  885. {
  886. m_ulGameID = 0;
  887. m_gameID.m_nAppID = nAppID;
  888. }
  889. CGameID( uint32 nAppID, uint32 nModID )
  890. {
  891. m_ulGameID = 0;
  892. m_gameID.m_nAppID = nAppID;
  893. m_gameID.m_nModID = nModID;
  894. m_gameID.m_nType = k_EGameIDTypeGameMod;
  895. }
  896. // Hidden functions used only by Steam
  897. explicit CGameID( const char *pchGameID );
  898. const char *Render() const; // render this Game ID to string
  899. static const char *Render( uint64 ulGameID ); // static method to render a uint64 representation of a Game ID to a string
  900. // must include checksum_crc.h first to get this functionality
  901. #if defined( CHECKSUM_CRC_H )
  902. CGameID( uint32 nAppID, const char *pchModPath )
  903. {
  904. m_ulGameID = 0;
  905. m_gameID.m_nAppID = nAppID;
  906. m_gameID.m_nType = k_EGameIDTypeGameMod;
  907. char rgchModDir[MAX_PATH];
  908. V_FileBase( pchModPath, rgchModDir, sizeof( rgchModDir ) );
  909. CRC32_t crc32;
  910. CRC32_Init( &crc32 );
  911. CRC32_ProcessBuffer( &crc32, rgchModDir, V_strlen( rgchModDir ) );
  912. CRC32_Final( &crc32 );
  913. // set the high-bit on the mod-id
  914. // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique
  915. // replacement for appID's
  916. m_gameID.m_nModID = crc32 | (0x80000000);
  917. }
  918. CGameID( const char *pchExePath, const char *pchAppName )
  919. {
  920. m_ulGameID = 0;
  921. m_gameID.m_nAppID = k_uAppIdInvalid;
  922. m_gameID.m_nType = k_EGameIDTypeShortcut;
  923. CRC32_t crc32;
  924. CRC32_Init( &crc32 );
  925. if ( pchExePath )
  926. CRC32_ProcessBuffer( &crc32, pchExePath, V_strlen( pchExePath ) );
  927. if ( pchAppName )
  928. CRC32_ProcessBuffer( &crc32, pchAppName, V_strlen( pchAppName ) );
  929. CRC32_Final( &crc32 );
  930. // set the high-bit on the mod-id
  931. // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique
  932. // replacement for appID's
  933. m_gameID.m_nModID = crc32 | (0x80000000);
  934. }
  935. #if defined( VSTFILEID_H )
  936. CGameID( VstFileID vstFileID )
  937. {
  938. m_ulGameID = 0;
  939. m_gameID.m_nAppID = k_uAppIdInvalid;
  940. m_gameID.m_nType = k_EGameIDTypeP2P;
  941. CRC32_t crc32;
  942. CRC32_Init( &crc32 );
  943. const char *pchFileId = vstFileID.Render();
  944. CRC32_ProcessBuffer( &crc32, pchFileId, V_strlen( pchFileId ) );
  945. CRC32_Final( &crc32 );
  946. // set the high-bit on the mod-id
  947. // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique
  948. // replacement for appID's
  949. m_gameID.m_nModID = crc32 | (0x80000000);
  950. }
  951. #endif /* VSTFILEID_H */
  952. #endif /* CHECKSUM_CRC_H */
  953. uint64 ToUint64() const
  954. {
  955. return m_ulGameID;
  956. }
  957. uint64 *GetUint64Ptr()
  958. {
  959. return &m_ulGameID;
  960. }
  961. void Set( uint64 ulGameID )
  962. {
  963. m_ulGameID = ulGameID;
  964. }
  965. bool IsMod() const
  966. {
  967. return ( m_gameID.m_nType == k_EGameIDTypeGameMod );
  968. }
  969. bool IsShortcut() const
  970. {
  971. return ( m_gameID.m_nType == k_EGameIDTypeShortcut );
  972. }
  973. bool IsP2PFile() const
  974. {
  975. return ( m_gameID.m_nType == k_EGameIDTypeP2P );
  976. }
  977. bool IsSteamApp() const
  978. {
  979. return ( m_gameID.m_nType == k_EGameIDTypeApp );
  980. }
  981. uint32 ModID() const
  982. {
  983. return m_gameID.m_nModID;
  984. }
  985. uint32 AppID() const
  986. {
  987. return m_gameID.m_nAppID;
  988. }
  989. bool operator == ( const CGameID &rhs ) const
  990. {
  991. return m_ulGameID == rhs.m_ulGameID;
  992. }
  993. bool operator != ( const CGameID &rhs ) const
  994. {
  995. return !(*this == rhs);
  996. }
  997. bool operator < ( const CGameID &rhs ) const
  998. {
  999. return ( m_ulGameID < rhs.m_ulGameID );
  1000. }
  1001. bool IsValid() const
  1002. {
  1003. // each type has it's own invalid fixed point:
  1004. switch( m_gameID.m_nType )
  1005. {
  1006. case k_EGameIDTypeApp:
  1007. return m_gameID.m_nAppID != k_uAppIdInvalid;
  1008. case k_EGameIDTypeGameMod:
  1009. return m_gameID.m_nAppID != k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000;
  1010. case k_EGameIDTypeShortcut:
  1011. return (m_gameID.m_nModID & 0x80000000) != 0;
  1012. case k_EGameIDTypeP2P:
  1013. return m_gameID.m_nAppID == k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000;
  1014. default:
  1015. #if defined(Assert)
  1016. Assert(false);
  1017. #endif
  1018. return false;
  1019. }
  1020. }
  1021. void Reset()
  1022. {
  1023. m_ulGameID = 0;
  1024. }
  1025. private:
  1026. enum EGameIDType
  1027. {
  1028. k_EGameIDTypeApp = 0,
  1029. k_EGameIDTypeGameMod = 1,
  1030. k_EGameIDTypeShortcut = 2,
  1031. k_EGameIDTypeP2P = 3,
  1032. };
  1033. struct GameID_t
  1034. {
  1035. #ifdef VALVE_BIG_ENDIAN
  1036. unsigned int m_nModID : 32;
  1037. unsigned int m_nType : 8;
  1038. unsigned int m_nAppID : 24;
  1039. #else
  1040. unsigned int m_nAppID : 24;
  1041. unsigned int m_nType : 8;
  1042. unsigned int m_nModID : 32;
  1043. #endif
  1044. };
  1045. union
  1046. {
  1047. uint64 m_ulGameID;
  1048. GameID_t m_gameID;
  1049. };
  1050. };
  1051. #pragma pack( pop )
  1052. const int k_cchGameExtraInfoMax = 64;
  1053. //-----------------------------------------------------------------------------
  1054. // Constants used for query ports.
  1055. //-----------------------------------------------------------------------------
  1056. #define QUERY_PORT_NOT_INITIALIZED 0xFFFF // We haven't asked the GS for this query port's actual value yet.
  1057. #define QUERY_PORT_ERROR 0xFFFE // We were unable to get the query port for this server.
  1058. //-----------------------------------------------------------------------------
  1059. // Purpose: Passed as argument to SteamAPI_UseBreakpadCrashHandler to enable optional callback
  1060. // just before minidump file is captured after a crash has occurred. (Allows app to append additional comment data to the dump, etc.)
  1061. //-----------------------------------------------------------------------------
  1062. typedef void (*PFNPreMinidumpCallback)(void *context);
  1063. //-----------------------------------------------------------------------------
  1064. // Purpose: Used by ICrashHandler interfaces to reference particular installed crash handlers
  1065. //-----------------------------------------------------------------------------
  1066. typedef void *BREAKPAD_HANDLE;
  1067. #define BREAKPAD_INVALID_HANDLE (BREAKPAD_HANDLE)0
  1068. #endif // STEAMCLIENTPUBLIC_H