1 /// Transcription of steamclientpublic.h to D. 2 /// 3 /// Copyright: Valve Corporation, all rights reserved 4 module steam_gns.client_public; 5 6 import steam_gns.misc; 7 import steam_gns.stypes; 8 import steam_gns.universe; 9 10 @nogc nothrow extern (C++) align(4): 11 12 // General result codes 13 enum EResult { 14 15 None = 0, // no result 16 OK = 1, // success 17 Fail = 2, // generic failure 18 NoConnection = 3, // no/failed network connection 19 // NoConnectionRetry = 4, // OBSOLETE - removed 20 InvalidPassword = 5, // password/ticket is invalid 21 LoggedInElsewhere = 6, // same user logged in elsewhere 22 InvalidProtocolVer = 7, // protocol version is incorrect 23 InvalidParam = 8, // a parameter is incorrect 24 FileNotFound = 9, // file was not found 25 Busy = 10, // called method busy - action not taken 26 InvalidState = 11, // called object was in an invalid state 27 InvalidName = 12, // name is invalid 28 InvalidEmail = 13, // email is invalid 29 DuplicateName = 14, // name is not unique 30 AccessDenied = 15, // access is denied 31 Timeout = 16, // operation timed out 32 Banned = 17, // VAC2 banned 33 AccountNotFound = 18, // account not found 34 InvalidSteamID = 19, // steamID is invalid 35 ServiceUnavailable = 20, // The requested service is currently unavailable 36 NotLoggedOn = 21, // The user is not logged on 37 Pending = 22, // Request is pending (may be in process, or waiting on third party) 38 EncryptionFailure = 23, // Encryption or Decryption failed 39 InsufficientPrivilege = 24, // Insufficient privilege 40 LimitExceeded = 25, // Too much of a good thing 41 Revoked = 26, // Access has been revoked (used for revoked guest passes) 42 Expired = 27, // License/Guest pass the user is trying to access is expired 43 AlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again 44 DuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time 45 AlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user 46 IPNotFound = 31, // IP address not found 47 PersistFailed = 32, // failed to write change to the data store 48 LockingFailed = 33, // failed to acquire access lock for this operation 49 LogonSessionReplaced = 34, 50 ConnectFailed = 35, 51 HandshakeFailed = 36, 52 IOFailure = 37, 53 RemoteDisconnect = 38, 54 ShoppingCartNotFound = 39, // failed to find the shopping cart requested 55 Blocked = 40, // a user didn't allow it 56 Ignored = 41, // target is ignoring sender 57 NoMatch = 42, // nothing matching the request found 58 AccountDisabled = 43, 59 ServiceReadOnly = 44, // this service is not accepting content changes right now 60 AccountNotFeatured = 45, // account doesn't have value, so this feature isn't available 61 AdministratorOK = 46, // allowed to take this action, but only because requester is admin 62 ContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol. 63 TryAnotherCM = 48, // The current CM can't service the user making a request, user should try another. 64 PasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed. 65 AlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait 66 Suspended = 51, // Long running operation (content download) suspended/paused 67 Cancelled = 52, // Operation canceled (typically by user: content download) 68 DataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable 69 DiskFull = 54, // Operation canceled - not enough disk space. 70 RemoteCallFailed = 55, // an remote call or IPC call failed 71 PasswordUnset = 56, // Password could not be verified as it's unset server side 72 ExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account 73 PSNTicketInvalid = 58, // PSN ticket was invalid 74 ExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first 75 RemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files 76 IllegalPassword = 61, // The requested new password is not legal 77 SameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer ) 78 AccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure 79 CannotUseOldPassword = 64, // The requested new password is not legal 80 InvalidLoginAuthCode = 65, // account login denied due to auth code invalid 81 AccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent 82 HardwareNotCapableOfIPT = 67, // 83 IPTInitError = 68, // 84 ParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user 85 FacebookQueryError = 70, // Facebook query returned an error 86 ExpiredLoginAuthCode = 71, // account login denied due to auth code expired 87 IPLoginRestrictionFailed = 72, 88 AccountLockedDown = 73, 89 AccountLogonDeniedVerifiedEmailRequired = 74, 90 NoMatchingURL = 75, 91 BadResponse = 76, // parse failure, missing field, etc. 92 RequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password 93 ValueOutOfRange = 78, // the value entered is outside the acceptable range 94 UnexpectedError = 79, // something happened that we didn't expect to ever happen 95 Disabled = 80, // The requested service has been configured to be unavailable 96 InvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid ! 97 RestrictedDevice = 82, // The device being used is not allowed to perform this action 98 RegionLocked = 83, // The action could not be complete because it is region restricted 99 RateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent 100 AccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login 101 ItemDeleted = 86, // The thing we're trying to access has been deleted 102 AccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker 103 TwoFactorCodeMismatch = 88, // two factor code mismatch 104 TwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match 105 AccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners 106 NotModified = 91, // data not modified 107 NoMobileDevice = 92, // the account does not have a mobile device associated with it 108 TimeNotSynced = 93, // the time presented is out of range or tolerance 109 SmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.) 110 AccountLimitExceeded = 95, // Too many accounts access this resource 111 AccountActivityLimitExceeded = 96, // Too many changes to this account 112 PhoneActivityLimitExceeded = 97, // Too many changes to this phone 113 RefundToWallet = 98, // Cannot refund to payment method, must use wallet 114 EmailSendFailure = 99, // Cannot send an email 115 NotSettled = 100, // Can't perform operation till payment has settled 116 NeedCaptcha = 101, // Needs to provide a valid captcha 117 GSLTDenied = 102, // a game server login token owned by this token's owner has been banned 118 GSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone) 119 InvalidItemType = 104, // the type of thing we were requested to act on is invalid 120 IPBanned = 105, // the ip address has been banned from taking this action 121 GSLTExpired = 106, // this token has expired from disuse; can be reset for use 122 InsufficientFunds = 107, // user doesn't have enough wallet funds to complete the action 123 TooManyPending = 108, // There are too many of this thing pending already 124 NoSiteLicensesFound = 109, // No site licenses found 125 WGNetworkSendExceeded = 110, // the WG couldn't send a response because we exceeded max network send size 126 AccountNotFriends = 111, // the user is not mutually friends 127 LimitedUserAccount = 112, // the user is limited 128 CantRemoveItem = 113, // item can't be removed 129 AccountDeleted = 114, // account has been deleted 130 ExistingUserCancelledLicense = 115, // A license for this already exists, but cancelled 131 CommunityCooldown = 116, // access is denied because of a community cooldown (probably from support profile data resets) 132 NoLauncherSpecified = 117, // No launcher was specified, but a launcher was needed to choose correct realm for operation. 133 MustAgreeToSSA = 118, // User must agree to china SSA or global SSA before login 134 LauncherMigrated = 119, // The specified launcher type is no longer supported; the user should be directed elsewhere 135 SteamRealmMismatch = 120, // The user's realm does not match the realm of the requested resource 136 InvalidSignature = 121, // signature check did not match 137 ParseFailure = 122, // Failed to parse input 138 NoVerifiedPhone = 123, // account does not have a verified phone number 139 InsufficientBattery = 124, // user device doesn't have enough battery charge currently to complete the action 140 ChargerRequired = 125, // The operation requires a charger to be plugged in, which wasn't present 141 CachedCredentialInvalid = 126 // Cached credential was invalid - user must reauthenticate 142 143 144 } 145 146 // Error codes for use with the voice functions 147 enum EVoiceResult { 148 149 OK = 0, 150 NotInitialized = 1, 151 NotRecording = 2, 152 NoData = 3, 153 BufferTooSmall = 4, 154 DataCorrupted = 5, 155 Restricted = 6, 156 UnsupportedCodec = 7, 157 ReceiverOutOfDate = 8, 158 ReceiverDidNotAnswer = 9, 159 160 } 161 162 // Result codes to GSHandleClientDeny/Kick 163 enum EDenyReason { 164 165 Invalid = 0, 166 InvalidVersion = 1, 167 Generic = 2, 168 NotLoggedOn = 3, 169 NoLicense = 4, 170 Cheater = 5, 171 LoggedInElseWhere = 6, 172 UnknownText = 7, 173 IncompatibleAnticheat = 8, 174 MemoryCorruption = 9, 175 IncompatibleSoftware = 10, 176 SteamConnectionLost = 11, 177 SteamConnectionError = 12, 178 SteamResponseTimedOut = 13, 179 SteamValidationStalled = 14, 180 SteamOwnerLeftGuestUser = 15, 181 182 } 183 184 // return type of GetAuthSessionTicket 185 alias HAuthTicket = uint; 186 enum HAuthTicket k_HAuthTicketInvalid = 0; 187 188 // results from BeginAuthSession 189 enum EBeginAuthSessionResult { 190 191 OK = 0, // Ticket is valid for this game and this steamID. 192 InvalidTicket = 1, // Ticket is not valid. 193 DuplicateRequest = 2, // A ticket has already been submitted for this steamID 194 InvalidVersion = 3, // Ticket is from an incompatible interface version 195 GameMismatch = 4, // Ticket is not for this game 196 ExpiredTicket = 5, // Ticket has expired 197 198 } 199 200 // Callback values for callback ValidateAuthTicketResponse_t which is a response to BeginAuthSession 201 enum EAuthSessionResponse { 202 203 OK = 0, // Steam has verified the user is online, the ticket is valid and ticket has not been reused. 204 UserNotConnectedToSteam = 1, // The user in question is not connected to steam 205 NoLicenseOrExpired = 2, // The license has expired. 206 VACBanned = 3, // The user is VAC banned for this game. 207 LoggedInElseWhere = 4, // The user account has logged in elsewhere and the session containing the game instance has been disconnected. 208 VACCheckTimedOut = 5, // VAC has been unable to perform anti-cheat checks on this user 209 AuthTicketCanceled = 6, // The ticket has been canceled by the issuer 210 AuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid. 211 AuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam. 212 PublisherIssuedBan = 9, // The user is banned for this game. The ban came via the web api and not VAC 213 214 } 215 216 // results from UserHasLicenseForApp 217 enum EUserHasLicenseForAppResult { 218 219 HasLicense = 0, // User has a license for specified app 220 DoesNotHaveLicense = 1, // User does not have a license for the specified app 221 NoAuth = 2, // User has not been authenticated 222 223 } 224 225 226 // Steam account types 227 enum EAccountType { 228 229 Invalid = 0, 230 Individual = 1, // single user account 231 Multiseat = 2, // multiseat (e.g. cybercafe) account 232 GameServer = 3, // game server account 233 AnonGameServer = 4, // anonymous game server account 234 Pending = 5, // pending 235 ContentServer = 6, // content server 236 Clan = 7, 237 Chat = 8, 238 ConsoleUser = 9, // Fake SteamID for local PSN account on PS3 or Live account on 360, etc. 239 AnonUser = 10, 240 241 // Max of 16 items in this field 242 TypeMax 243 244 } 245 246 247 248 //----------------------------------------------------------------------------- 249 // Purpose: Chat Entry Types (previously was only friend-to-friend message types) 250 //----------------------------------------------------------------------------- 251 enum EChatEntryType { 252 253 Invalid = 0, 254 ChatMsg = 1, // Normal text message from another user 255 Typing = 2, // Another user is typing (not used in multi-user chat) 256 InviteGame = 3, // Invite from other user into that users current game 257 Emote = 4, // text emote message (deprecated, should be treated as ChatMsg) 258 //k_EChatEntryTypeLobbyGameStart = 5, // lobby game is starting (dead - listen for LobbyGameCreated_t callback instead) 259 LeftConversation = 6, // user has left the conversation ( closed chat window ) 260 // Above are previous FriendMsgType entries, now merged into more generic chat entry types 261 Entered = 7, // user has entered the conversation (used in multi-user chat and group chat) 262 WasKicked = 8, // user was kicked (data: 64-bit steamid of actor performing the kick) 263 WasBanned = 9, // user was banned (data: 64-bit steamid of actor performing the ban) 264 Disconnected = 10, // user disconnected 265 HistoricalChat = 11, // a chat message from user's chat history or offilne message 266 //k_EChatEntryTypeReserved1 = 12, // No longer used 267 //k_EChatEntryTypeReserved2 = 13, // No longer used 268 LinkBlocked = 14, // a link was removed by the chat filter. 269 270 } 271 272 273 //----------------------------------------------------------------------------- 274 // Purpose: Chat Room Enter Responses 275 //----------------------------------------------------------------------------- 276 enum EChatRoomEnterResponse { 277 278 Success = 1, // Success 279 DoesntExist = 2, // Chat doesn't exist (probably closed) 280 NotAllowed = 3, // General Denied - You don't have the permissions needed to join the chat 281 Full = 4, // Chat room has reached its maximum size 282 Error = 5, // Unexpected Error 283 Banned = 6, // You are banned from this chat room and may not join 284 Limited = 7, // Joining this chat is not allowed because you are a limited user (no value on account) 285 ClanDisabled = 8, // Attempt to join a clan chat when the clan is locked or disabled 286 CommunityBan = 9, // Attempt to join a chat when the user has a community lock on their account 287 MemberBlockedYou = 10, // Join failed - some member in the chat has blocked you from joining 288 YouBlockedMember = 11, // Join failed - you have blocked some member already in the chat 289 // k_EChatRoomEnterResponseNoRankingDataLobby = 12, // No longer used 290 // k_EChatRoomEnterResponseNoRankingDataUser = 13, // No longer used 291 // k_EChatRoomEnterResponseRankOutOfRange = 14, // No longer used 292 RatelimitExceeded = 15, // Join failed - to many join attempts in a very short period of time 293 294 } 295 296 297 enum uint k_unSteamAccountIDMask = 0xFFFFFFFF; 298 enum uint k_unSteamAccountInstanceMask = 0x000FFFFF; 299 enum uint k_unSteamUserDefaultInstance = 1; // fixed instance for all individual users 300 301 // Special flags for Chat accounts - they go in the top 8 bits 302 // of the steam ID's "instance", leaving 12 for the actual instances 303 enum EChatSteamIDInstanceFlags { 304 305 EChatAccountInstanceMask = 0x00000FFF, // top 8 bits are flags 306 307 EChatInstanceFlagClan = ( k_unSteamAccountInstanceMask + 1 ) >> 1, // top bit 308 EChatInstanceFlagLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 2, // next one down, etc 309 EChatInstanceFlagMMSLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 3, // next one down, etc 310 311 // Max of 8 flags 312 } 313 314 315 //----------------------------------------------------------------------------- 316 // Purpose: Possible positions to tell the overlay to show notifications in 317 //----------------------------------------------------------------------------- 318 enum ENotificationPosition { 319 320 TopLeft = 0, 321 TopRight = 1, 322 BottomLeft = 2, 323 BottomRight = 3, 324 325 } 326 327 328 //----------------------------------------------------------------------------- 329 // Purpose: Broadcast upload result details 330 //----------------------------------------------------------------------------- 331 enum EBroadcastUploadResult { 332 333 None = 0, // broadcast state unknown 334 OK = 1, // broadcast was good, no problems 335 InitFailed = 2, // broadcast init failed 336 FrameFailed = 3, // broadcast frame upload failed 337 Timeout = 4, // broadcast upload timed out 338 BandwidthExceeded = 5, // broadcast send too much data 339 LowFPS = 6, // broadcast FPS too low 340 MissingKeyFrames = 7, // broadcast sending not enough key frames 341 NoConnection = 8, // broadcast client failed to connect to relay 342 RelayFailed = 9, // relay dropped the upload 343 SettingsChanged = 10, // the client changed broadcast settings 344 MissingAudio = 11, // client failed to send audio data 345 TooFarBehind = 12, // clients was too slow uploading 346 TranscodeBehind = 13, // server failed to keep up with transcode 347 NotAllowedToPlay = 14, // Broadcast does not have permissions to play game 348 Busy = 15, // RTMP host to busy to take new broadcast stream, choose another 349 Banned = 16, // Account banned from community broadcast 350 AlreadyActive = 17, // We already already have an stream running. 351 ForcedOff = 18, // We explicitly shutting down a broadcast 352 AudioBehind = 19, // Audio stream was too far behind video 353 Shutdown = 20, // Broadcast Server was shut down 354 Disconnect = 21, // broadcast uploader TCP disconnected 355 VideoInitFailed = 22, // invalid video settings 356 AudioInitFailed = 23, // invalid audio settings 357 358 } 359 360 361 //----------------------------------------------------------------------------- 362 // Purpose: Reasons a user may not use the Community Market. 363 // Used in MarketEligibilityResponse_t. 364 //----------------------------------------------------------------------------- 365 enum EMarketNotAllowedReasonFlags { 366 367 None = 0, 368 369 // A back-end call failed or something that might work again on retry 370 TemporaryFailure = (1 << 0), 371 372 // Disabled account 373 AccountDisabled = (1 << 1), 374 375 // Locked account 376 AccountLockedDown = (1 << 2), 377 378 // Limited account (no purchases) 379 AccountLimited = (1 << 3), 380 381 // The account is banned from trading items 382 TradeBanned = (1 << 4), 383 384 // Wallet funds aren't tradable because the user has had no purchase 385 // activity in the last year or has had no purchases prior to last month 386 AccountNotTrusted = (1 << 5), 387 388 // The user doesn't have Steam Guard enabled 389 SteamGuardNotEnabled = (1 << 6), 390 391 // The user has Steam Guard, but it hasn't been enabled for the required 392 // number of days 393 SteamGuardOnlyRecentlyEnabled = (1 << 7), 394 395 // The user has recently forgotten their password and reset it 396 RecentPasswordReset = (1 << 8), 397 398 // The user has recently funded his or her wallet with a new payment method 399 NewPaymentMethod = (1 << 9), 400 401 // An invalid cookie was sent by the user 402 InvalidCookie = (1 << 10), 403 404 // The user has Steam Guard, but is using a new computer or web browser 405 UsingNewDevice = (1 << 11), 406 407 // The user has recently refunded a store purchase by his or herself 408 RecentSelfRefund = (1 << 12), 409 410 // The user has recently funded his or her wallet with a new payment method that cannot be verified 411 NewPaymentMethodCannotBeVerified = (1 << 13), 412 413 // Not only is the account not trusted, but they have no recent purchases at all 414 NoRecentPurchases = (1 << 14), 415 416 // User accepted a wallet gift that was recently purchased 417 AcceptedWalletGift = (1 << 15), 418 419 } 420 421 422 // 423 // describes XP / progress restrictions to apply for games with duration control / 424 // anti-indulgence enabled for minor Steam China users. 425 // 426 // WARNING: DO NOT RENUMBER 427 enum EDurationControlProgress { 428 429 Full = 0, // Full progress 430 Half = 1, // deprecated - XP or persistent rewards should be halved 431 None = 2, // deprecated - XP or persistent rewards should be stopped 432 433 ExitSoon_3h = 3, // allowed 3h time since 5h gap/break has elapsed, game should exit - steam will terminate the game soon 434 ExitSoon_5h = 4, // allowed 5h time in calendar day has elapsed, game should exit - steam will terminate the game soon 435 ExitSoon_Night = 5, // game running after day period, game should exit - steam will terminate the game soon 436 437 } 438 439 440 // 441 // describes which notification timer has expired, for steam china duration control feature 442 // 443 // WARNING: DO NOT RENUMBER 444 enum EDurationControlNotification { 445 446 None = 0, // just informing you about progress, no notification to show 447 _1Hour = 1, // "you've been playing for N hours" 448 449 _3Hours = 2, // deprecated - "you've been playing for 3 hours; take a break" 450 HalfProgress = 3,// deprecated - "your XP / progress is half normal" 451 NoProgress = 4, // deprecated - "your XP / progress is zero" 452 453 ExitSoon_3h = 5, // allowed 3h time since 5h gap/break has elapsed, game should exit - steam will terminate the game soon 454 ExitSoon_5h = 6, // allowed 5h time in calendar day has elapsed, game should exit - steam will terminate the game soon 455 ExitSoon_Night = 7,// game running after day period, game should exit - steam will terminate the game soon 456 457 } 458 459 460 // 461 // Specifies a game's online state in relation to duration control 462 // 463 enum EDurationControlOnlineState { 464 465 Invalid = 0, // nil value 466 Offline = 1, // currently in offline play - single-player, offline co-op, etc. 467 Online = 2, // currently in online play 468 OnlineHighPri = 3, // currently in online play and requests not to be interrupted 469 470 } 471 472 473 // Steam ID structure (64 bits total) 474 struct CSteamID { 475 476 ulong m_steamid; 477 478 } 479 480 /+ 481 inline bool CSteamID::IsValid() const 482 { 483 if ( m_steamid.m_comp.m_EAccountType <= k_EAccountTypeInvalid || m_steamid.m_comp.m_EAccountType >= k_EAccountTypeMax ) 484 return false; 485 486 if ( m_steamid.m_comp.m_EUniverse <= k_EUniverseInvalid || m_steamid.m_comp.m_EUniverse >= k_EUniverseMax ) 487 return false; 488 489 if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual ) 490 { 491 if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance != k_unSteamUserDefaultInstance ) 492 return false; 493 } 494 495 if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeClan ) 496 { 497 if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance != 0 ) 498 return false; 499 } 500 501 if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer ) 502 { 503 if ( m_steamid.m_comp.m_unAccountID == 0 ) 504 return false; 505 // Any limit on instances? We use them for local users and bots 506 } 507 return true; 508 } 509 510 // generic invalid CSteamID 511 #define k_steamIDNil CSteamID() 512 513 // This steamID comes from a user game connection to an out of date GS that hasnt implemented the protocol 514 // to provide its steamID 515 #define k_steamIDOutofDateGS CSteamID( 0, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) 516 // This steamID comes from a user game connection to an sv_lan GS 517 #define k_steamIDLanModeGS CSteamID( 0, 0, k_EUniversePublic, k_EAccountTypeInvalid ) 518 // This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized 519 // its steam3 component and started logging on. 520 #define k_steamIDNotInitYetGS CSteamID( 1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) 521 // This steamID can come from a user game connection to a GS that isn't using the steam authentication system but still 522 // wants to support the "Join Game" option in the friends list 523 #define k_steamIDNonSteamGS CSteamID( 2, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) 524 525 +/ 526 527 /+ 528 529 530 #ifdef STEAM 531 // Returns the matching chat steamID, with the default instance of 0 532 // If the steamID passed in is already of type k_EAccountTypeChat it will be returned with the same instance 533 CSteamID ChatIDFromSteamID( const CSteamID &steamID ); 534 // Returns the matching clan steamID, with the default instance of 0 535 // If the steamID passed in is already of type k_EAccountTypeClan it will be returned with the same instance 536 CSteamID ClanIDFromSteamID( const CSteamID &steamID ); 537 // Asserts steamID type before conversion 538 CSteamID ChatIDFromClanID( const CSteamID &steamIDClan ); 539 // Asserts steamID type before conversion 540 CSteamID ClanIDFromChatID( const CSteamID &steamIDChat ); 541 542 #endif // _STEAM 543 544 +/ 545 546 547 /+ 548 549 //----------------------------------------------------------------------------- 550 // Purpose: encapsulates an appID/modID pair 551 //----------------------------------------------------------------------------- 552 class CGameID 553 { 554 public: 555 556 CGameID() 557 { 558 m_gameID.m_nType = k_EGameIDTypeApp; 559 m_gameID.m_nAppID = k_uAppIdInvalid; 560 m_gameID.m_nModID = 0; 561 } 562 563 explicit CGameID( uint64 ulGameID ) 564 { 565 m_ulGameID = ulGameID; 566 } 567 #ifdef INT64_DIFFERENT_FROM_INT64_T 568 CGameID( uint64_t ulGameID ) 569 { 570 m_ulGameID = (uint64)ulGameID; 571 } 572 #endif 573 574 explicit CGameID( int32 nAppID ) 575 { 576 m_ulGameID = 0; 577 m_gameID.m_nAppID = nAppID; 578 } 579 580 explicit CGameID( uint32 nAppID ) 581 { 582 m_ulGameID = 0; 583 m_gameID.m_nAppID = nAppID; 584 } 585 586 CGameID( uint32 nAppID, uint32 nModID ) 587 { 588 m_ulGameID = 0; 589 m_gameID.m_nAppID = nAppID; 590 m_gameID.m_nModID = nModID; 591 m_gameID.m_nType = k_EGameIDTypeGameMod; 592 } 593 594 CGameID( const CGameID &that ) 595 { 596 m_ulGameID = that.m_ulGameID; 597 } 598 599 CGameID& operator=( const CGameID & that ) 600 { 601 m_ulGameID = that.m_ulGameID; 602 return *this; 603 } 604 605 // Hidden functions used only by Steam 606 explicit CGameID( const char *pchGameID ); 607 const char *Render() const; // render this Game ID to string 608 static const char *Render( uint64 ulGameID ); // static method to render a uint64 representation of a Game ID to a string 609 610 uint64 ToUint64() const 611 { 612 return m_ulGameID; 613 } 614 615 uint64 *GetUint64Ptr() 616 { 617 return &m_ulGameID; 618 } 619 620 void Set( uint64 ulGameID ) 621 { 622 m_ulGameID = ulGameID; 623 } 624 625 bool IsMod() const 626 { 627 return ( m_gameID.m_nType == k_EGameIDTypeGameMod ); 628 } 629 630 bool IsShortcut() const 631 { 632 return ( m_gameID.m_nType == k_EGameIDTypeShortcut ); 633 } 634 635 bool IsP2PFile() const 636 { 637 return ( m_gameID.m_nType == k_EGameIDTypeP2P ); 638 } 639 640 bool IsSteamApp() const 641 { 642 return ( m_gameID.m_nType == k_EGameIDTypeApp ); 643 } 644 645 uint32 ModID() const 646 { 647 return m_gameID.m_nModID; 648 } 649 650 uint32 AppID() const 651 { 652 return m_gameID.m_nAppID; 653 } 654 655 bool operator == ( const CGameID &rhs ) const 656 { 657 return m_ulGameID == rhs.m_ulGameID; 658 } 659 660 bool operator != ( const CGameID &rhs ) const 661 { 662 return !(*this == rhs); 663 } 664 665 bool operator < ( const CGameID &rhs ) const 666 { 667 return ( m_ulGameID < rhs.m_ulGameID ); 668 } 669 670 bool IsValid() const 671 { 672 // each type has it's own invalid fixed point: 673 switch( m_gameID.m_nType ) 674 { 675 case k_EGameIDTypeApp: 676 return m_gameID.m_nAppID != k_uAppIdInvalid; 677 678 case k_EGameIDTypeGameMod: 679 return m_gameID.m_nAppID != k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000; 680 681 case k_EGameIDTypeShortcut: 682 return (m_gameID.m_nModID & 0x80000000) != 0; 683 684 case k_EGameIDTypeP2P: 685 return m_gameID.m_nAppID == k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000; 686 687 default: 688 return false; 689 } 690 691 } 692 693 void Reset() 694 { 695 m_ulGameID = 0; 696 } 697 698 // 699 // Internal stuff. Use the accessors above if possible 700 // 701 702 enum EGameIDType 703 { 704 k_EGameIDTypeApp = 0, 705 k_EGameIDTypeGameMod = 1, 706 k_EGameIDTypeShortcut = 2, 707 k_EGameIDTypeP2P = 3, 708 }; 709 710 struct GameID_t 711 { 712 #ifdef VALVE_BIG_ENDIAN 713 unsigned int m_nModID : 32; 714 unsigned int m_nType : 8; 715 unsigned int m_nAppID : 24; 716 #else 717 unsigned int m_nAppID : 24; 718 unsigned int m_nType : 8; 719 unsigned int m_nModID : 32; 720 #endif 721 }; 722 723 union 724 { 725 uint64 m_ulGameID; 726 GameID_t m_gameID; 727 }; 728 }; 729 730 #pragma pack( pop ) 731 732 const int k_cchGameExtraInfoMax = 64; 733 734 735 //----------------------------------------------------------------------------- 736 // Purpose: Passed as argument to SteamAPI_UseBreakpadCrashHandler to enable optional callback 737 // just before minidump file is captured after a crash has occurred. (Allows app to append additional comment data to the dump, etc.) 738 //----------------------------------------------------------------------------- 739 typedef void (*PFNPreMinidumpCallback)(void *context); 740 741 enum EGameSearchErrorCode_t 742 { 743 k_EGameSearchErrorCode_OK = 1, 744 k_EGameSearchErrorCode_Failed_Search_Already_In_Progress = 2, 745 k_EGameSearchErrorCode_Failed_No_Search_In_Progress = 3, 746 k_EGameSearchErrorCode_Failed_Not_Lobby_Leader = 4, // if not the lobby leader can not call SearchForGameWithLobby 747 k_EGameSearchErrorCode_Failed_No_Host_Available = 5, // no host is available that matches those search params 748 k_EGameSearchErrorCode_Failed_Search_Params_Invalid = 6, // search params are invalid 749 k_EGameSearchErrorCode_Failed_Offline = 7, // offline, could not communicate with server 750 k_EGameSearchErrorCode_Failed_NotAuthorized = 8, // either the user or the application does not have priveledges to do this 751 k_EGameSearchErrorCode_Failed_Unknown_Error = 9, // unknown error 752 }; 753 754 enum EPlayerResult_t 755 { 756 k_EPlayerResultFailedToConnect = 1, // failed to connect after confirming 757 k_EPlayerResultAbandoned = 2, // quit game without completing it 758 k_EPlayerResultKicked = 3, // kicked by other players/moderator/server rules 759 k_EPlayerResultIncomplete = 4, // player stayed to end but game did not conclude successfully ( nofault to player ) 760 k_EPlayerResultCompleted = 5, // player completed game 761 }; 762 763 764 enum ESteamIPv6ConnectivityProtocol 765 { 766 k_ESteamIPv6ConnectivityProtocol_Invalid = 0, 767 k_ESteamIPv6ConnectivityProtocol_HTTP = 1, // because a proxy may make this different than other protocols 768 k_ESteamIPv6ConnectivityProtocol_UDP = 2, // test UDP connectivity. Uses a port that is commonly needed for other Steam stuff. If UDP works, TCP probably works. 769 }; 770 771 // For the above transport protocol, what do we think the local machine's connectivity to the internet over ipv6 is like 772 enum ESteamIPv6ConnectivityState 773 { 774 k_ESteamIPv6ConnectivityState_Unknown = 0, // We haven't run a test yet 775 k_ESteamIPv6ConnectivityState_Good = 1, // We have recently been able to make a request on ipv6 for the given protocol 776 k_ESteamIPv6ConnectivityState_Bad = 2, // We failed to make a request, either because this machine has no ipv6 address assigned, or it has no upstream connectivity 777 }; 778 779 780 // Define compile time assert macros to let us validate the structure sizes. 781 #define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1]; 782 783 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) 784 // The 32-bit version of gcc has the alignment requirement for uint64 and double set to 785 // 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned. 786 // The 64-bit version of gcc has the alignment requirement for these types set to 787 // 8 meaning that unless we use #pragma pack(4) our structures will get bigger. 788 // The 64-bit structure packing has to match the 32-bit structure packing for each platform. 789 #define VALVE_CALLBACK_PACK_SMALL 790 #else 791 #define VALVE_CALLBACK_PACK_LARGE 792 #endif 793 794 #if defined( VALVE_CALLBACK_PACK_SMALL ) 795 #pragma pack( push, 4 ) 796 #elif defined( VALVE_CALLBACK_PACK_LARGE ) 797 #pragma pack( push, 8 ) 798 #else 799 #error ??? 800 #endif 801 802 typedef struct ValvePackingSentinel_t 803 { 804 uint32 m_u32; 805 uint64 m_u64; 806 uint16 m_u16; 807 double m_d; 808 } ValvePackingSentinel_t; 809 810 #pragma pack( pop ) 811 812 813 #if defined(VALVE_CALLBACK_PACK_SMALL) 814 VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 24 ) 815 #elif defined(VALVE_CALLBACK_PACK_LARGE) 816 VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 32 ) 817 #else 818 #error ??? 819 #endif 820 821 #endif // STEAMCLIENTPUBLIC_H 822 823 +/