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