diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..19a2f036e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +linux_sdk/obj/ diff --git a/common/language.cpp b/common/language.cpp new file mode 100644 index 000000000..33877f602 --- /dev/null +++ b/common/language.cpp @@ -0,0 +1,218 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: languages definition +// +//============================================================================= + +#include "language.h" +#include "tier0/dbg.h" +#include "tier1/strtools.h" + +// NOTE: This has to be the last file included! +#include "tier0/memdbgon.h" + + +struct Language_t +{ + const char *m_pchName; + const char *m_pchShortName; + const char *m_pchVGUILocalizationName; + const char *m_pchICUName; // used by osx; ISO-639-1 + ISO-3166-1 alpha-2. http://userguide.icu-project.org/locale/examples + ELanguage m_ELanguage; + int m_LanguageCodeID; +}; + + +// REVIEW +// es_ES - use new world spanish country code instead? +// zh_CN - validate that SC date formats come through +// bt_BR - assume we should use Brazilian rather than Iberian portguese + +static const Language_t s_LanguageNames[] = +{ + { "None", "none", "None", "none", k_Lang_None, 0 }, + { "English", "english", "#GameUI_Language_English", "en_US", k_Lang_English, 1033 }, + { "German", "german", "#GameUI_Language_German", "de_DE", k_Lang_German, 1031 } , + { "French", "french", "#GameUI_Language_French", "fr_FR", k_Lang_French, 1036 } , + { "Italian", "italian", "#GameUI_Language_Italian", "it_IT", k_Lang_Italian, 1040 } , + { "Korean", "koreana", "#GameUI_Language_Korean", "ko_KR", k_Lang_Korean, 1042 } , + { "Spanish", "spanish", "#GameUI_Language_Spanish", "es_ES", k_Lang_Spanish, 1034 }, + { "Simplified_Chinese", "schinese", "#GameUI_Language_Simplified_Chinese", "zh_CN", k_Lang_Simplified_Chinese, 2052 }, + { "Traditional_Chinese", "tchinese", "#GameUI_Language_Traditional_Chinese", "zh_TW", k_Lang_Traditional_Chinese, 1028 }, + { "Russian", "russian", "#GameUI_Language_Russian", "ru_RU", k_Lang_Russian, 1049 } , + { "Thai", "thai", "#GameUI_Language_Thai", "th_TH", k_Lang_Thai, 1054 } , + { "Japanese", "japanese", "#GameUI_Language_Japanese", "ja_JP", k_Lang_Japanese, 1041 } , + { "Portuguese", "portuguese", "#GameUI_Language_Portuguese", "pt_PT", k_Lang_Portuguese, 2070 } , + { "Polish", "polish", "#GameUI_Language_Polish", "pl_PL", k_Lang_Polish, 1045 } , + { "Danish", "danish", "#GameUI_Language_Danish", "da_DK", k_Lang_Danish, 1030 } , + { "Dutch", "dutch", "#GameUI_Language_Dutch", "nl_NL", k_Lang_Dutch, 1043 } , + { "Finnish", "finnish", "#GameUI_Language_Finnish", "fi_FI", k_Lang_Finnish, 1035 } , + { "Norwegian", "norwegian", "#GameUI_Language_Norwegian", "no_NO", k_Lang_Norwegian, 1044 } , + { "Swedish", "swedish", "#GameUI_Language_Swedish", "sv_SE", k_Lang_Swedish, 1053 } , + { "Romanian", "romanian", "#GameUI_Language_Romanian", "ro_RO", k_Lang_Romanian, 1048 } , + { "Turkish", "turkish", "#GameUI_Language_Turkish", "tr_TR", k_Lang_Turkish, 1055 } , + { "Hungarian", "hungarian", "#GameUI_Language_Hungarian", "hu_HU", k_Lang_Hungarian, 1038 } , + { "Czech", "czech", "#GameUI_Language_Czech", "cs_CZ", k_Lang_Czech, 1029 } , + { "Brazilian", "brazilian", "#GameUI_Language_Brazilian", "pt_BR", k_Lang_Brazilian, 1046 } , + { "Bulgarian", "bulgarian", "#GameUI_Language_Bulgarian", "bg_BG", k_Lang_Bulgarian, 1026 } , + { "Greek", "greek", "#GameUI_Language_Greek", "el_GR", k_Lang_Greek, 1032 }, + { "Ukrainian", "ukrainian", "#GameUI_Language_Ukrainian", "uk_UA", k_Lang_Ukrainian, 1058 }, +}; + +//----------------------------------------------------------------------------- +// Purpose: translate language enum into closests windows language code ID +//----------------------------------------------------------------------------- +int GetLanguageCodeID(ELanguage eLang) +{ + for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang ) + { + if ( s_LanguageNames[iLang].m_ELanguage == eLang ) + return s_LanguageNames[iLang].m_LanguageCodeID; + } + + // default to English + return 1033; +} + +//----------------------------------------------------------------------------- +// Purpose: find the language by name +//----------------------------------------------------------------------------- +ELanguage PchLanguageToELanguage( const char *pchShortName, ELanguage eDefault ) +{ + Assert( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 ); + if ( !pchShortName ) + return eDefault; + + for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang ) + { + if ( !Q_stricmp( pchShortName, s_LanguageNames[iLang].m_pchShortName ) ) + { + return s_LanguageNames[iLang].m_ELanguage; + } + } + + // return default + return eDefault; +} + +//----------------------------------------------------------------------------- +// Purpose: find the language by ICU short code +//----------------------------------------------------------------------------- +ELanguage PchLanguageICUCodeToELanguage( const char *pchICUCode, ELanguage eDefault ) +{ + Assert( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 ); + if ( !pchICUCode ) + return eDefault; + + // Match to no more than the param length so either a short 'en' or + // full 'zh-Hant' can match + int nLen = Q_strlen( pchICUCode ); + + // we only have 5 character ICU codes so this should be enough room + char rchCleanedCode[ 6 ]; + Q_strncpy( rchCleanedCode, pchICUCode, Q_ARRAYSIZE( rchCleanedCode ) ); + if( nLen >= 3 && rchCleanedCode[ 2 ] == '-' ) + { + rchCleanedCode[ 2 ] = '_'; + } + + for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang ) + { + if ( !Q_strnicmp( rchCleanedCode, s_LanguageNames[iLang].m_pchICUName, nLen ) ) + { + return s_LanguageNames[iLang].m_ELanguage; + } + } + + // return default + return eDefault; +} + + +//----------------------------------------------------------------------------- +// Purpose: return the short string name used for this language by SteamUI +//----------------------------------------------------------------------------- +const char *GetLanguageShortName( ELanguage eLang ) +{ + COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 ); + if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang ) + { + Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) ); + return s_LanguageNames[ eLang + 1 ].m_pchShortName; + } + + Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" ); + return s_LanguageNames[0].m_pchShortName; +} + +//----------------------------------------------------------------------------- +// Purpose: return the ICU code used for this language by SteamUI +//----------------------------------------------------------------------------- +const char *GetLanguageICUName( ELanguage eLang ) +{ + COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 ); + if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang ) + { + Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) ); + return s_LanguageNames[ eLang + 1 ].m_pchICUName; + } + + Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" ); + return s_LanguageNames[0].m_pchICUName; +} + +//----------------------------------------------------------------------------- +// Purpose: return the CLocale name that works with setlocale() +//----------------------------------------------------------------------------- +const char *GetLangugeCLocaleName( ELanguage eLang ) +{ + if ( eLang == k_Lang_None ) + return ""; + +#ifdef _WIN32 + // table for Win32 is here: http://msdn.microsoft.com/en-us/library/hzz3tw78(v=VS.80).aspx + // shortname works except for chinese + + switch ( eLang ) + { + case k_Lang_Simplified_Chinese: + return "chs"; // or "chinese-simplified" + case k_Lang_Traditional_Chinese: + return "cht"; // or "chinese-traditional" + case k_Lang_Korean: + return "korean"; // steam likes "koreana" for the name for some reason. + default: + return GetLanguageShortName( eLang ); + } + +#else + switch ( eLang ) + { + case k_Lang_Simplified_Chinese: + case k_Lang_Traditional_Chinese: + return "zh_CN"; + default: + ; + } + + // ICU codes work on linux/osx + return GetLanguageICUName( eLang ); +#endif +} + +//----------------------------------------------------------------------------- +// Purpose: return the short string name used for this language by SteamUI +//----------------------------------------------------------------------------- +const char *GetLanguageVGUILocalization( ELanguage eLang ) +{ + COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 ); + if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang ) + { + Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) ); + return s_LanguageNames[ eLang + 1 ].m_pchVGUILocalizationName; + } + + Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" ); + return s_LanguageNames[0].m_pchVGUILocalizationName; +} + diff --git a/common/language.h b/common/language.h new file mode 100644 index 000000000..b16c492fb --- /dev/null +++ b/common/language.h @@ -0,0 +1,56 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: represent a canonical list of the languages we support, +// +//============================================================================= + +#ifndef LANG_H +#define LANG_H +#ifdef _WIN32 +#pragma once +#endif + +// if you change this enum also change language.cpp:s_LanguageNames +enum ELanguage +{ + k_Lang_None = -1, + k_Lang_First = 0, + k_Lang_English = 0, + k_Lang_German, + k_Lang_French, + k_Lang_Italian, + k_Lang_Korean, + k_Lang_Spanish, + k_Lang_Simplified_Chinese, + k_Lang_Traditional_Chinese, + k_Lang_Russian, + k_Lang_Thai, + k_Lang_Japanese, + k_Lang_Portuguese, + k_Lang_Polish, + k_Lang_Danish, + k_Lang_Dutch, + k_Lang_Finnish, + k_Lang_Norwegian, + k_Lang_Swedish, + k_Lang_Romanian, + k_Lang_Turkish, + k_Lang_Hungarian, + k_Lang_Czech, + k_Lang_Brazilian, + k_Lang_Bulgarian, + k_Lang_Greek, + k_Lang_Ukrainian, + k_Lang_MAX +}; + +#define FOR_EACH_LANGUAGE( eLang ) for ( int eLang = (int)k_Lang_First; eLang < k_Lang_MAX; ++eLang ) + +ELanguage PchLanguageToELanguage(const char *pchShortName, ELanguage eDefault = k_Lang_English); +ELanguage PchLanguageICUCodeToELanguage( const char *pchICUCode, ELanguage eDefault = k_Lang_English ); +const char *GetLanguageShortName( ELanguage eLang ); +const char *GetLanguageICUName( ELanguage eLang ); +const char *GetLanguageVGUILocalization( ELanguage eLang ); +const char *GetLanguageName( ELanguage eLang ); + +#endif /* LANG_H */ diff --git a/game/server/nav.h b/game/server/nav.h index bf3c7757c..997ad3c99 100644 --- a/game/server/nav.h +++ b/game/server/nav.h @@ -18,20 +18,34 @@ * Below are several constants used by the navigation system. * @todo Move these into TheNavMesh singleton. */ -const float GenerationStepSize = 25.0f; ///< (30) was 20, but bots can't fit always fit -const float StepHeight = 18.0f; ///< if delta Z is greater than this, we have to jump to get up -const float JumpHeight = 41.8f; ///< if delta Z is less than this, we can jump up on it -const float JumpCrouchHeight = 58.0f; ///< (48) if delta Z is less than or equal to this, we can jumpcrouch up on it +const float GenerationStepSize = 25.0f; // (30) was 20, but bots can't fit always fit +const float JumpHeight = 41.8f; // if delta Z is less than this, we can jump up on it +const float JumpCrouchHeight = 64.0f; // (48) if delta Z is less than or equal to this, we can jumpcrouch up on it -const float BotRadius = 10.0f; ///< circular extent that contains bot -const float DeathDrop = 200.0f; ///< (300) distance at which we will die if we fall - should be about 600, and pay attention to fall damage during pathfind +// There are 3 different definitions of StepHeight throughout the code, waiting to produce bugs if the 18.0 is ever changed. +#ifdef INFESTED_DLL +const float StepHeight = 24.0f; ///< if delta Z is greater than this, we have to jump to get up +#else +const float StepHeight = 18.0f; // if delta Z is greater than this, we have to jump to get up +#endif // INFESTED_DLL -const float HalfHumanWidth = 16.0f; -const float HalfHumanHeight = 36.0f; -const float HumanHeight = 72.0f; -#define NAV_MAGIC_NUMBER 0xFEEDFACE ///< to help identify nav files +// TERROR: Increased DeathDrop from 200, since zombies don't take falling damage +const float DeathDrop = 400.0f; // (300) distance at which we will die if we fall - should be about 600, and pay attention to fall damage during pathfind +const float ClimbUpHeight = 200.0f; // height to check for climbing up +const float CliffHeight = 300.0f; // height which we consider a significant cliff which we would not want to fall off of + +// TERROR: Converted these values to use the same numbers as the player bounding boxes etc +#define HalfHumanWidth 16 +#define HalfHumanHeight 35.5 +#define HumanHeight 71 +#define HumanEyeHeight 62 +#define HumanCrouchHeight 55 +#define HumanCrouchEyeHeight 37 + + +#define NAV_MAGIC_NUMBER 0xFEEDFACE // to help identify nav files /** * A place is a named group of navigation areas @@ -48,24 +62,38 @@ enum NavErrorType NAV_BAD_FILE_VERSION, NAV_FILE_OUT_OF_DATE, NAV_CORRUPT_DATA, + NAV_OUT_OF_MEMORY, }; enum NavAttributeType { - NAV_MESH_CROUCH = 0x0001, ///< must crouch to use this node/area - NAV_MESH_JUMP = 0x0002, ///< must jump to traverse this area - NAV_MESH_PRECISE = 0x0004, ///< do not adjust for obstacles, just move along area - NAV_MESH_NO_JUMP = 0x0008, ///< inhibit discontinuity jumping - NAV_MESH_STOP = 0x0010, ///< must stop when entering this area - NAV_MESH_RUN = 0x0020, ///< must run to traverse this area - NAV_MESH_WALK = 0x0040, ///< must walk to traverse this area - NAV_MESH_AVOID = 0x0080, ///< avoid this area unless alternatives are too dangerous - NAV_MESH_TRANSIENT = 0x0100, ///< area may become blocked, and should be periodically checked - NAV_MESH_DONT_HIDE = 0x0200, ///< area should not be considered for hiding spot generation - NAV_MESH_STAND = 0x0400, ///< bots hiding in this area should stand - NAV_MESH_NO_HOSTAGES = 0x0800, ///< hostages shouldn't use this area + NAV_MESH_INVALID = 0, + NAV_MESH_CROUCH = 0x0000001, // must crouch to use this node/area + NAV_MESH_JUMP = 0x0000002, // must jump to traverse this area (only used during generation) + NAV_MESH_PRECISE = 0x0000004, // do not adjust for obstacles, just move along area + NAV_MESH_NO_JUMP = 0x0000008, // inhibit discontinuity jumping + NAV_MESH_STOP = 0x0000010, // must stop when entering this area + NAV_MESH_RUN = 0x0000020, // must run to traverse this area + NAV_MESH_WALK = 0x0000040, // must walk to traverse this area + NAV_MESH_AVOID = 0x0000080, // avoid this area unless alternatives are too dangerous + NAV_MESH_TRANSIENT = 0x0000100, // area may become blocked, and should be periodically checked + NAV_MESH_DONT_HIDE = 0x0000200, // area should not be considered for hiding spot generation + NAV_MESH_STAND = 0x0000400, // bots hiding in this area should stand + NAV_MESH_NO_HOSTAGES = 0x0000800, // hostages shouldn't use this area + NAV_MESH_STAIRS = 0x0001000, // this area represents stairs, do not attempt to climb or jump them - just walk up + NAV_MESH_NO_MERGE = 0x0002000, // don't merge this area with adjacent areas + NAV_MESH_OBSTACLE_TOP = 0x0004000, // this nav area is the climb point on the tip of an obstacle + NAV_MESH_CLIFF = 0x0008000, // this nav area is adjacent to a drop of at least CliffHeight + + NAV_MESH_FIRST_CUSTOM = 0x00010000, // apps may define custom app-specific bits starting with this value + NAV_MESH_LAST_CUSTOM = 0x04000000, // apps must not define custom app-specific bits higher than with this value + + NAV_MESH_HAS_ELEVATOR = 0x40000000, // area is in an elevator's path + NAV_MESH_NAV_BLOCKER = 0x80000000 // area is blocked by nav blocker ( Alas, needed to hijack a bit in the attributes to get within a cache line [7/24/2008 tom]) }; +extern NavAttributeType NameToNavAttribute( const char *name ); + enum NavDirType { NORTH = 0, @@ -86,9 +114,12 @@ enum NavTraverseType GO_EAST, GO_SOUTH, GO_WEST, + GO_LADDER_UP, GO_LADDER_DOWN, GO_JUMP, + GO_ELEVATOR_UP, + GO_ELEVATOR_DOWN, NUM_TRAVERSE_TYPES }; @@ -125,6 +156,11 @@ struct Extent hi.Init(); } + void Init( CBaseEntity *entity ) + { + entity->CollisionProp()->WorldSpaceSurroundingBounds( &lo, &hi ); + } + float SizeX( void ) const { return hi.x - lo.x; } float SizeY( void ) const { return hi.y - lo.y; } float SizeZ( void ) const { return hi.z - lo.z; } @@ -146,6 +182,13 @@ struct Extent } } + // Increase bounds to contain the given extent + void Encompass( const Extent &extent ) + { + Encompass( extent.lo ); + Encompass( extent.hi ); + } + /// return true if 'pos' is inside of this extent bool Contains( const Vector &pos ) const { @@ -153,6 +196,14 @@ struct Extent pos.y >= lo.y && pos.y <= hi.y && pos.z >= lo.z && pos.z <= hi.z); } + + /// return true if this extent overlaps the given one + bool IsOverlapping( const Extent &other ) const + { + return (lo.x <= other.hi.x && hi.x >= other.lo.x && + lo.y <= other.hi.y && hi.y >= other.lo.y && + lo.z <= other.hi.z && hi.z >= other.lo.z); + } }; struct Ray @@ -174,7 +225,6 @@ inline NavDirType OppositeDirection( NavDirType dir ) case SOUTH: return NORTH; case EAST: return WEST; case WEST: return EAST; - default: break; } return NORTH; @@ -189,7 +239,6 @@ inline NavDirType DirectionLeft( NavDirType dir ) case SOUTH: return EAST; case EAST: return NORTH; case WEST: return SOUTH; - default: break; } return NORTH; @@ -204,7 +253,6 @@ inline NavDirType DirectionRight( NavDirType dir ) case SOUTH: return WEST; case EAST: return SOUTH; case WEST: return NORTH; - default: break; } return NORTH; @@ -219,7 +267,6 @@ inline void AddDirectionVector( Vector *v, NavDirType dir, float amount ) case SOUTH: v->y += amount; return; case EAST: v->x += amount; return; case WEST: v->x -= amount; return; - default: break; } } @@ -232,7 +279,6 @@ inline float DirectionToAngle( NavDirType dir ) case SOUTH: return 90.0f; case EAST: return 0.0f; case WEST: return 180.0f; - default: break; } return 0.0f; @@ -268,7 +314,6 @@ inline void DirectionToVector2D( NavDirType dir, Vector2D *v ) case SOUTH: v->x = 0.0f; v->y = 1.0f; break; case EAST: v->x = 1.0f; v->y = 0.0f; break; case WEST: v->x = -1.0f; v->y = 0.0f; break; - default: break; } } @@ -282,21 +327,57 @@ inline void CornerToVector2D( NavCornerType dir, Vector2D *v ) case NORTH_EAST: v->x = 1.0f; v->y = -1.0f; break; case SOUTH_EAST: v->x = 1.0f; v->y = 1.0f; break; case SOUTH_WEST: v->x = -1.0f; v->y = 1.0f; break; - default: break; } v->NormalizeInPlace(); } +//-------------------------------------------------------------------------------------------------------------- +// Gets the corner types that surround the given direction +inline void GetCornerTypesInDirection( NavDirType dir, NavCornerType *first, NavCornerType *second ) +{ + switch ( dir ) + { + case NORTH: + *first = NORTH_WEST; + *second = NORTH_EAST; + break; + case SOUTH: + *first = SOUTH_WEST; + *second = SOUTH_EAST; + break; + case EAST: + *first = NORTH_EAST; + *second = SOUTH_EAST; + break; + case WEST: + *first = NORTH_WEST; + *second = SOUTH_WEST; + break; + } +} + + +//-------------------------------------------------------------------------------------------------------------- +inline float RoundToUnits( float val, float unit ) +{ + val = val + ((val < 0.0f) ? -unit*0.5f : unit*0.5f); + return (float)( unit * ( ((int)val) / (int)unit ) ); +} + + //-------------------------------------------------------------------------------------------------------------- /** * Return true if given entity can be ignored when moving */ -#define WALK_THRU_DOORS 0x01 -#define WALK_THRU_BREAKABLES 0x02 -#define WALK_THRU_TOGGLE_BRUSHES 0x04 +#define WALK_THRU_PROP_DOORS 0x01 +#define WALK_THRU_FUNC_DOORS 0x02 +#define WALK_THRU_DOORS (WALK_THRU_PROP_DOORS | WALK_THRU_FUNC_DOORS) +#define WALK_THRU_BREAKABLES 0x04 +#define WALK_THRU_TOGGLE_BRUSHES 0x08 #define WALK_THRU_EVERYTHING (WALK_THRU_DOORS | WALK_THRU_BREAKABLES | WALK_THRU_TOGGLE_BRUSHES) +extern ConVar nav_solid_props; inline bool IsEntityWalkable( CBaseEntity *entity, unsigned int flags ) { if (FClassnameIs( entity, "worldspawn" )) @@ -306,8 +387,11 @@ inline bool IsEntityWalkable( CBaseEntity *entity, unsigned int flags ) return false; // if we hit a door, assume its walkable because it will open when we touch it - if (FClassnameIs( entity, "prop_door*" ) || FClassnameIs( entity, "func_door*" )) - return (flags & WALK_THRU_DOORS) ? true : false; + if (FClassnameIs( entity, "func_door*" )) + return (flags & WALK_THRU_FUNC_DOORS) ? true : false; + + if (FClassnameIs( entity, "prop_door*" )) + return (flags & WALK_THRU_PROP_DOORS) ? true : false; // if we hit a clip brush, ignore it if it is not BRUSHSOLID_ALWAYS if (FClassnameIs( entity, "func_brush" )) @@ -331,6 +415,12 @@ inline bool IsEntityWalkable( CBaseEntity *entity, unsigned int flags ) if (FClassnameIs( entity, "func_breakable_surf" ) && entity->m_takedamage == DAMAGE_YES) return (flags & WALK_THRU_BREAKABLES) ? true : false; + if ( FClassnameIs( entity, "func_playerinfected_clip" ) == true ) + return true; + + if ( nav_solid_props.GetBool() && FClassnameIs( entity, "prop_*" ) ) + return true; + return false; } @@ -362,6 +452,6 @@ class CTraceFilterWalkableEntities : public CTraceFilterNoNPCsOrPlayer }; -extern bool IsWalkableTraceLineClear( Vector &from, Vector &to, unsigned int flags = 0 ); +extern bool IsWalkableTraceLineClear( const Vector &from, const Vector &to, unsigned int flags = 0 ); #endif // _NAV_H_ diff --git a/game/server/nav_area.h b/game/server/nav_area.h index 2c7e40fac..fcb135094 100644 --- a/game/server/nav_area.h +++ b/game/server/nav_area.h @@ -13,27 +13,77 @@ #define _NAV_AREA_H_ #include "nav_ladder.h" +#include "tier1/memstack.h" // BOTPORT: Clean up relationship between team index and danger storage in nav areas enum { MAX_NAV_TEAMS = 2 }; +class CFuncElevator; + +class CNavVectorNoEditAllocator +{ +public: + CNavVectorNoEditAllocator(); + + static void Reset(); + static void *Alloc( size_t nSize ); + static void *Realloc( void *pMem, size_t nSize ); + static void Free( void *pMem ); + static size_t GetSize( void *pMem ); + +private: + static CMemoryStack m_memory; + static void *m_pCurrent; + static int m_nBytesCurrent; +}; + +#if !defined(_X360) +typedef CUtlVectorUltraConservativeAllocator CNavVectorAllocator; +#else +typedef CNavVectorNoEditAllocator CNavVectorAllocator; +#endif + + +//------------------------------------------------------------------------------------------------------------------- +/** + * Functor interface for iteration + */ +class IForEachNavArea +{ +public: + virtual bool Inspect( const CNavArea *area ) = 0; // Invoked once on each area of the iterated set. Return false to stop iterating. + virtual void PostIteration( bool wasCompleteIteration ) { } // Invoked after the iteration has ended. 'wasCompleteIteration' will be true if the entire set was iterated (ie: Inspect() never returned false) +}; + //------------------------------------------------------------------------------------------------------------------- /** * The NavConnect union is used to refer to connections to areas */ -union NavConnect +struct NavConnect { - unsigned int id; - CNavArea *area; + NavConnect() + { + id = 0; + length = -1; + } + + union + { + unsigned int id; + CNavArea *area; + }; + + mutable float length; bool operator==( const NavConnect &other ) const { return (area == other.area) ? true : false; } }; -typedef CUtlLinkedList NavConnectList; + +typedef CUtlVectorUltraConservative NavConnectVector; //------------------------------------------------------------------------------------------------------------------- @@ -50,7 +100,7 @@ union NavLadderConnect return (ladder == other.ladder) ? true : false; } }; -typedef CUtlLinkedList NavLadderConnectList; +typedef CUtlVectorUltraConservative NavLadderConnectVector; //-------------------------------------------------------------------------------------------------------------- @@ -64,26 +114,26 @@ class HidingSpot enum { - IN_COVER = 0x01, ///< in a corner with good hard cover nearby - GOOD_SNIPER_SPOT = 0x02, ///< had at least one decent sniping corridor - IDEAL_SNIPER_SPOT = 0x04, ///< can see either very far, or a large area, or both - EXPOSED = 0x08 ///< spot in the open, usually on a ledge or cliff + IN_COVER = 0x01, // in a corner with good hard cover nearby + GOOD_SNIPER_SPOT = 0x02, // had at least one decent sniping corridor + IDEAL_SNIPER_SPOT = 0x04, // can see either very far, or a large area, or both + EXPOSED = 0x08 // spot in the open, usually on a ledge or cliff }; - bool HasGoodCover( void ) const { return (m_flags & IN_COVER) ? true : false; } ///< return true if hiding spot in in cover + bool HasGoodCover( void ) const { return (m_flags & IN_COVER) ? true : false; } // return true if hiding spot in in cover bool IsGoodSniperSpot( void ) const { return (m_flags & GOOD_SNIPER_SPOT) ? true : false; } bool IsIdealSniperSpot( void ) const { return (m_flags & IDEAL_SNIPER_SPOT) ? true : false; } bool IsExposed( void ) const { return (m_flags & EXPOSED) ? true : false; } int GetFlags( void ) const { return m_flags; } - void Save( FileHandle_t file, unsigned int version ) const; - void Load( FileHandle_t file, unsigned int version ); + void Save( CUtlBuffer &fileBuffer, unsigned int version ) const; + void Load( CUtlBuffer &fileBuffer, unsigned int version ); NavErrorType PostLoad( void ); - const Vector &GetPosition( void ) const { return m_pos; } ///< get the position of the hiding spot + const Vector &GetPosition( void ) const { return m_pos; } // get the position of the hiding spot unsigned int GetID( void ) const { return m_id; } - const CNavArea *GetArea( void ) const { return m_area; } ///< return nav area this hiding spot is within + const CNavArea *GetArea( void ) const { return m_area; } // return nav area this hiding spot is within void Mark( void ) { m_marker = m_masterMarker; } bool IsMarked( void ) const { return (m_marker == m_masterMarker) ? true : false; } @@ -91,27 +141,27 @@ class HidingSpot public: - void SetFlags( int flags ) { m_flags |= flags; } ///< FOR INTERNAL USE ONLY - void SetPosition( const Vector &pos ) { m_pos = pos; } ///< FOR INTERNAL USE ONLY + void SetFlags( int flags ) { m_flags |= flags; } // FOR INTERNAL USE ONLY + void SetPosition( const Vector &pos ) { m_pos = pos; } // FOR INTERNAL USE ONLY private: friend class CNavMesh; friend void ClassifySniperSpot( HidingSpot *spot ); - HidingSpot( void ); ///< must use factory to create + HidingSpot( void ); // must use factory to create - Vector m_pos; ///< world coordinates of the spot - unsigned int m_id; ///< this spot's unique ID - unsigned int m_marker; ///< this spot's unique marker - CNavArea *m_area; ///< the nav area containing this hiding spot + Vector m_pos; // world coordinates of the spot + unsigned int m_id; // this spot's unique ID + unsigned int m_marker; // this spot's unique marker + CNavArea *m_area; // the nav area containing this hiding spot - unsigned char m_flags; ///< bit flags + unsigned char m_flags; // bit flags - static unsigned int m_nextID; ///< used when allocating spot ID's - static unsigned int m_masterMarker; ///< used to mark spots + static unsigned int m_nextID; // used when allocating spot ID's + static unsigned int m_masterMarker; // used to mark spots }; -typedef CUtlLinkedList< HidingSpot *, int > HidingSpotList; -extern HidingSpotList TheHidingSpotList; +typedef CUtlVectorUltraConservative< HidingSpot * > HidingSpotVector; +extern HidingSpotVector TheHidingSpots; extern HidingSpot *GetHidingSpotByID( unsigned int id ); @@ -122,14 +172,14 @@ extern HidingSpot *GetHidingSpotByID( unsigned int id ); */ struct SpotOrder { - float t; ///< parametric distance along ray where this spot first has LOS to our path + float t; // parametric distance along ray where this spot first has LOS to our path union { - HidingSpot *spot; ///< the spot to look at - unsigned int id; ///< spot ID for save/load + HidingSpot *spot; // the spot to look at + unsigned int id; // spot ID for save/load }; }; -typedef CUtlLinkedList< SpotOrder, int > SpotOrderList; +typedef CUtlVector< SpotOrder > SpotOrderVector; /** * This struct stores possible path segments thru a CNavArea, and the dangerous spots @@ -141,132 +191,219 @@ struct SpotEncounter NavDirType fromDir; NavConnect to; NavDirType toDir; - Ray path; ///< the path segment - SpotOrderList spotList; ///< list of spots to look at, in order of occurrence + Ray path; // the path segment + SpotOrderVector spots; // list of spots to look at, in order of occurrence }; -typedef CUtlLinkedList< SpotEncounter *, int > SpotEncounterList; +typedef CUtlVectorUltraConservative< SpotEncounter * > SpotEncounterVector; //------------------------------------------------------------------------------------------------------------------- /** * A CNavArea is a rectangular region defining a walkable area in the environment */ -class CNavArea + +class CNavAreaCriticalData +{ +protected: + // --- Begin critical data, which is heavily hit during pathing operations and carefully arranged for cache performance [7/24/2008 tom] --- + + /* 0 */ Vector m_nwCorner; // north-west corner position (2D mins) + /* 12 */ Vector m_seCorner; // south-east corner position (2D maxs) + /* 24 */ float m_invDxCorners; + /* 28 */ float m_invDyCorners; + /* 32 */ float m_neZ; // height of the implicit corner defined by (m_seCorner.x, m_nwCorner.y, m_neZ) + /* 36 */ float m_swZ; // height of the implicit corner defined by (m_nwCorner.x, m_seCorner.y, m_neZ) + /* 40 */ Vector m_center; // centroid of area + + /* 52 */ unsigned char m_playerCount[ MAX_NAV_TEAMS ]; // the number of players currently in this area + + /* 54 */ bool m_isBlocked[ MAX_NAV_TEAMS ]; // if true, some part of the world is preventing movement through this nav area + + /* 56 */ unsigned int m_marker; // used to flag the area as visited + /* 60 */ float m_totalCost; // the distance so far plus an estimate of the distance left + /* 64 */ float m_costSoFar; // distance travelled so far + + /* 68 */ CNavArea *m_nextOpen, *m_prevOpen; // only valid if m_openMarker == m_masterMarker + /* 76 */ unsigned int m_openMarker; // if this equals the current marker value, we are on the open list + + /* 80 */ int m_attributeFlags; // set of attribute bit flags (see NavAttributeType) + + //- connections to adjacent areas ------------------------------------------------------------------- + /* 84 */ NavConnectVector m_connect[ NUM_DIRECTIONS ]; // a list of adjacent areas for each direction + /* 100*/ NavLadderConnectVector m_ladder[ CNavLadder::NUM_LADDER_DIRECTIONS ]; // list of ladders leading up and down from this area + /* 108*/ NavConnectVector m_elevatorAreas; // a list of areas reachable via elevator from this area + + /* 112*/ unsigned int m_nearNavSearchMarker; // used in GetNearestNavArea() + + /* 116*/ CNavArea *m_parent; // the area just prior to this on in the search path + /* 120*/ NavTraverseType m_parentHow; // how we get from parent to us + + /* 124*/ float m_pathLengthSoFar; // length of path so far, needed for limiting pathfind max path length + + /* *************** 360 cache line *************** */ + + /* 128*/ CFuncElevator *m_elevator; // if non-NULL, this area is in an elevator's path. The elevator can transport us vertically to another area. + + // --- End critical data --- +}; + + +class CNavArea : protected CNavAreaCriticalData { public: - CNavArea( CNavNode *nwNode, CNavNode *neNode, CNavNode *seNode, CNavNode *swNode ); + DECLARE_CLASS_NOBASE( CNavArea ) + CNavArea( void ); - CNavArea( const Vector &corner, const Vector &otherCorner ); - CNavArea( const Vector &nwCorner, const Vector &neCorner, const Vector &seCorner, const Vector &swCorner ); + virtual ~CNavArea(); + + virtual void OnServerActivate( void ); // (EXTEND) invoked when map is initially loaded + virtual void OnRoundRestart( void ); // (EXTEND) invoked for each area when the round restarts + virtual void OnRoundRestartPreEntity( void ) { } // invoked for each area when the round restarts, but before entities are deleted and recreated + virtual void OnEnter( CBaseCombatCharacter *who, CNavArea *areaJustLeft ) { } // invoked when player enters this area + virtual void OnExit( CBaseCombatCharacter *who, CNavArea *areaJustEntered ) { } // invoked when player exits this area - ~CNavArea(); + virtual void OnDestroyNotify( CNavArea *dead ); // invoked when given area is going away + virtual void OnDestroyNotify( CNavLadder *dead ); // invoked when given ladder is going away - void ConnectTo( CNavArea *area, NavDirType dir ); ///< connect this area to given area in given direction - void Disconnect( CNavArea *area ); ///< disconnect this area from given area + virtual void OnEditCreateNotify( CNavArea *newArea ) { } // invoked when given area has just been added to the mesh in edit mode + virtual void OnEditDestroyNotify( CNavArea *deadArea ) { } // invoked when given area has just been deleted from the mesh in edit mode + virtual void OnEditDestroyNotify( CNavLadder *deadLadder ) { } // invoked when given ladder has just been deleted from the mesh in edit mode - void ConnectTo( CNavLadder *ladder ); ///< connect this area to given ladder - void Disconnect( CNavLadder *ladder ); ///< disconnect this area from given ladder + virtual void Save( CUtlBuffer &fileBuffer, unsigned int version ) const; // (EXTEND) + virtual NavErrorType Load( CUtlBuffer &fileBuffer, unsigned int version, unsigned int subVersion ); // (EXTEND) + virtual NavErrorType PostLoad( void ); // (EXTEND) invoked after all areas have been loaded - for pointer binding, etc - void Save( FileHandle_t file, unsigned int version ) const; - void Load( FileHandle_t file, unsigned int version ); - NavErrorType PostLoad( void ); + virtual void SaveToSelectedSet( KeyValues *areaKey ) const; // (EXTEND) saves attributes for the area to a KeyValues + virtual void RestoreFromSelectedSet( KeyValues *areaKey ); // (EXTEND) restores attributes from a KeyValues + + // for interactively building or generating nav areas + void Build( CNavNode *nwNode, CNavNode *neNode, CNavNode *seNode, CNavNode *swNode ); + void Build( const Vector &corner, const Vector &otherCorner ); + void Build( const Vector &nwCorner, const Vector &neCorner, const Vector &seCorner, const Vector &swCorner ); - unsigned int GetID( void ) const { return m_id; } ///< return this area's unique ID - static void CompressIDs( void ); ///< re-orders area ID's so they are continuous + void ConnectTo( CNavArea *area, NavDirType dir ); // connect this area to given area in given direction + void Disconnect( CNavArea *area ); // disconnect this area from given area - void SetAttributes( int bits ) { m_attributeFlags = (unsigned short)bits; } - int GetAttributes( void ) const { return m_attributeFlags; } + void ConnectTo( CNavLadder *ladder ); // connect this area to given ladder + void Disconnect( CNavLadder *ladder ); // disconnect this area from given ladder - void SetPlace( Place place ) { m_place = place; } ///< set place descriptor - Place GetPlace( void ) const { return m_place; } ///< get place descriptor + unsigned int GetID( void ) const { return m_id; } // return this area's unique ID + static void CompressIDs( void ); // re-orders area ID's so they are continuous + unsigned int GetDebugID( void ) const { return m_debugid; } + + void SetAttributes( int bits ) { m_attributeFlags = bits; } + int GetAttributes( void ) const { return m_attributeFlags; } + bool HasAttributes( int bits ) const { return ( m_attributeFlags & bits ) ? true : false; } + void RemoveAttributes( int bits ) { m_attributeFlags &= ( ~bits ); } + + void SetPlace( Place place ) { m_place = place; } // set place descriptor + Place GetPlace( void ) const { return m_place; } // get place descriptor + + void MarkAsBlocked( int teamID, CBaseEntity *blocker, bool bGenerateEvent = true ); // An entity can force a nav area to be blocked + virtual void UpdateBlocked( bool force = false, int teamID = TEAM_ANY ); // Updates the (un)blocked status of the nav area (throttled) + bool IsBlocked( int teamID, bool ignoreNavBlockers = false ) const; + + void CheckFloor( CBaseEntity *ignore ); // Checks if there is a floor under the nav area, in case a breakable floor is gone + + void MarkObstacleToAvoid( float obstructionHeight ); + void UpdateAvoidanceObstacles( void ); + bool HasAvoidanceObstacle( float maxObstructionHeight = StepHeight ) const; // is there a large, immobile object obstructing this area + float GetAvoidanceObstacleHeight( void ) const; // returns the maximum height of the obstruction above the ground - void UpdateBlocked( void ); ///< Updates the (un)blocked status of the nav area - void CheckFloor( CBaseEntity *ignore ); ///< Checks if there is a floor under the nav area, in case a breakable floor is gone - bool IsBlocked( void ) const { return m_isBlocked; } void CheckWaterLevel( void ); bool IsUnderwater( void ) const { return m_isUnderwater; } - bool IsOverlapping( const Vector &pos, float tolerance = 0.0f ) const; ///< return true if 'pos' is within 2D extents of area. - bool IsOverlapping( const CNavArea *area ) const; ///< return true if 'area' overlaps our 2D extents - bool IsOverlappingX( const CNavArea *area ) const; ///< return true if 'area' overlaps our X extent - bool IsOverlappingY( const CNavArea *area ) const; ///< return true if 'area' overlaps our Y extent - float GetZ( const Vector &pos ) const; ///< return Z of area at (x,y) of 'pos' - float GetZ( float x, float y ) const; ///< return Z of area at (x,y) of 'pos' - bool Contains( const Vector &pos ) const; ///< return true if given point is on or above this area, but no others - bool IsCoplanar( const CNavArea *area ) const; ///< return true if this area and given area are approximately co-planar - void GetClosestPointOnArea( const Vector &pos, Vector *close ) const; ///< return closest point to 'pos' on this area - returned point in 'close' - float GetDistanceSquaredToPoint( const Vector &pos ) const; ///< return shortest distance between point and this area - bool IsDegenerate( void ) const; ///< return true if this area is badly formed - bool IsRoughlySquare( void ) const; ///< return true if this area is approximately square - bool IsFlat( void ) const; ///< return true if this area is approximately flat - - bool IsEdge( NavDirType dir ) const; ///< return true if there are no bi-directional links on the given side - - bool IsVisible( const Vector &eye, Vector *visSpot = NULL ) const; ///< return true if area is visible from the given eyepoint, return visible spot - - int GetAdjacentCount( NavDirType dir ) const { return m_connect[ dir ].Count(); } ///< return number of connected areas in given direction - CNavArea *GetAdjacentArea( NavDirType dir, int i ) const; /// return the i'th adjacent area in the given direction + bool IsOverlapping( const Vector &pos, float tolerance = 0.0f ) const; // return true if 'pos' is within 2D extents of area. + bool IsOverlapping( const CNavArea *area ) const; // return true if 'area' overlaps our 2D extents + bool IsOverlapping( const Extent &extent ) const; // return true if 'extent' overlaps our 2D extents + bool IsOverlappingX( const CNavArea *area ) const; // return true if 'area' overlaps our X extent + bool IsOverlappingY( const CNavArea *area ) const; // return true if 'area' overlaps our Y extent + inline float GetZ( const Vector * RESTRICT pPos ) const ; // return Z of area at (x,y) of 'pos' + inline float GetZ( const Vector &pos ) const; // return Z of area at (x,y) of 'pos' + float GetZ( float x, float y ) const RESTRICT; // return Z of area at (x,y) of 'pos' + bool Contains( const Vector &pos ) const; // return true if given point is on or above this area, but no others + bool Contains( const CNavArea *area ) const; + bool IsCoplanar( const CNavArea *area ) const; // return true if this area and given area are approximately co-planar + void GetClosestPointOnArea( const Vector * RESTRICT pPos, Vector *close ) const RESTRICT; // return closest point to 'pos' on this area - returned point in 'close' + void GetClosestPointOnArea( const Vector &pos, Vector *close ) const { return GetClosestPointOnArea( &pos, close ); } + float GetDistanceSquaredToPoint( const Vector &pos ) const; // return shortest distance between point and this area + bool IsDegenerate( void ) const; // return true if this area is badly formed + bool IsRoughlySquare( void ) const; // return true if this area is approximately square + bool IsFlat( void ) const; // return true if this area is approximately flat + bool HasNodes( void ) const; + void GetNodes( NavDirType dir, CUtlVector< CNavNode * > *nodes ) const; // build a vector of nodes along the given direction + CNavNode *FindClosestNode( const Vector &pos, NavDirType dir ) const; // returns the closest node along the given edge to the given point + + bool IsContiguous( const CNavArea *other ) const; // return true if the given area and 'other' share a colinear edge (ie: no drop-down or step/jump/climb) + float ComputeAdjacentConnectionHeightChange( const CNavArea *destinationArea ) const; // return height change between edges of adjacent nav areas (not actual underlying ground) + + bool IsEdge( NavDirType dir ) const; // return true if there are no bi-directional links on the given side + + bool IsDamaging( void ) const; // Return true if continuous damage (ie: fire) is in this area + void MarkAsDamaging( float duration ); // Mark this area is damaging for the next 'duration' seconds + + bool IsVisible( const Vector &eye, Vector *visSpot = NULL ) const; // return true if area is visible from the given eyepoint, return visible spot + + int GetAdjacentCount( NavDirType dir ) const { return m_connect[ dir ].Count(); } // return number of connected areas in given direction + CNavArea *GetAdjacentArea( NavDirType dir, int i ) const; // return the i'th adjacent area in the given direction CNavArea *GetRandomAdjacentArea( NavDirType dir ) const; - const NavConnectList *GetAdjacentList( NavDirType dir ) const { return &m_connect[dir]; } - bool IsConnected( const CNavArea *area, NavDirType dir ) const; ///< return true if given area is connected in given direction - bool IsConnected( const CNavLadder *ladder, CNavLadder::LadderDirectionType dir ) const; ///< return true if given ladder is connected in given direction - float ComputeHeightChange( const CNavArea *area ); ///< compute change in height from this area to given area + const NavConnectVector *GetAdjacentAreas( NavDirType dir ) const { return &m_connect[dir]; } + bool IsConnected( const CNavArea *area, NavDirType dir ) const; // return true if given area is connected in given direction + bool IsConnected( const CNavLadder *ladder, CNavLadder::LadderDirectionType dir ) const; // return true if given ladder is connected in given direction + float ComputeGroundHeightChange( const CNavArea *area ); // compute change in actual ground height from this area to given area + + const NavConnectVector *GetIncomingConnections( NavDirType dir ) const { return &m_incomingConnect[dir]; } // get areas connected TO this area by a ONE-WAY link (ie: we have no connection back to them) + void AddIncomingConnection( CNavArea *source, NavDirType incomingEdgeDir ); - const NavLadderConnectList *GetLadderList( CNavLadder::LadderDirectionType dir ) const { return &m_ladder[dir]; } + const NavLadderConnectVector *GetLadders( CNavLadder::LadderDirectionType dir ) const { return &m_ladder[dir]; } + CFuncElevator *GetElevator( void ) const { Assert( !( m_attributeFlags & NAV_MESH_HAS_ELEVATOR ) == (m_elevator == NULL) ); return ( m_attributeFlags & NAV_MESH_HAS_ELEVATOR ) ? m_elevator : NULL; } + const NavConnectVector &GetElevatorAreas( void ) const { return m_elevatorAreas; } // return collection of areas reachable via elevator from this area - void ComputePortal( const CNavArea *to, NavDirType dir, Vector *center, float *halfWidth ) const; ///< compute portal to adjacent area - void ComputeClosestPointInPortal( const CNavArea *to, NavDirType dir, const Vector &fromPos, Vector *closePos ) const; ///< compute closest point within the "portal" between to adjacent areas - NavDirType ComputeDirection( Vector *point ) const; ///< return direction from this area to the given point + void ComputePortal( const CNavArea *to, NavDirType dir, Vector *center, float *halfWidth ) const; // compute portal to adjacent area + NavDirType ComputeLargestPortal( const CNavArea *to, Vector *center, float *halfWidth ) const; // compute largest portal to adjacent area, returning direction + void ComputeClosestPointInPortal( const CNavArea *to, NavDirType dir, const Vector &fromPos, Vector *closePos ) const; // compute closest point within the "portal" between to adjacent areas + NavDirType ComputeDirection( Vector *point ) const; // return direction from this area to the given point //- for hunting algorithm --------------------------------------------------------------------------- - void SetClearedTimestamp( int teamID ); ///< set this area's "clear" timestamp to now - float GetClearedTimestamp( int teamID ) const; ///< get time this area was marked "clear" + void SetClearedTimestamp( int teamID ); // set this area's "clear" timestamp to now + float GetClearedTimestamp( int teamID ) const; // get time this area was marked "clear" //- hiding spots ------------------------------------------------------------------------------------ - const HidingSpotList *GetHidingSpotList( void ) const { return &m_hidingSpotList; } - void ComputeHidingSpots( void ); ///< analyze local area neighborhood to find "hiding spots" in this area - for map learning - void ComputeSniperSpots( void ); ///< analyze local area neighborhood to find "sniper spots" in this area - for map learning + const HidingSpotVector *GetHidingSpots( void ) const { return &m_hidingSpots; } - SpotEncounter *GetSpotEncounter( const CNavArea *from, const CNavArea *to ); ///< given the areas we are moving between, return the spots we will encounter - void ComputeSpotEncounters( void ); ///< compute spot encounter data - for map learning - int GetSpotEncounterCount( void ) const { return m_spotEncounterList.Count(); } + SpotEncounter *GetSpotEncounter( const CNavArea *from, const CNavArea *to ); // given the areas we are moving between, return the spots we will encounter + int GetSpotEncounterCount( void ) const { return m_spotEncounters.Count(); } //- "danger" ---------------------------------------------------------------------------------------- - void IncreaseDanger( int teamID, float amount ); ///< increase the danger of this area for the given team - float GetDanger( int teamID ); ///< return the danger of this area (decays over time) + void IncreaseDanger( int teamID, float amount ); // increase the danger of this area for the given team + float GetDanger( int teamID ); // return the danger of this area (decays over time) + virtual float GetDangerDecayRate( void ) const; // return danger decay rate per second //- extents ----------------------------------------------------------------------------------------- - float GetSizeX( void ) const { return m_extent.hi.x - m_extent.lo.x; } - float GetSizeY( void ) const { return m_extent.hi.y - m_extent.lo.y; } - const Extent &GetExtent( void ) const { return m_extent; } + float GetSizeX( void ) const { return m_seCorner.x - m_nwCorner.x; } + float GetSizeY( void ) const { return m_seCorner.y - m_nwCorner.y; } + void GetExtent( Extent *extent ) const; // return a computed extent (XY is in m_nwCorner and m_seCorner, Z is computed) const Vector &GetCenter( void ) const { return m_center; } - const Vector &GetCorner( NavCornerType corner ) const; + Vector GetRandomPoint( void ) const; + Vector GetCorner( NavCornerType corner ) const; void SetCorner( NavCornerType corner, const Vector& newPosition ); - void ComputeNormal( Vector *normal, bool alternate = false ) const; ///< Computes the area's normal based on m_extent.lo. If 'alternate' is specified, m_extent.hi is used instead. - - //- approach areas ---------------------------------------------------------------------------------- - struct ApproachInfo - { - NavConnect here; ///< the approach area - NavConnect prev; ///< the area just before the approach area on the path - NavTraverseType prevToHereHow; - NavConnect next; ///< the area just after the approach area on the path - NavTraverseType hereToNextHow; - }; - const ApproachInfo *GetApproachInfo( int i ) const { return &m_approach[i]; } - int GetApproachInfoCount( void ) const { return m_approachCount; } - void ComputeApproachAreas( void ); ///< determine the set of "approach areas" - for map learning + void ComputeNormal( Vector *normal, bool alternate = false ) const; // Computes the area's normal based on m_nwCorner. If 'alternate' is specified, m_seCorner is used instead. + void RemoveOrthogonalConnections( NavDirType dir ); //- occupy time ------------------------------------------------------------------------------------ - float GetEarliestOccupyTime( int teamID ) const; ///< returns the minimum time for someone of the given team to reach this spot from their spawn - bool IsBattlefront( void ) const { return m_isBattlefront; } ///< true if this area is a "battlefront" - where rushing teams initially meet + float GetEarliestOccupyTime( int teamID ) const; // returns the minimum time for someone of the given team to reach this spot from their spawn + bool IsBattlefront( void ) const { return m_isBattlefront; } // true if this area is a "battlefront" - where rushing teams initially meet //- player counting -------------------------------------------------------------------------------- - void IncrementPlayerCount( int teamID ); ///< add one player to this area's count - void DecrementPlayerCount( int teamID ); ///< subtract one player from this area's count - void ClearPlayerCount( void ); ///< set the player count to zero - unsigned char GetPlayerCount( int teamID = 0 ) const; ///< return number of players of given team currently within this area (team of zero means any/all) + void IncrementPlayerCount( int teamID, int entIndex ); // add one player to this area's count + void DecrementPlayerCount( int teamID, int entIndex ); // subtract one player from this area's count + unsigned char GetPlayerCount( int teamID = 0 ) const; // return number of players of given team currently within this area (team of zero means any/all) + + //- lighting ---------------------------------------------------------------------------------------- + float GetLightIntensity( const Vector &pos ) const; // returns a 0..1 light intensity for the given point + float GetLightIntensity( float x, float y ) const; // returns a 0..1 light intensity for the given point + float GetLightIntensity( void ) const; // returns a 0..1 light intensity averaged over the whole area //- A* pathfinding algorithm ------------------------------------------------------------------------ static void MakeNewMarker( void ) { ++m_masterMarker; if (m_masterMarker == 0) m_masterMarker = 1; } @@ -277,50 +414,225 @@ class CNavArea CNavArea *GetParent( void ) const { return m_parent; } NavTraverseType GetParentHow( void ) const { return m_parentHow; } - bool IsOpen( void ) const; ///< true if on "open list" - void AddToOpenList( void ); ///< add to open list in decreasing value order - void UpdateOnOpenList( void ); ///< a smaller value has been found, update this area on the open list + bool IsOpen( void ) const; // true if on "open list" + void AddToOpenList( void ); // add to open list in decreasing value order + void AddToOpenListTail( void ); // add to tail of the open list + void UpdateOnOpenList( void ); // a smaller value has been found, update this area on the open list void RemoveFromOpenList( void ); static bool IsOpenListEmpty( void ); - static CNavArea *PopOpenList( void ); ///< remove and return the first element of the open list + static CNavArea *PopOpenList( void ); // remove and return the first element of the open list - bool IsClosed( void ) const; ///< true if on "closed list" - void AddToClosedList( void ); ///< add to the closed list + bool IsClosed( void ) const; // true if on "closed list" + void AddToClosedList( void ); // add to the closed list void RemoveFromClosedList( void ); - static void ClearSearchLists( void ); ///< clears the open and closed lists for a new search + static void ClearSearchLists( void ); // clears the open and closed lists for a new search - void SetTotalCost( float value ) { m_totalCost = value; } + void SetTotalCost( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_totalCost = value; } float GetTotalCost( void ) const { return m_totalCost; } - void SetCostSoFar( float value ) { m_costSoFar = value; } + void SetCostSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_costSoFar = value; } float GetCostSoFar( void ) const { return m_costSoFar; } + void SetPathLengthSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_pathLengthSoFar = value; } + float GetPathLengthSoFar( void ) const { return m_pathLengthSoFar; } + //- editing ----------------------------------------------------------------------------------------- - void Draw( void ) const; ///< draw area for debugging & editing + virtual void Draw( void ) const; // draw area for debugging & editing + virtual void DrawFilled( int r, int g, int b, int a, float deltaT = 0.1f, bool noDepthTest = true, float margin = 5.0f ) const; // draw area as a filled rect of the given color + virtual void DrawSelectedSet( const Vector &shift ) const; // draw this area as part of a selected set + void DrawDragSelectionSet( Color &dragSelectionSetColor ) const; void DrawConnectedAreas( void ) const; void DrawHidingSpots( void ) const; - bool SplitEdit( bool splitAlongX, float splitEdge, CNavArea **outAlpha = NULL, CNavArea **outBeta = NULL ); ///< split this area into two areas at the given edge - bool MergeEdit( CNavArea *adj ); ///< merge this area and given adjacent area - bool SpliceEdit( CNavArea *other ); ///< create a new area between this area and given area - void RaiseCorner( NavCornerType corner, int amount, bool raiseAdjacentCorners = true ); ///< raise/lower a corner (or all corners if corner == NUM_CORNERS) - void PlaceOnGround( NavCornerType corner, float inset = 0.0f ); ///< places a corner (or all corners if corner == NUM_CORNERS) on the ground + bool SplitEdit( bool splitAlongX, float splitEdge, CNavArea **outAlpha = NULL, CNavArea **outBeta = NULL ); // split this area into two areas at the given edge + bool MergeEdit( CNavArea *adj ); // merge this area and given adjacent area + bool SpliceEdit( CNavArea *other ); // create a new area between this area and given area + void RaiseCorner( NavCornerType corner, int amount, bool raiseAdjacentCorners = true ); // raise/lower a corner (or all corners if corner == NUM_CORNERS) + void PlaceOnGround( NavCornerType corner, float inset = 0.0f ); // places a corner (or all corners if corner == NUM_CORNERS) on the ground NavCornerType GetCornerUnderCursor( void ) const; - bool GetCornerHotspot( NavCornerType corner, Vector hotspot[NUM_CORNERS] ) const; ///< returns true if the corner is under the cursor + bool GetCornerHotspot( NavCornerType corner, Vector hotspot[NUM_CORNERS] ) const; // returns true if the corner is under the cursor + void Shift( const Vector &shift ); // shift the nav area //- ladders ----------------------------------------------------------------------------------------- void AddLadderUp( CNavLadder *ladder ); void AddLadderDown( CNavLadder *ladder ); + //- generation and analysis ------------------------------------------------------------------------- + virtual void ComputeHidingSpots( void ); // analyze local area neighborhood to find "hiding spots" in this area - for map learning + virtual void ComputeSniperSpots( void ); // analyze local area neighborhood to find "sniper spots" in this area - for map learning + virtual void ComputeSpotEncounters( void ); // compute spot encounter data - for map learning + virtual void ComputeEarliestOccupyTimes( void ); + virtual void CustomAnalysis( bool isIncremental = false ) { } // for game-specific analysis + virtual bool ComputeLighting( void ); // compute 0..1 light intensity at corners and center (requires client via listenserver) + bool TestStairs( void ); // Test an area for being on stairs + virtual bool IsAbleToMergeWith( CNavArea *other ) const; + + virtual void InheritAttributes( CNavArea *first, CNavArea *second = NULL ); + + + //- visibility ------------------------------------------------------------------------------------- + enum VisibilityType + { + NOT_VISIBLE = 0x00, + POTENTIALLY_VISIBLE = 0x01, + COMPLETELY_VISIBLE = 0x02, + }; + + VisibilityType ComputeVisibility( const CNavArea *area, bool isPVSValid, bool bCheckPVS = true, bool *pOutsidePVS = NULL ) const; // do actual line-of-sight traces to determine if any part of given area is visible from this area + void SetupPVS( void ) const; + bool IsInPVS( void ) const; // return true if this area is within the current PVS + + struct AreaBindInfo // for pointer loading and binding + { + union + { + CNavArea *area; + unsigned int id; + }; + + unsigned char attributes; // VisibilityType + + bool operator==( const AreaBindInfo &other ) const + { + return ( area == other.area ); + } + }; + + virtual bool IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if entire area is visible from given eyepoint (CPU intensive) + virtual bool IsPartiallyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if any portion of the area is visible from given eyepoint (CPU intensive) + + virtual bool IsPotentiallyVisible( const CNavArea *area ) const; // return true if given area is potentially visible from somewhere in this area (very fast) + virtual bool IsPotentiallyVisibleToTeam( int team ) const; // return true if any portion of this area is visible to anyone on the given team (very fast) + + virtual bool IsCompletelyVisible( const CNavArea *area ) const; // return true if given area is completely visible from somewhere in this area (very fast) + virtual bool IsCompletelyVisibleToTeam( int team ) const; // return true if given area is completely visible from somewhere in this area by someone on the team (very fast) + + //------------------------------------------------------------------------------------- + /** + * Apply the functor to all navigation areas that are potentially + * visible from this area. + */ + template < typename Functor > + bool ForAllPotentiallyVisibleAreas( Functor &func ) + { + int i; + + ++s_nCurrVisTestCounter; + + for ( i=0; im_nVisTestCounter != s_nCurrVisTestCounter ); + area->m_nVisTestCounter = s_nCurrVisTestCounter; + + if ( m_potentiallyVisibleAreas[i].attributes == NOT_VISIBLE ) + continue; + + if ( func( area ) == false ) + return false; + } + + // for each inherited area + if ( !m_inheritVisibilityFrom.area ) + return true; + + CAreaBindInfoArray &inherited = m_inheritVisibilityFrom.area->m_potentiallyVisibleAreas; + + for ( i=0; im_nVisTestCounter == s_nCurrVisTestCounter ) + continue; + + // Theoretically, this shouldn't matter. But, just in case! + inherited[i].area->m_nVisTestCounter = s_nCurrVisTestCounter; + + if ( inherited[i].attributes == NOT_VISIBLE ) + continue; + + if ( func( inherited[i].area ) == false ) + return false; + } + + return true; + } + + //------------------------------------------------------------------------------------- + /** + * Apply the functor to all navigation areas that are + * completely visible from somewhere in this area. + */ + template < typename Functor > + bool ForAllCompletelyVisibleAreas( Functor &func ) + { + int i; + + ++s_nCurrVisTestCounter; + + for ( i=0; im_nVisTestCounter != s_nCurrVisTestCounter ); + area->m_nVisTestCounter = s_nCurrVisTestCounter; + + if ( ( m_potentiallyVisibleAreas[i].attributes & COMPLETELY_VISIBLE ) == 0 ) + continue; + + if ( func( area ) == false ) + return false; + } + + if ( !m_inheritVisibilityFrom.area ) + return true; + + // for each inherited area + CAreaBindInfoArray &inherited = m_inheritVisibilityFrom.area->m_potentiallyVisibleAreas; + + for ( i=0; im_nVisTestCounter == s_nCurrVisTestCounter ) + continue; + + // Theoretically, this shouldn't matter. But, just in case! + inherited[i].area->m_nVisTestCounter = s_nCurrVisTestCounter; + + if ( ( inherited[i].attributes & COMPLETELY_VISIBLE ) == 0 ) + continue; + + if ( func( inherited[i].area ) == false ) + return false; + } + + return true; + } + + +protected: + void UnblockArea( void ); + private: friend class CNavMesh; friend class CNavLadder; - void Initialize( void ); ///< to keep constructors consistent - static bool m_isReset; ///< if true, don't bother cleaning up in destructor since everything is going away + static bool m_isReset; // if true, don't bother cleaning up in destructor since everything is going away /* - extent.lo + m_nwCorner nw ne +-----------+ | +-->x | @@ -330,89 +642,106 @@ class CNavArea | | +-----------+ sw se - extent.hi + m_seCorner */ - static unsigned int m_nextID; ///< used to allocate unique IDs - unsigned int m_id; ///< unique area ID - Extent m_extent; ///< extents of area in world coords (NOTE: lo.z is not necessarily the minimum Z, but corresponds to Z at point (lo.x, lo.y), etc - Vector m_center; ///< centroid of area - unsigned short m_attributeFlags; ///< set of attribute bit flags (see NavAttributeType) - Place m_place; ///< place descriptor - bool m_isBlocked; ///< if true, some part of the world is preventing movement through this nav area - bool m_isUnderwater; ///< true if the center of the area is underwater + static unsigned int m_nextID; // used to allocate unique IDs + + char pad1[4]; + + unsigned int m_id; // unique area ID + unsigned int m_debugid; + + Place m_place; // place descriptor + + CountdownTimer m_blockedTimer; // Throttle checks on our blocked state while blocked + void UpdateBlockedFromNavBlockers( void ); // checks if nav blockers are still blocking the area + + bool m_isUnderwater; // true if the center of the area is underwater - /// height of the implicit corners - float m_neZ; - float m_swZ; + bool m_isBattlefront; + + float m_avoidanceObstacleHeight; // if nonzero, a prop is obstructing movement through this nav area + CountdownTimer m_avoidanceObstacleTimer; // Throttle checks on our obstructed state while obstructed //- for hunting ------------------------------------------------------------------------------------- - float m_clearedTimestamp[ MAX_NAV_TEAMS ]; ///< time this area was last "cleared" of enemies + float m_clearedTimestamp[ MAX_NAV_TEAMS ]; // time this area was last "cleared" of enemies //- "danger" ---------------------------------------------------------------------------------------- - float m_danger[ MAX_NAV_TEAMS ]; ///< danger of this area, allowing bots to avoid areas where they died in the past - zero is no danger - float m_dangerTimestamp[ MAX_NAV_TEAMS ]; ///< time when danger value was set - used for decaying + float m_danger[ MAX_NAV_TEAMS ]; // danger of this area, allowing bots to avoid areas where they died in the past - zero is no danger + float m_dangerTimestamp[ MAX_NAV_TEAMS ]; // time when danger value was set - used for decaying void DecayDanger( void ); //- hiding spots ------------------------------------------------------------------------------------ - HidingSpotList m_hidingSpotList; - bool IsHidingSpotCollision( const Vector &pos ) const; ///< returns true if an existing hiding spot is too close to given position + HidingSpotVector m_hidingSpots; + bool IsHidingSpotCollision( const Vector &pos ) const; // returns true if an existing hiding spot is too close to given position //- encounter spots --------------------------------------------------------------------------------- - SpotEncounterList m_spotEncounterList; ///< list of possible ways to move thru this area, and the spots to look at as we do - void AddSpotEncounters( const CNavArea *from, NavDirType fromDir, const CNavArea *to, NavDirType toDir ); ///< add spot encounter data when moving from area to area - - //- approach areas ---------------------------------------------------------------------------------- - enum { MAX_APPROACH_AREAS = 16 }; - ApproachInfo m_approach[ MAX_APPROACH_AREAS ]; - unsigned char m_approachCount; + SpotEncounterVector m_spotEncounters; // list of possible ways to move thru this area, and the spots to look at as we do + void AddSpotEncounters( const CNavArea *from, NavDirType fromDir, const CNavArea *to, NavDirType toDir ); // add spot encounter data when moving from area to area - float m_earliestOccupyTime[ MAX_NAV_TEAMS ]; ///< min time to reach this spot from spawn - void ComputeEarliestOccupyTimes( void ); - bool m_isBattlefront; + float m_earliestOccupyTime[ MAX_NAV_TEAMS ]; // min time to reach this spot from spawn - unsigned char m_playerCount[ MAX_NAV_TEAMS ]; ///< the number of players currently in this area +#ifdef DEBUG_AREA_PLAYERCOUNTS + CUtlVector< int > m_playerEntIndices[ MAX_NAV_TEAMS ]; +#endif - void Strip( void ); ///< remove "analyzed" data from nav area + //- lighting ---------------------------------------------------------------------------------------- + float m_lightIntensity[ NUM_CORNERS ]; // 0..1 light intensity at corners //- A* pathfinding algorithm ------------------------------------------------------------------------ static unsigned int m_masterMarker; - unsigned int m_marker; ///< used to flag the area as visited - CNavArea *m_parent; ///< the area just prior to this on in the search path - NavTraverseType m_parentHow; ///< how we get from parent to us - float m_totalCost; ///< the distance so far plus an estimate of the distance left - float m_costSoFar; ///< distance travelled so far static CNavArea *m_openList; - CNavArea *m_nextOpen, *m_prevOpen; ///< only valid if m_openMarker == m_masterMarker - unsigned int m_openMarker; ///< if this equals the current marker value, we are on the open list + static CNavArea *m_openListTail; //- connections to adjacent areas ------------------------------------------------------------------- - NavConnectList m_connect[ NUM_DIRECTIONS ]; ///< a list of adjacent areas for each direction - NavLadderConnectList m_ladder[ CNavLadder::NUM_LADDER_DIRECTIONS ]; ///< list of ladders leading up and down from this area + NavConnectVector m_incomingConnect[ NUM_DIRECTIONS ]; // a list of adjacent areas for each direction that connect TO us, but we have no connection back to them //--------------------------------------------------------------------------------------------------- - CNavNode *m_node[ NUM_CORNERS ]; ///< nav nodes at each corner of the area + CNavNode *m_node[ NUM_CORNERS ]; // nav nodes at each corner of the area - void ResetNodes( void ); ///< nodes are going away as part of an incremental nav generation - bool HasNodes( void ) const; + void ResetNodes( void ); // nodes are going away as part of an incremental nav generation + void Strip( void ); // remove "analyzed" data from nav area + + void FinishMerge( CNavArea *adjArea ); // recompute internal data once nodes have been adjusted during merge + void MergeAdjacentConnections( CNavArea *adjArea ); // for merging with "adjArea" - pick up all of "adjArea"s connections + void AssignNodes( CNavArea *area ); // assign internal nodes to the given area + + void FinishSplitEdit( CNavArea *newArea, NavDirType ignoreEdge ); // given the portion of the original area, update its internal data + + void CalcDebugID(); + + CNavArea *m_prevHash, *m_nextHash; // for hash table in CNavMesh - void FinishMerge( CNavArea *adjArea ); ///< recompute internal data once nodes have been adjusted during merge - void MergeAdjacentConnections( CNavArea *adjArea ); ///< for merging with "adjArea" - pick up all of "adjArea"s connections - void AssignNodes( CNavArea *area ); ///< assign internal nodes to the given area + void ConnectElevators( void ); // find elevator connections between areas - void FinishSplitEdit( CNavArea *newArea, NavDirType ignoreEdge ); ///< given the portion of the original area, update its internal data + int m_damagingTickCount; // this area is damaging through this tick count - CUtlLinkedList m_overlapList; ///< list of areas that overlap this area - void OnDestroyNotify( CNavArea *dead ); ///< invoked when given area is going away - void OnDestroyNotify( CNavLadder *dead ); ///< invoked when given ladder is going away + //- visibility -------------------------------------------------------------------------------------- + void ComputeVisibilityToMesh( void ); // compute visibility to surrounding mesh + void ResetPotentiallyVisibleAreas(); + static void ComputeVisToArea( CNavArea *&pOtherArea ); - CNavArea *m_prevHash, *m_nextHash; ///< for hash table in CNavMesh +#ifndef _X360 + typedef CUtlVectorConservative CAreaBindInfoArray; // shaves 8 bytes off structure caused by need to support editing +#else + typedef CUtlVector CAreaBindInfoArray; // Need to use this on 360 to support external allocation pattern +#endif + + AreaBindInfo m_inheritVisibilityFrom; // if non-NULL, m_potentiallyVisibleAreas becomes a list of additions and deletions (NOT_VISIBLE) to the list of this area + CAreaBindInfoArray m_potentiallyVisibleAreas; // list of areas potentially visible from inside this area (after PostLoad(), use area portion of union) + bool m_isInheritedFrom; // latch used during visibility inheritance computation + + const CAreaBindInfoArray &ComputeVisibilityDelta( const CNavArea *other ) const; // return a list of the delta between our visibility list and the given adjacent area + + uint32 m_nVisTestCounter; + static uint32 s_nCurrVisTestCounter; }; -typedef CUtlLinkedList< CNavArea *, int > NavAreaList; -extern NavAreaList TheNavAreaList; +typedef CUtlVector< CNavArea * > NavAreaVector; +extern NavAreaVector *TheNavAreas; //-------------------------------------------------------------------------------------------------------------- @@ -421,17 +750,23 @@ extern NavAreaList TheNavAreaList; // Inlines // +//-------------------------------------------------------------------------------------------------------------- +inline float CNavArea::GetDangerDecayRate( void ) const +{ + // one kill == 1.0, which we will forget about in two minutes + return 1.0f / 120.0f; +} + //-------------------------------------------------------------------------------------------------------------- inline bool CNavArea::IsDegenerate( void ) const { - return (m_extent.lo.x >= m_extent.hi.x || m_extent.lo.y >= m_extent.hi.y); + return (m_nwCorner.x >= m_seCorner.x || m_nwCorner.y >= m_seCorner.y); } //-------------------------------------------------------------------------------------------------------------- inline CNavArea *CNavArea::GetAdjacentArea( NavDirType dir, int i ) const { - int iter; - for( iter = m_connect[dir].Head(); iter != m_connect[dir].InvalidIndex(); iter=m_connect[dir].Next( iter ) ) + for( int iter = 0; iter < m_connect[dir].Count(); ++iter ) { if (i == 0) return m_connect[dir][iter].area; @@ -450,22 +785,31 @@ inline bool CNavArea::IsOpen( void ) const //-------------------------------------------------------------------------------------------------------------- inline bool CNavArea::IsOpenListEmpty( void ) { + Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL ); return (m_openList) ? false : true; } //-------------------------------------------------------------------------------------------------------------- inline CNavArea *CNavArea::PopOpenList( void ) { - if (m_openList) + Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL ); + + if ( m_openList ) { CNavArea *area = m_openList; // disconnect from list area->RemoveFromOpenList(); + area->m_prevOpen = NULL; + area->m_nextOpen = NULL; + + Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL ); return area; } + Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL ); + return NULL; } @@ -509,6 +853,34 @@ inline float CNavArea::GetEarliestOccupyTime( int teamID ) const } +//-------------------------------------------------------------------------------------------------------------- +inline bool CNavArea::IsDamaging( void ) const +{ + return ( gpGlobals->tickcount <= m_damagingTickCount ); +} + + +//-------------------------------------------------------------------------------------------------------------- +inline void CNavArea::MarkAsDamaging( float duration ) +{ + m_damagingTickCount = gpGlobals->tickcount + TIME_TO_TICKS( duration ); +} + + +//-------------------------------------------------------------------------------------------------------------- +inline bool CNavArea::HasAvoidanceObstacle( float maxObstructionHeight ) const +{ + return m_avoidanceObstacleHeight > maxObstructionHeight; +} + + +//-------------------------------------------------------------------------------------------------------------- +inline float CNavArea::GetAvoidanceObstacleHeight( void ) const +{ + return m_avoidanceObstacleHeight; +} + + //-------------------------------------------------------------------------------------------------------------- inline bool CNavArea::IsVisible( const Vector &eye, Vector *visSpot ) const { @@ -518,7 +890,7 @@ inline bool CNavArea::IsVisible( const Vector &eye, Vector *visSpot ) const const float offset = 0.75f * HumanHeight; // check center first - UTIL_TraceLine( eye, GetCenter() + Vector( 0, 0, offset ), MASK_BLOCKLOS_AND_NPCS, &traceFilter, &result ); + UTIL_TraceLine( eye, GetCenter() + Vector( 0, 0, offset ), MASK_BLOCKLOS_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE, &traceFilter, &result ); if (result.fraction == 1.0f) { // we can see this area @@ -532,7 +904,7 @@ inline bool CNavArea::IsVisible( const Vector &eye, Vector *visSpot ) const for( int c=0; cz is not used. +*/ +inline float CNavArea::GetZ( const Vector * RESTRICT pos ) const RESTRICT +{ + return GetZ( pos->x, pos->y ); +} + +inline float CNavArea::GetZ( const Vector & pos ) const RESTRICT +{ + return GetZ( pos.x, pos.y ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** +* Return the coordinates of the area's corner. +*/ +inline Vector CNavArea::GetCorner( NavCornerType corner ) const +{ + // @TODO: Confirm compiler does the "right thing" in release builds, or change this function to to take a pointer [2/4/2009 tom] + Vector pos; + + switch( corner ) + { + default: + Assert( false && "GetCorner: Invalid type" ); + case NORTH_WEST: + return m_nwCorner; + + case NORTH_EAST: + pos.x = m_seCorner.x; + pos.y = m_nwCorner.y; + pos.z = m_neZ; + return pos; + + case SOUTH_WEST: + pos.x = m_nwCorner.x; + pos.y = m_seCorner.y; + pos.z = m_swZ; + return pos; + + case SOUTH_EAST: + return m_seCorner; + } +} + #endif // _NAV_AREA_H_ diff --git a/game/server/nav_colors.h b/game/server/nav_colors.h index 213b7defe..ad93c1d8a 100644 --- a/game/server/nav_colors.h +++ b/game/server/nav_colors.h @@ -27,7 +27,8 @@ enum NavEditColor NavMarkedColor, NavNormalColor, NavCornerColor, - NavBlockedColor, + NavBlockedByDoorColor, + NavBlockedByFuncNavBlockerColor, // Hiding spot colors NavIdealSniperColor, @@ -39,12 +40,16 @@ enum NavEditColor // Connector colors NavConnectedTwoWaysColor, NavConnectedOneWayColor, + NavConnectedContiguous, + NavConnectedNonContiguous, // Editing colors NavCursorColor, NavSplitLineColor, NavCreationColor, + NavInvalidCreationColor, NavGridColor, + NavDragSelectionColor, // Nav attribute colors NavAttributeCrouchColor, @@ -55,14 +60,17 @@ enum NavEditColor NavAttributeRunColor, NavAttributeWalkColor, NavAttributeAvoidColor, + NavAttributeStairColor, }; //-------------------------------------------------------------------------------------------------------------- void NavDrawLine( const Vector& from, const Vector& to, NavEditColor navColor ); void NavDrawTriangle( const Vector& point1, const Vector& point2, const Vector& point3, NavEditColor navColor ); +void NavDrawFilledTriangle( const Vector& point1, const Vector& point2, const Vector& point3, NavEditColor navColor, bool dark ); void NavDrawHorizontalArrow( const Vector& from, const Vector& to, float width, NavEditColor navColor ); void NavDrawDashedLine( const Vector& from, const Vector& to, NavEditColor navColor ); +void NavDrawVolume( const Vector &vMin, const Vector &vMax, int zMidline, NavEditColor navColor ); //-------------------------------------------------------------------------------------------------------------- diff --git a/game/server/nav_entities.h b/game/server/nav_entities.h new file mode 100644 index 000000000..940ae9566 --- /dev/null +++ b/game/server/nav_entities.h @@ -0,0 +1,71 @@ +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +// nav_entities.h +// Navigation entities +// Author: Michael S. Booth (mike@turtlerockstudios.com), January 2003 + +#ifndef NAV_ENTITIES_H +#define NAV_ENTITIES_H + +//----------------------------------------------------------------------------------------------------- +/** + * An entity that can block/unblock nav areas. This is meant for semi-transient areas that block + * pathfinding but can be ignored for longer-term queries like computing L4D flow distances and + * escape routes. + */ +class CFuncNavBlocker : public CBaseEntity +{ + DECLARE_DATADESC(); + DECLARE_CLASS( CFuncNavBlocker, CBaseEntity ); + +public: + void Spawn(); + virtual void UpdateOnRemove( void ); + + void InputBlockNav( inputdata_t &inputdata ); + void InputUnblockNav( inputdata_t &inputdata ); + + inline bool IsBlockingNav( int teamNumber ) const + { + if ( teamNumber == TEAM_ANY ) + { + bool isBlocked = false; + for ( int i=0; i gm_NavBlockers; + + void BlockNav( void ); + void UnblockNav( void ); + bool m_isBlockingNav[MAX_NAV_TEAMS]; + int m_blockedTeamNumber; + bool m_bDisabled; + Vector m_CachedMins, m_CachedMaxs; + +}; + +#endif // NAV_ENTITIES_H diff --git a/game/server/nav_ladder.h b/game/server/nav_ladder.h index ae087d0dd..5104bff36 100644 --- a/game/server/nav_ladder.h +++ b/game/server/nav_ladder.h @@ -11,25 +11,9 @@ #ifndef _NAV_LADDER_H_ #define _NAV_LADDER_H_ -class CNavArea; - -//-------------------------------------------------------------------------------------------------------------- -/** - * Placeholder ladder class that holds the mins and maxs for a ladder, since its brushes - * are merged into the world during the compile. - */ -class CInfoLadder : public CBaseEntity -{ -public: - DECLARE_CLASS( CInfoLadder, CBaseEntity ); - DECLARE_DATADESC(); - - bool KeyValue( const char *szKeyName, const char *szValue ); - - Vector mins; - Vector maxs; -}; +#include "nav.h" +class CNavArea; //-------------------------------------------------------------------------------------------------------------- /** @@ -53,8 +37,10 @@ class CNavLadder ~CNavLadder(); - void Save( FileHandle_t file, unsigned int version ) const; - void Load( FileHandle_t file, unsigned int version ); + void OnRoundRestart( void ); ///< invoked when a game round restarts + + void Save( CUtlBuffer &fileBuffer, unsigned int version ) const; + void Load( CUtlBuffer &fileBuffer, unsigned int version ); unsigned int GetID( void ) const { return m_id; } ///< return this ladder's unique ID static void CompressIDs( void ); /// NavLadderList; +typedef CUtlVector< CNavLadder * > NavLadderVector; + + +//-------------------------------------------------------------------------------------------------------------- +inline bool CNavLadder::IsUsableByTeam( int teamNumber ) const +{ + if ( m_ladderEntity.Get() == NULL ) + return true; + + int ladderTeamNumber = m_ladderEntity->GetTeamNumber(); + return ( teamNumber == ladderTeamNumber || ladderTeamNumber == TEAM_UNASSIGNED ); +} + + +//-------------------------------------------------------------------------------------------------------------- +inline CBaseEntity *CNavLadder::GetLadderEntity( void ) const +{ + return m_ladderEntity.Get(); +} //-------------------------------------------------------------------------------------------------------------- diff --git a/game/server/nav_mesh.h b/game/server/nav_mesh.h index df1a7d3aa..4d2645763 100644 --- a/game/server/nav_mesh.h +++ b/game/server/nav_mesh.h @@ -19,7 +19,9 @@ #ifndef _NAV_MESH_H_ #define _NAV_MESH_H_ +#include "utlbuffer.h" #include "filesystem.h" +#include "GameEventListener.h" #include "nav.h" #include "nav_area.h" @@ -28,69 +30,282 @@ class CNavArea; class CBaseEntity; +class CBreakable; extern ConVar nav_edit; extern ConVar nav_quicksave; extern ConVar nav_show_approach_points; extern ConVar nav_show_danger; +//-------------------------------------------------------------------------------------------------------- +class NavAreaCollector +{ + bool m_checkForDuplicates; +public: + NavAreaCollector( bool checkForDuplicates = false ) + { + m_checkForDuplicates = checkForDuplicates; + } + + bool operator() ( CNavArea *area ) + { + if ( m_checkForDuplicates && m_area.HasElement( area ) ) + return true; + + m_area.AddToTail( area ); + return true; + } + CUtlVector< CNavArea * > m_area; +}; + + +//-------------------------------------------------------------------------------------------------------- +class EditDestroyNotification +{ + CNavArea *m_deadArea; + +public: + EditDestroyNotification( CNavArea *deadArea ) + { + m_deadArea = deadArea; + } + + bool operator()( CBaseCombatCharacter *actor ) + { + actor->OnNavAreaRemoved( m_deadArea ); + return true; + } +}; + + +//-------------------------------------------------------------------------------------------------------- +class NavAttributeClearer +{ +public: + NavAttributeClearer( NavAttributeType attribute ) + { + m_attribute = attribute; + } + + bool operator() ( CNavArea *area ) + { + area->SetAttributes( area->GetAttributes() & (~m_attribute) ); + + return true; + } + + NavAttributeType m_attribute; +}; + + +//-------------------------------------------------------------------------------------------------------- +class NavAttributeSetter +{ +public: + NavAttributeSetter( NavAttributeType attribute ) + { + m_attribute = attribute; + } + + bool operator() ( CNavArea *area ) + { + area->SetAttributes( area->GetAttributes() | m_attribute ); + + return true; + } + + NavAttributeType m_attribute; +}; + + +//-------------------------------------------------------------------------------------------------------- +class NavAttributeToggler +{ +public: + NavAttributeToggler( NavAttributeType attribute ) + { + m_attribute = attribute; + } + + bool operator() ( CNavArea *area ); + + NavAttributeType m_attribute; +}; + + +//-------------------------------------------------------------------------------------------------------- +struct NavAttributeLookup +{ + const char *name; + NavAttributeType attribute; +}; + +extern NavAttributeLookup TheNavAttributeTable[]; + +//-------------------------------------------------------------------------------------------------------- +class SelectOverlappingAreas +{ +public: + bool operator()( CNavArea *area ); +}; + +//-------------------------------------------------------------------------------------------------------- +abstract_class INavAvoidanceObstacle +{ +public: + virtual bool IsPotentiallyAbleToObstructNavAreas( void ) const = 0; // could we at some future time obstruct nav? + virtual float GetNavObstructionHeight( void ) const = 0; // height at which to obstruct nav areas + virtual bool CanObstructNavAreas( void ) const = 0; // can we obstruct nav right this instant? + virtual CBaseEntity *GetObstructingEntity( void ) = 0; + virtual void OnNavMeshLoaded( void ) = 0; +}; + +//-------------------------------------------------------------------------------------------------------- +enum GetNavAreaFlags_t +{ + GETNAVAREA_CHECK_LOS = 0x1, + GETNAVAREA_ALLOW_BLOCKED_AREAS = 0x2, + GETNAVAREA_CHECK_GROUND = 0x4, +}; + + +//-------------------------------------------------------------------------------------------------------- +// for nav mesh visibilty computation +struct NavVisPair_t +{ + void SetPair( CNavArea *pArea1, CNavArea *pArea2 ) + { + int iArea1 = (int)( pArea1 > pArea2 ); + int iArea2 = ( iArea1 + 1 ) % 2; + pAreas[iArea1] = pArea1; + pAreas[iArea2] = pArea2; + } + + CNavArea *pAreas[2]; +}; + + +// for nav mesh visibilty computation +class CVisPairHashFuncs +{ +public: + CVisPairHashFuncs( int ) {} + + bool operator()( const NavVisPair_t &lhs, const NavVisPair_t &rhs ) const + { + return ( lhs.pAreas[0] == rhs.pAreas[0] && lhs.pAreas[1] == rhs.pAreas[1] ); + } + + unsigned int operator()( const NavVisPair_t &item ) const + { + COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 4 ); + int key[2] = { (int)item.pAreas[0] + item.pAreas[1]->GetID(), (int)item.pAreas[1] + item.pAreas[0]->GetID() }; + return Hash8( key ); + } +}; + + //-------------------------------------------------------------------------------------------------------- /** * The CNavMesh is the global interface to the Navigation Mesh. * @todo Make this an abstract base class interface, and derive mod-specific implementations. */ -class CNavMesh +class CNavMesh : public CGameEventListener { public: CNavMesh( void ); virtual ~CNavMesh(); - - virtual HidingSpot *CreateHidingSpot( void ) const; ///< Hiding Spot factory - - virtual void Reset( void ); ///< destroy Navigation Mesh data and revert to initial state - virtual void Update( void ); ///< invoked on each game frame - - virtual NavErrorType Load( void ); ///< load navigation data from a file - bool IsLoaded( void ) const { return m_isLoaded; } ///< return true if a Navigation Mesh has been loaded - virtual bool Save( void ) const; ///< store Navigation Mesh to a file - bool IsFromCurrentMap( void ) const { return m_isFromCurrentMap; } ///< return true if the Navigation Mesh was last edited with the current map version - - unsigned int GetNavAreaCount( void ) const { return m_areaCount; } ///< return total number of nav areas - - CNavArea *GetNavArea( const Vector &pos, float beneathLimt = 120.0f ) const; ///< given a position, return the nav area that IsOverlapping and is *immediately* beneath it + + virtual void PreLoadAreas( int nAreas ) {} + virtual CNavArea *CreateArea( void ) const; // CNavArea factory + virtual void DestroyArea( CNavArea * ) const; + virtual HidingSpot *CreateHidingSpot( void ) const; // Hiding Spot factory + + virtual void Reset( void ); // destroy Navigation Mesh data and revert to initial state + virtual void Update( void ); // invoked on each game frame + + virtual void FireGameEvent( IGameEvent *event ); // incoming event processing + + virtual NavErrorType Load( void ); // load navigation data from a file + virtual NavErrorType PostLoad( unsigned int version ); // (EXTEND) invoked after all areas have been loaded - for pointer binding, etc + bool IsLoaded( void ) const { return m_isLoaded; } // return true if a Navigation Mesh has been loaded + bool IsAnalyzed( void ) const { return m_isAnalyzed; } // return true if a Navigation Mesh has been analyzed + + const CUtlVector< Place > *GetPlacesFromNavFile( bool *hasUnnamedPlaces ); // Reads the used place names from the nav file (can be used to selectively precache before the nav is loaded) + + virtual bool Save( void ) const; // store Navigation Mesh to a file + bool IsOutOfDate( void ) const { return m_isOutOfDate; } // return true if the Navigation Mesh is older than the current map version + + virtual unsigned int GetSubVersionNumber( void ) const; // returns sub-version number of data format used by derived classes + virtual void SaveCustomData( CUtlBuffer &fileBuffer ) const { } // store custom mesh data for derived classes + virtual void LoadCustomData( CUtlBuffer &fileBuffer, unsigned int subVersion ) { } // load custom mesh data for derived classes + virtual void SaveCustomDataPreArea( CUtlBuffer &fileBuffer ) const { } // store custom mesh data for derived classes that needs to be loaded before areas are read in + virtual void LoadCustomDataPreArea( CUtlBuffer &fileBuffer, unsigned int subVersion ) { } // load custom mesh data for derived classes that needs to be loaded before areas are read in + + // events + virtual void OnServerActivate( void ); // (EXTEND) invoked when server loads a new map + virtual void OnRoundRestart( void ); // invoked when a game round restarts + virtual void OnRoundRestartPreEntity( void ); // invoked when a game round restarts, but before entities are deleted and recreated + virtual void OnBreakableCreated( CBaseEntity *breakable ) { } // invoked when a breakable is created + virtual void OnBreakableBroken( CBaseEntity *broken ) { } // invoked when a breakable is broken + virtual void OnAreaBlocked( CNavArea *area ); // invoked when the area becomes blocked + virtual void OnAreaUnblocked( CNavArea *area ); // invoked when the area becomes un-blocked + virtual void OnAvoidanceObstacleEnteredArea( CNavArea *area ); // invoked when the area becomes obstructed + virtual void OnAvoidanceObstacleLeftArea( CNavArea *area ); // invoked when the area becomes un-obstructed + + virtual void OnEditCreateNotify( CNavArea *newArea ); // invoked when given area has just been added to the mesh in edit mode + virtual void OnEditDestroyNotify( CNavArea *deadArea ); // invoked when given area has just been deleted from the mesh in edit mode + virtual void OnEditDestroyNotify( CNavLadder *deadLadder ); // invoked when given ladder has just been deleted from the mesh in edit mode + virtual void OnNodeAdded( CNavNode *node ) {}; + + // Obstructions + void RegisterAvoidanceObstacle( INavAvoidanceObstacle *obstruction ); + void UnregisterAvoidanceObstacle( INavAvoidanceObstacle *obstruction ); + const CUtlVector< INavAvoidanceObstacle * > &GetObstructions( void ) const { return m_avoidanceObstacles; } + + unsigned int GetNavAreaCount( void ) const { return m_areaCount; } // return total number of nav areas + + // See GetNavAreaFlags_t for flags + CNavArea *GetNavArea( const Vector &pos, float beneathLimt = 120.0f ) const; // given a position, return the nav area that IsOverlapping and is *immediately* beneath it + CNavArea *GetNavArea( CBaseEntity *pEntity, int nGetNavAreaFlags, float flBeneathLimit = 120.0f ) const; CNavArea *GetNavAreaByID( unsigned int id ) const; - CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false ) const; + CNavArea *GetNearestNavArea( const Vector &pos, bool anyZ = false, float maxDist = 10000.0f, bool checkLOS = false, bool checkGround = true, bool unknown = false ) const; + CNavArea *GetNearestNavArea( CBaseEntity *pEntity, int nGetNavAreaFlags = GETNAVAREA_CHECK_GROUND, float maxDist = 10000.0f ) const; - Place GetPlace( const Vector &pos ) const; ///< return Place at given coordinate - const char *PlaceToName( Place place ) const; ///< given a place, return its name - Place NameToPlace( const char *name ) const; ///< given a place name, return a place ID or zero if no place is defined - Place PartialNameToPlace( const char *name ) const; ///< given the first part of a place name, return a place ID or zero if no place is defined, or the partial match is ambiguous - void PrintAllPlaces( void ) const; ///< output a list of names to the console - int PlaceNameAutocomplete( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] ); ///< Given a partial place name, fill in possible place names for ConCommand autocomplete + Place GetPlace( const Vector &pos ) const; // return Place at given coordinate + const char *PlaceToName( Place place ) const; // given a place, return its name + Place NameToPlace( const char *name ) const; // given a place name, return a place ID or zero if no place is defined + Place PartialNameToPlace( const char *name ) const; // given the first part of a place name, return a place ID or zero if no place is defined, or the partial match is ambiguous + void PrintAllPlaces( void ) const; // output a list of names to the console + int PlaceNameAutocomplete( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] ); // Given a partial place name, fill in possible place names for ConCommand autocomplete - bool GetGroundHeight( const Vector &pos, float *height, Vector *normal = NULL ) const; ///< get the Z coordinate of the topmost ground level below the given point - bool GetSimpleGroundHeight( const Vector &pos, float *height, Vector *normal = NULL ) const;///< get the Z coordinate of the ground level directly below the given point + bool GetGroundHeight( const Vector &pos, float *height, Vector *normal = NULL ) const; // get the Z coordinate of the topmost ground level below the given point + bool GetSimpleGroundHeight( const Vector &pos, float *height, Vector *normal = NULL ) const;// get the Z coordinate of the ground level directly below the given point /// increase "danger" weights in the given nav area and nearby ones - void IncreaseDangerNearby( int teamID, float amount, CNavArea *area, const Vector &pos, float maxRadius ); - void DrawDanger( void ) const; ///< draw the current danger levels + void IncreaseDangerNearby( int teamID, float amount, CNavArea *area, const Vector &pos, float maxRadius, float dangerLimit = -1.0f ); + void DrawDanger( void ) const; // draw the current danger levels - void ClearPlayerCounts( void ); ///< zero player counts in all areas - void DrawPlayerCounts( void ) const; ///< draw the current player counts for each area + void DrawPlayerCounts( void ) const; // draw the current player counts for each area //------------------------------------------------------------------------------------- // Auto-generation // - void BeginGeneration( bool incremental = false ); ///< initiate the generation process - void BeginAnalysis( void ); ///< re-analyze an existing Mesh. Determine Hiding Spots, Encounter Spots, etc. - - bool IsGenerating( void ) const { return m_generationMode != GENERATE_NONE; } ///< return true while a Navigation Mesh is being generated - const char *GetPlayerSpawnName( void ) const; ///< return name of player spawn entity - void SetPlayerSpawnName( const char *name ); ///< define the name of player spawn entities - void AddWalkableSeed( const Vector &pos, const Vector &normal ); ///< add given walkable position to list of seed positions for map sampling - void ClearWalkableSeeds( void ) { m_walkableSeedList.RemoveAll(); } ///< erase all walkable seed positions - + #define INCREMENTAL_GENERATION true + void BeginGeneration( bool incremental = false ); // initiate the generation process + void BeginAnalysis( bool quitWhenFinished = false ); // re-analyze an existing Mesh. Determine Hiding Spots, Encounter Spots, etc. + + bool IsGenerating( void ) const { return m_generationMode != GENERATE_NONE; } // return true while a Navigation Mesh is being generated + const char *GetPlayerSpawnName( void ) const; // return name of player spawn entity + void SetPlayerSpawnName( const char *name ); // define the name of player spawn entities + void AddWalkableSeed( const Vector &pos, const Vector &normal ); // add given walkable position to list of seed positions for map sampling + virtual void AddWalkableSeeds( void ); // adds walkable positions for any/all positions a mod specifies + void ClearWalkableSeeds( void ) { m_walkableSeeds.RemoveAll(); } // erase all walkable seed positions + void MarkStairAreas( void ); + + unsigned int GetGenerationTraceMask( void ) const; // return the mask used by traces when generating the mesh + //------------------------------------------------------------------------------------- // Edit mode // @@ -98,60 +313,148 @@ class CNavMesh void SetNavPlace( unsigned int place ) { m_navPlace = place; } // Edit callbacks from ConCommands - void CommandNavDelete( void ); ///< delete current area - void CommandNavDeleteMarked( void ); ///< delete current marked area - void CommandNavSplit( void ); ///< split current area - void CommandNavMerge( void ); ///< merge adjacent areas - void CommandNavMark( const CCommand &args ); ///< mark an area for further operations - void CommandNavUnmark( void ); ///< removes the mark - void CommandNavBeginArea( void ); ///< begin creating a new nav area - void CommandNavEndArea( void ); ///< end creation of the new nav area - void CommandNavConnect( void ); ///< connect marked area to selected area - void CommandNavDisconnect( void ); ///< disconnect marked area from selected area - void CommandNavSplice( void ); ///< create new area in between marked and selected areas - void CommandNavCrouch( void ); ///< toggle crouch attribute on current area - void CommandNavTogglePlaceMode( void ); ///< switch between normal and place editing - void CommandNavSetPlaceMode( void ); ///< switch between normal and place editing - void CommandNavPlaceFloodFill( void ); ///< floodfill areas out from current area - void CommandNavPlacePick( void ); ///< "pick up" the place at the current area - void CommandNavTogglePlacePainting( void ); ///< switch between "painting" places onto areas - void CommandNavMarkUnnamed( void ); ///< mark an unnamed area for further operations - void CommandNavCornerSelect( void ); ///< select a corner on the current area - void CommandNavCornerRaise( void ); ///< raise a corner on the current area - void CommandNavCornerLower( void ); ///< lower a corner on the current area - void CommandNavCornerPlaceOnGround( const CCommand &args ); ///< position a corner on the current area at ground height - void CommandNavWarpToMark( void ); ///< warp a spectating local player to the selected mark - void CommandNavLadderFlip( void ); ///< Flips the direction a ladder faces - void CommandNavToggleAttribute( NavAttributeType attribute ); ///< toggle an attribute on current area - void CommandNavMakeSniperSpots( void ); ///< cuts up the marked area into individual areas suitable for sniper spots - void CommandNavBuildLadder( void ); ///< builds a nav ladder on the climbable surface under the cursor - void CommandNavRemoveUnusedJumpAreas( void ); ///< removes jump areas with at most 1 connection to a ladder or non-jump area - - // IN-PROGRESS COMMANDS FOR MANIPULATING EXISTING AREAS - void CommandNavPickArea( void ); - void CommandNavResizeHorizontal( void ); - void CommandNavResizeVertical( void ); - void CommandNavResizeEnd( void ); - - bool IsPlaceMode( void ) const { return m_navEditMode == NAV_EDIT_PLACE; } - - void GetEditVectors( Vector *pos, Vector *forward ); ///< Gets the eye position and view direction of the editing player - - CNavArea *GetMarkedArea( void ) const { return m_markedArea; } ///< return area marked by user in edit mode - CNavLadder *GetMarkedLadder( void ) const { return m_markedLadder; } ///< return ladder marked by user in edit mode - - CNavArea *GetSelectedArea( void ) const { return m_selectedArea; } ///< return area selected by user in edit mode - CNavLadder *GetSelectedLadder( void ) const { return m_selectedLadder; } ///< return ladder selected by user in edit mode - - void CreateLadder( const Vector& mins, const Vector& maxs, const Vector2D *ladderDir ); - - float SnapToGrid( float x, bool forceGrid = false ) const; ///< snap given coordinate to generation grid boundary - Vector SnapToGrid( const Vector& in, bool snapX = true, bool snapY = true, bool forceGrid = false ) const; ///< snap given vector's X & Y coordinates to generation grid boundary - - const Vector &GetEditCursorPosition( void ) const { return m_editCursorPos; } ///< return position of edit cursor - void StripNavigationAreas( void ); - const char *GetFilename( void ) const; ///< return the filename for this map's "nav" file - + void CommandNavDelete( void ); // delete current area + void CommandNavDeleteMarked( void ); // delete current marked area + + virtual void CommandNavFloodSelect( const CCommand &args ); // select current area and all connected areas, recursively + void CommandNavToggleSelectedSet( void ); // toggles all areas into/out of the selected set + void CommandNavStoreSelectedSet( void ); // stores the current selected set for later + void CommandNavRecallSelectedSet( void ); // restores an older selected set + void CommandNavAddToSelectedSet( void ); // add current area to selected set + void CommandNavAddToSelectedSetByID( const CCommand &args ); // add specified area id to selected set + void CommandNavRemoveFromSelectedSet( void ); // remove current area from selected set + void CommandNavToggleInSelectedSet( void ); // add/remove current area from selected set + void CommandNavClearSelectedSet( void ); // clear the selected set to empty + void CommandNavBeginSelecting( void ); // start continuously selecting areas into the selected set + void CommandNavEndSelecting( void ); // stop continuously selecting areas into the selected set + void CommandNavBeginDragSelecting( void ); // start dragging a selection area + void CommandNavEndDragSelecting( void ); // stop dragging a selection area + void CommandNavBeginDragDeselecting( void ); // start dragging a deselection area + void CommandNavEndDragDeselecting( void ); // stop dragging a deselection area + void CommandNavRaiseDragVolumeMax( void ); // raise the top of the drag volume + void CommandNavLowerDragVolumeMax( void ); // lower the top of the drag volume + void CommandNavRaiseDragVolumeMin( void ); // raise the bottom of the drag volume + void CommandNavLowerDragVolumeMin( void ); // lower the bottom of the drag volume + void CommandNavToggleSelecting( bool playSound = true ); // start/stop continuously selecting areas into the selected set + void CommandNavBeginDeselecting( void ); // start continuously de-selecting areas from the selected set + void CommandNavEndDeselecting( void ); // stop continuously de-selecting areas from the selected set + void CommandNavToggleDeselecting( bool playSound = true ); // start/stop continuously de-selecting areas from the selected set + void CommandNavSelectInvalidAreas( void ); // adds invalid areas to the selected set + void CommandNavSelectBlockedAreas( void ); // adds blocked areas to the selected set + void CommandNavSelectObstructedAreas( void ); // adds obstructed areas to the selected set + void CommandNavSelectDamagingAreas( void ); // adds damaging areas to the selected set + void CommandNavSelectHalfSpace( const CCommand &args ); // selects all areas that intersect the half-space + void CommandNavSelectStairs( void ); // adds stairs areas to the selected set + + void CommandNavSplit( void ); // split current area + void CommandNavMerge( void ); // merge adjacent areas + void CommandNavMark( const CCommand &args ); // mark an area for further operations + void CommandNavUnmark( void ); // removes the mark + + void CommandNavBeginArea( void ); // begin creating a new nav area + void CommandNavEndArea( void ); // end creation of the new nav area + + void CommandNavBeginShiftXY( void ); // begin shifting selected set in the XY plane + void CommandNavEndShiftXY( void ); // end shifting selected set in the XY plane + + void CommandNavConnect( void ); // connect marked area to selected area + void CommandNavDisconnect( void ); // disconnect marked area from selected area + void CommandNavSplice( void ); // create new area in between marked and selected areas + void CommandNavCrouch( void ); // toggle crouch attribute on current area + void CommandNavTogglePlaceMode( void ); // switch between normal and place editing + void CommandNavSetPlaceMode( void ); // switch between normal and place editing + void CommandNavPlaceFloodFill( void ); // floodfill areas out from current area + void CommandNavPlaceSet( void ); // sets the Place for the selected set + void CommandNavPlacePick( void ); // "pick up" the place at the current area + void CommandNavTogglePlacePainting( void ); // switch between "painting" places onto areas + void CommandNavMarkUnnamed( void ); // mark an unnamed area for further operations + void CommandNavCornerSelect( void ); // select a corner on the current area + void CommandNavCornerRaise( const CCommand &args ); // raise a corner on the current area + void CommandNavCornerLower( const CCommand &args ); // lower a corner on the current area + void CommandNavCornerPlaceOnGround( const CCommand &args ); // position a corner on the current area at ground height + void CommandNavWarpToMark( void ); // warp a spectating local player to the selected mark + void CommandNavLadderFlip( void ); // Flips the direction a ladder faces + void CommandNavToggleAttribute( NavAttributeType attribute ); // toggle an attribute on current area + void CommandNavMakeSniperSpots( void ); // cuts up the marked area into individual areas suitable for sniper spots + void CommandNavBuildLadder( void ); // builds a nav ladder on the climbable surface under the cursor + void CommandNavRemoveJumpAreas( void ); // removes jump areas, replacing them with connections + void CommandNavSubdivide( const CCommand &args ); // subdivide each nav area in X and Y to create 4 new areas - limit min size + void CommandNavSaveSelected( const CCommand &args ); // Save selected set to disk + void CommandNavMergeMesh( const CCommand &args ); // Merge a saved selected set into the current mesh + void CommandNavMarkWalkable( void ); + + void AddToDragSelectionSet( CNavArea *pArea ); + void RemoveFromDragSelectionSet( CNavArea *pArea ); + void ClearDragSelectionSet( void ); + + CNavArea *GetMarkedArea( void ) const; // return area marked by user in edit mode + CNavLadder *GetMarkedLadder( void ) const { return m_markedLadder; } // return ladder marked by user in edit mode + + CNavArea *GetSelectedArea( void ) const { return m_selectedArea; } // return area user is pointing at in edit mode + CNavLadder *GetSelectedLadder( void ) const { return m_selectedLadder; } // return ladder user is pointing at in edit mode + void SetMarkedLadder( CNavLadder *ladder ); // mark ladder for further edit operations + void SetMarkedArea( CNavArea *area ); // mark area for further edit operations + + bool IsContinuouslySelecting( void ) const + { + return m_isContinuouslySelecting; + } + + bool IsContinuouslyDeselecting( void ) const + { + return m_isContinuouslyDeselecting; + } + + void CreateLadder( const Vector &mins, const Vector &maxs, float maxHeightAboveTopArea ); + void CreateLadder( const Vector &top, const Vector &bottom, float width, const Vector2D &ladderDir, float maxHeightAboveTopArea ); + + float SnapToGrid( float x, bool forceGrid = false ) const; // snap given coordinate to generation grid boundary + Vector SnapToGrid( const Vector& in, bool snapX = true, bool snapY = true, bool forceGrid = false ) const; // snap given vector's X & Y coordinates to generation grid boundary + + const Vector &GetEditCursorPosition( void ) const { return m_editCursorPos; } // return position of edit cursor + virtual void StripNavigationAreas( void ); + const char *GetFilename( void ) const; // return the filename for this map's "nav" file + + /// @todo Remove old select code and make all commands use this selected set + void AddToSelectedSet( CNavArea *area ); // add area to the currently selected set + void RemoveFromSelectedSet( CNavArea *area ); // remove area from the currently selected set + void ClearSelectedSet( void ); // clear the currently selected set to empty + bool IsSelectedSetEmpty( void ) const; // return true if the selected set is empty + bool IsInSelectedSet( const CNavArea *area ) const; // return true if the given area is in the selected set + int GetSelecteSetSize( void ) const; + const NavAreaVector &GetSelectedSet( void ) const; // return the selected set + + /** + * Apply the functor to all navigation areas in the Selected Set, + * or the current selected area. + * If functor returns false, stop processing and return false. + */ + template < typename Functor > + bool ForAllSelectedAreas( Functor &func ) + { + if (IsSelectedSetEmpty()) + { + CNavArea *area = GetSelectedArea(); + + if (area) + { + if (func( area ) == false) + return false; + } + } + else + { + FOR_EACH_VEC( m_selectedSet, it ) + { + CNavArea *area = m_selectedSet[ it ]; + + if (func( area ) == false) + return false; + } + } + + return true; + } //------------------------------------------------------------------------------------- /** @@ -161,9 +464,9 @@ class CNavMesh template < typename Functor > bool ForAllAreas( Functor &func ) { - FOR_EACH_LL( TheNavAreaList, it ) + FOR_EACH_VEC( *TheNavAreas, it ) { - CNavArea *area = TheNavAreaList[ it ]; + CNavArea *area = (*TheNavAreas)[ it ]; if (func( area ) == false) return false; @@ -172,166 +475,486 @@ class CNavMesh return true; } - NavLadderList& GetLadders( void ) { return m_ladderList; } ///< Returns the list of ladders + // const version of the above + template < typename Functor > + bool ForAllAreas( Functor &func ) const + { + FOR_EACH_VEC( *TheNavAreas, it ) + { + const CNavArea *area = (*TheNavAreas)[ it ]; + + if (func( area ) == false) + return false; + } + + return true; + } + + //------------------------------------------------------------------------------------- + /** + * Apply the functor to all navigation areas that overlap the given extent. + * If functor returns false, stop processing and return false. + */ + template < typename Functor > + bool ForAllAreasOverlappingExtent( Functor &func, const Extent &extent ) + { + VPROF_BUDGET( "CNavMesh::ForAllAreasOverlappingExtent", "NextBot" ); + + if ( !m_grid.Count() ) + { +#if _DEBUG + Warning("Query before nav mesh is loaded! %d\n", TheNavAreas->Count() ); +#endif + return true; + } + static unsigned int searchMarker = RandomInt(0, 1024*1024 ); + if ( ++searchMarker == 0 ) + { + ++searchMarker; + } + + Extent areaExtent; + + // get list in cell that contains position + int startX = WorldToGridX( extent.lo.x ); + int endX = WorldToGridX( extent.hi.x ); + int startY = WorldToGridY( extent.lo.y ); + int endY = WorldToGridY( extent.hi.y ); + + for( int x = startX; x <= endX; ++x ) + { + for( int y = startY; y <= endY; ++y ) + { + int iGrid = x + y*m_gridSizeX; + if ( iGrid >= m_grid.Count() ) + { + ExecuteNTimes( 10, Warning( "** Walked off of the CNavMesh::m_grid in ForAllAreasOverlappingExtent()\n" ) ); + return true; + } + + NavAreaVector *areaVector = &m_grid[ iGrid ]; + + // find closest area in this cell + FOR_EACH_VEC( (*areaVector), it ) + { + CNavArea *area = (*areaVector)[ it ]; + + // skip if we've already visited this area + if ( area->m_nearNavSearchMarker == searchMarker ) + continue; + + // mark as visited + area->m_nearNavSearchMarker = searchMarker; + area->GetExtent( &areaExtent ); + + if ( extent.IsOverlapping( areaExtent ) ) + { + if ( func( area ) == false ) + return false; + } + } + } + } + return true; + } + + template < typename Functor > + bool ForAllAreasInRadius( Functor &func, const Vector &pos, float radius ) + { + // use a unique marker for this method, so it can be used within a SearchSurroundingArea() call + static unsigned int searchMarker = RandomInt(0, 1024*1024 ); + + ++searchMarker; + + if ( searchMarker == 0 ) + { + ++searchMarker; + } + + + // get list in cell that contains position + int originX = WorldToGridX( pos.x ); + int originY = WorldToGridY( pos.y ); + int shiftLimit = ceil( radius / m_gridCellSize ); + float radiusSq = radius * radius; + if ( radius == 0.0f ) + { + shiftLimit = MAX( m_gridSizeX, m_gridSizeY ); // range 0 means all areas + } + + for( int x = originX - shiftLimit; x <= originX + shiftLimit; ++x ) + { + if ( x < 0 || x >= m_gridSizeX ) + continue; + + for( int y = originY - shiftLimit; y <= originY + shiftLimit; ++y ) + { + if ( y < 0 || y >= m_gridSizeY ) + continue; + + NavAreaVector *areaVector = &m_grid[ x + y*m_gridSizeX ]; + + // find closest area in this cell + FOR_EACH_VEC( (*areaVector), it ) + { + CNavArea *area = (*areaVector)[ it ]; + + // skip if we've already visited this area + if ( area->m_nearNavSearchMarker == searchMarker ) + continue; + + // mark as visited + area->m_nearNavSearchMarker = searchMarker; + + float distSq = ( area->GetCenter() - pos ).LengthSqr(); + + if ( ( distSq <= radiusSq ) || ( radiusSq == 0 ) ) + { + if ( func( area ) == false ) + return false; + } + } + } + } + return true; + } + + //------------------------------------------------------------------------------------- + /** + * Apply the functor to all navigation ladders. + * If functor returns false, stop processing and return false. + */ + template < typename Functor > + bool ForAllLadders( Functor &func ) + { + for ( int i=0; i + bool ForAllLadders( Functor &func ) const + { + for ( int i=0; i void StitchAreaIntoMesh( CNavArea *area, NavDirType dir, Functor &func ); + + //------------------------------------------------------------------------------------- + /** + * Use the functor to test if an area is needing stitching into the existing nav mesh. + * The functor is different from how we normally use functors - it does no processing, + * and it's return value is true if the area is in the new set to be stiched, and false + * if it's a pre-existing area. + */ + template < typename Functor > + bool StitchMesh( Functor &func ) + { + FOR_EACH_VEC( *TheNavAreas, it ) + { + CNavArea *area = (*TheNavAreas)[ it ]; + + if ( func( area ) ) + { + StitchAreaIntoMesh( area, NORTH, func ); + StitchAreaIntoMesh( area, SOUTH, func ); + StitchAreaIntoMesh( area, EAST, func ); + StitchAreaIntoMesh( area, WEST, func ); + } + } + + return true; + } + + NavLadderVector& GetLadders( void ) { return m_ladders; } // Returns the list of ladders CNavLadder *GetLadderByID( unsigned int id ) const; CUtlVector< CNavArea * >& GetTransientAreas( void ) { return m_transientAreas; } + enum EditModeType + { + NORMAL, // normal mesh editing + PLACE_PAINTING, // in place painting mode + CREATING_AREA, // creating a new nav area + CREATING_LADDER, // creating a nav ladder + DRAG_SELECTING, // drag selecting a set of areas + SHIFTING_XY, // shifting selected set in XY plane + SHIFTING_Z, // shifting selected set in Z plane + }; + EditModeType GetEditMode( void ) const; // return the current edit mode + void SetEditMode( EditModeType mode ); // change the edit mode + bool IsEditMode( EditModeType mode ) const; // return true if current mode matches given mode + + bool FindNavAreaOrLadderAlongRay( const Vector &start, const Vector &end, CNavArea **area, CNavLadder **ladder, CNavArea *ignore = NULL ); + + void PostProcessCliffAreas(); + void SimplifySelectedAreas( void ); // Simplifies the selected set by reducing to 1x1 areas and re-merging them up with loosened tolerances + +protected: + virtual void PostCustomAnalysis( void ) { } // invoked when custom analysis step is complete + bool FindActiveNavArea( void ); // Finds the area or ladder the local player is currently pointing at. Returns true if a surface was hit by the traceline. + virtual void RemoveNavArea( CNavArea *area ); // remove an area from the grid + bool FindGroundForNode( Vector *pos, Vector *normal ); + void GenerateNodes( const Extent &bounds ); + void RemoveNodes( void ); + private: friend class CNavArea; friend class CNavNode; + friend class CNavUIBasePanel; + + char pad1[4]; - NavAreaList *m_grid; - float m_gridCellSize; ///< the width/height of a grid cell for spatially partitioning nav areas for fast access + mutable CUtlVector m_grid; + float m_gridCellSize; // the width/height of a grid cell for spatially partitioning nav areas for fast access int m_gridSizeX; int m_gridSizeY; float m_minX; float m_minY; - unsigned int m_areaCount; ///< total number of nav areas + unsigned int m_areaCount; // total number of nav areas - bool m_isLoaded; ///< true if a Navigation Mesh has been loaded - bool m_isFromCurrentMap; ///< true if the Navigation Mesh was last saved with the current map + bool m_isLoaded; // true if a Navigation Mesh has been loaded + bool m_isOutOfDate; // true if the Navigation Mesh is older than the actual BSP + bool m_isAnalyzed; // true if the Navigation Mesh needs analysis enum { HASH_TABLE_SIZE = 256 }; - CNavArea *m_hashTable[ HASH_TABLE_SIZE ]; ///< hash table to optimize lookup by ID - int ComputeHashKey( unsigned int id ) const; ///< returns a hash key for the given nav area ID + CNavArea *m_hashTable[ HASH_TABLE_SIZE ]; // hash table to optimize lookup by ID + int ComputeHashKey( unsigned int id ) const; // returns a hash key for the given nav area ID - int WorldToGridX( float wx ) const; ///< given X component, return grid index - int WorldToGridY( float wy ) const; ///< given Y component, return grid index - void AllocateGrid( float minX, float maxX, float minY, float maxY ); ///< clear and reset the grid to the given extents + int WorldToGridX( float wx ) const; // given X component, return grid index + int WorldToGridY( float wy ) const; // given Y component, return grid index + void AllocateGrid( float minX, float maxX, float minY, float maxY ); // clear and reset the grid to the given extents void GridToWorld( int gridX, int gridY, Vector *pos ) const; - void AddNavArea( CNavArea *area ); ///< add an area to the grid - void RemoveNavArea( CNavArea *area ); ///< remove an area from the grid + void AddNavArea( CNavArea *area ); // add an area to the grid - void DestroyNavigationMesh( bool incremental = false ); ///< free all resources of the mesh and reset it to empty state + void DestroyNavigationMesh( bool incremental = false ); // free all resources of the mesh and reset it to empty state void DestroyHidingSpots( void ); - void ComputeBattlefrontAreas( void ); ///< determine areas where rushing teams will first meet + void ComputeBattlefrontAreas( void ); // determine areas where rushing teams will first meet //---------------------------------------------------------------------------------- // Place directory // - char **m_placeName; ///< master directory of place names (ie: "places") - unsigned int m_placeCount; ///< number of "places" defined in placeName[] - void LoadPlaceDatabase( void ); ///< load the place names from a file + char **m_placeName; // master directory of place names (ie: "places") + unsigned int m_placeCount; // number of "places" defined in placeName[] + void LoadPlaceDatabase( void ); // load the place names from a file //---------------------------------------------------------------------------------- // Edit mode // - unsigned int m_navPlace; ///< current navigation place for editing - void OnEditModeStart( void ); ///< called when edit mode has just been enabled - void DrawEditMode( void ); ///< draw navigation areas - void OnEditModeEnd( void ); ///< called when edit mode has just been disabled - bool m_isEditing; ///< true if in edit mode - Vector m_editCursorPos; ///< current position of the cursor - CNavArea *m_markedArea; ///< currently marked area for edit operations - CNavArea *m_selectedArea; ///< area that is selected this frame - CNavArea *m_lastSelectedArea; ///< area that was selected last frame - NavCornerType m_markedCorner; ///< currently marked corner for edit operations - Vector m_anchor; ///< first corner of an area being created - bool m_isPlacePainting; ///< if true, we set an area's place by pointing at it - bool m_splitAlongX; ///< direction the selected nav area would be split - float m_splitEdge; ///< location of the possible split - - enum NavEditMode { - NAV_EDIT_NORMAL = 0, - NAV_EDIT_CREATE, ///< manually creating a new nav area - NAV_EDIT_RESIZE_HORIZONTAL, - NAV_EDIT_RESIZE_VERTICAL, - NAV_EDIT_PLACE ///< place-editing mode - }; - NavEditMode m_navEditMode; - - bool m_climbableSurface; ///< if true, the cursor is pointing at a climable surface - Vector m_surfaceNormal; ///< Normal of the surface the cursor is pointing at - Vector m_ladderAnchor; ///< first corner of a ladder being created - Vector m_ladderNormal; ///< Normal of the surface of the ladder being created - bool m_isCreatingLadder; ///< if true, we are manually creating a ladder - CNavLadder *m_selectedLadder; ///< ladder that is selected this frame - CNavLadder *m_lastSelectedLadder; ///< ladder that was selected last frame - CNavLadder *m_markedLadder; ///< currently marked ladder for edit operations + EditModeType m_editMode; // the current edit mode + bool m_isEditing; // true if in edit mode + + unsigned int m_navPlace; // current navigation place for editing + void OnEditModeStart( void ); // called when edit mode has just been enabled + void DrawEditMode( void ); // draw navigation areas + void OnEditModeEnd( void ); // called when edit mode has just been disabled + void UpdateDragSelectionSet( void ); // update which areas are overlapping the drag selected bounds + Vector m_editCursorPos; // current position of the cursor + CNavArea *m_markedArea; // currently marked area for edit operations + CNavArea *m_selectedArea; // area that is selected this frame + CNavArea *m_lastSelectedArea; // area that was selected last frame + NavCornerType m_markedCorner; // currently marked corner for edit operations + Vector m_anchor; // first corner of an area being created + bool m_isPlacePainting; // if true, we set an area's place by pointing at it + bool m_splitAlongX; // direction the selected nav area would be split + float m_splitEdge; // location of the possible split + + bool m_climbableSurface; // if true, the cursor is pointing at a climable surface + Vector m_surfaceNormal; // Normal of the surface the cursor is pointing at + Vector m_ladderAnchor; // first corner of a ladder being created + Vector m_ladderNormal; // Normal of the surface of the ladder being created + CNavLadder *m_selectedLadder; // ladder that is selected this frame + CNavLadder *m_lastSelectedLadder; // ladder that was selected last frame + CNavLadder *m_markedLadder; // currently marked ladder for edit operations + + bool FindLadderCorners( Vector *c1, Vector *c2, Vector *c3 ); // computes the other corners of a ladder given m_ladderAnchor, m_editCursorPos, and m_ladderNormal + + void GetEditVectors( Vector *pos, Vector *forward ); // Gets the eye position and view direction of the editing player + + CountdownTimer m_showAreaInfoTimer; // Timer that controls how long area info is displayed + + NavAreaVector m_selectedSet; // all currently selected areas + NavAreaVector m_dragSelectionSet; // all areas in the current drag selection + bool m_isContinuouslySelecting; // if true, we are continuously adding to the selected set + bool m_isContinuouslyDeselecting; // if true, we are continuously removing from the selected set - bool GetActiveNavArea( void ); ///< Finds the area or ladder the local player is currently pointing at. Returns true if a surface was hit by the traceline. + bool m_bIsDragDeselecting; + int m_nDragSelectionVolumeZMax; + int m_nDragSelectionVolumeZMin; - void SetEditMode( bool isPlaceMode ); ///< sets/clears place mode - void SetPlacePaintingMode( bool painting ); ///< Sets place-painting, if we're in place mode - void SetMarkedLadder( CNavLadder *ladder ); ///< mark ladder for further edit operations - void SetMarkedArea( CNavArea *area ); ///< mark area for further edit operations + void DoToggleAttribute( CNavArea *area, NavAttributeType attribute ); // toggle an attribute on given area - CountdownTimer m_showAreaInfoTimer; ///< Timer that controls how long area info is displayed //---------------------------------------------------------------------------------- // Auto-generation // - bool UpdateGeneration( float maxTime = 0.25f ); ///< process the auto-generation for 'maxTime' seconds. return false if generation is complete. + bool UpdateGeneration( float maxTime = 0.25f ); // process the auto-generation for 'maxTime' seconds. return false if generation is complete. + + virtual void BeginCustomAnalysis( bool bIncremental ) {} + virtual void EndCustomAnalysis() {} - CNavNode *m_currentNode; ///< the current node we are sampling from + CNavNode *m_currentNode; // the current node we are sampling from NavDirType m_generationDir; - CNavNode *AddNode( const Vector &destPos, const Vector &destNormal, NavDirType dir, CNavNode *source ); ///< add a nav node and connect it, update current node + CNavNode *AddNode( const Vector &destPos, const Vector &destNormal, NavDirType dir, CNavNode *source, bool isOnDisplacement, float obstacleHeight, float flObstacleStartDist, float flObstacleEndDist ); // add a nav node and connect it, update current node - NavLadderList m_ladderList; ///< list of ladder navigation representations + NavLadderVector m_ladders; // list of ladder navigation representations void BuildLadders( void ); void DestroyLadders( void ); - bool SampleStep( void ); ///< sample the walkable areas of the map - void CreateNavAreasFromNodes( void ); ///< cover all of the sampled nodes with nav areas + bool SampleStep( void ); // sample the walkable areas of the map + void CreateNavAreasFromNodes( void ); // cover all of the sampled nodes with nav areas - bool TestArea( CNavNode *node, int width, int height ); ///< check if an area of size (width, height) can fit, starting from node as upper left corner - int BuildArea( CNavNode *node, int width, int height ); ///< create a CNavArea of size (width, height) starting fom node at upper left corner + bool TestArea( CNavNode *node, int width, int height ); // check if an area of size (width, height) can fit, starting from node as upper left corner + int BuildArea( CNavNode *node, int width, int height ); // create a CNavArea of size (width, height) starting fom node at upper left corner + bool CheckObstacles( CNavNode *node, int width, int height, int x, int y ); - void RemoveUnusedJumpAreas( void ); + void MarkPlayerClipAreas( void ); void MarkJumpAreas( void ); + void StichAndRemoveJumpAreas( void ); + void RemoveJumpAreas( void ); void SquareUpAreas( void ); void MergeGeneratedAreas( void ); void ConnectGeneratedAreas( void ); + void FixUpGeneratedAreas( void ); + void FixCornerOnCornerAreas( void ); + void FixConnections( void ); + void SplitAreasUnderOverhangs( void ); + void ValidateNavAreaConnections( void ); + void StitchGeneratedAreas( void ); // Stitches incrementally-generated areas into the existing mesh + void StitchAreaSet( CUtlVector< CNavArea * > *areas ); // Stitches an arbitrary set of areas into the existing mesh + void HandleObstacleTopAreas( void ); // Handles fixing/generating areas on top of slim obstacles such as fences and railings + void RaiseAreasWithInternalObstacles(); + void CreateObstacleTopAreas(); + bool CreateObstacleTopAreaIfNecessary( CNavArea *area, CNavArea *areaOther, NavDirType dir, bool bMultiNode ); + void RemoveOverlappingObstacleTopAreas(); + enum GenerationStateType { SAMPLE_WALKABLE_SPACE, CREATE_AREAS_FROM_SAMPLES, FIND_HIDING_SPOTS, - FIND_APPROACH_AREAS, FIND_ENCOUNTER_SPOTS, FIND_SNIPER_SPOTS, FIND_EARLIEST_OCCUPY_TIMES, + FIND_LIGHT_INTENSITY, + COMPUTE_MESH_VISIBILITY, + CUSTOM, // mod-specific generation step SAVE_NAV_MESH, NUM_GENERATION_STATES } - m_generationState; ///< the state of the generation process + m_generationState; // the state of the generation process enum GenerationModeType { GENERATE_NONE, GENERATE_FULL, GENERATE_INCREMENTAL, + GENERATE_SIMPLIFY, GENERATE_ANALYSIS_ONLY, } - m_generationMode; ///< true while a Navigation Mesh is being generated - int m_generationIndex; ///< used for iterating nav areas during generation process - int m_sampleTick; ///< counter for displaying pseudo-progress while sampling walkable space + m_generationMode; // true while a Navigation Mesh is being generated + int m_generationIndex; // used for iterating nav areas during generation process + int m_sampleTick; // counter for displaying pseudo-progress while sampling walkable space + bool m_bQuitWhenFinished; + float m_generationStartTime; + Extent m_simplifyGenerationExtent; - char *m_spawnName; ///< name of player spawn entity, used to initiate sampling + char *m_spawnName; // name of player spawn entity, used to initiate sampling struct WalkableSeedSpot { Vector pos; Vector normal; }; - CUtlLinkedList< WalkableSeedSpot, int > m_walkableSeedList; ///< list of walkable seed spots for sampling + CUtlVector< WalkableSeedSpot > m_walkableSeeds; // list of walkable seed spots for sampling - CNavNode *GetNextWalkableSeedNode( void ); ///< return the next walkable seed as a node + CNavNode *GetNextWalkableSeedNode( void ); // return the next walkable seed as a node int m_seedIdx; + int m_hostThreadModeRestoreValue; // stores the value of host_threadmode before we changed it void BuildTransientAreaList( void ); CUtlVector< CNavArea * > m_transientAreas; + + void UpdateAvoidanceObstacleAreas( void ); + CUtlVector< CNavArea * > m_avoidanceObstacleAreas; + CUtlVector< INavAvoidanceObstacle * > m_avoidanceObstacles; + + void UpdateBlockedAreas( void ); + CUtlVector< CNavArea * > m_blockedAreas; + + CUtlVector< int > m_storedSelectedSet; // "Stored" selected set, so we can do some editing and then restore the old selected set. Done by ID, so we don't have to worry about split/delete/etc. + + void BeginVisibilityComputations( void ); + void EndVisibilityComputations( void ); }; // the global singleton interface extern CNavMesh *TheNavMesh; +// factory for creating the Navigation Mesh +extern CNavMesh *NavMeshFactory( void ); + +// for debugging the A* algorithm, if nonzero, show debug display and decrement for each pathfind +extern int g_DebugPathfindCounter; + + +//-------------------------------------------------------------------------------------------------------------- +inline bool CNavMesh::IsEditMode( EditModeType mode ) const +{ + return m_editMode == mode; +} + +//-------------------------------------------------------------------------------------------------------------- +inline CNavMesh::EditModeType CNavMesh::GetEditMode( void ) const +{ + return m_editMode; +} + +//-------------------------------------------------------------------------------------------------------------- +inline unsigned int CNavMesh::GetSubVersionNumber( void ) const +{ + return 0; +} +//-------------------------------------------------------------------------------------------------------------- +inline CNavArea *CNavMesh::CreateArea( void ) const +{ + return new CNavArea; +} + +//-------------------------------------------------------------------------------------------------------------- +inline void CNavMesh::DestroyArea( CNavArea *pArea ) const +{ + delete pArea; +} + //-------------------------------------------------------------------------------------------------------------- inline int CNavMesh::ComputeHashKey( unsigned int id ) const { @@ -365,6 +988,13 @@ inline int CNavMesh::WorldToGridY( float wy ) const } +//-------------------------------------------------------------------------------------------------------------- +inline unsigned int CNavMesh::GetGenerationTraceMask( void ) const +{ + return MASK_NPCSOLID_BRUSHONLY; +} + + //-------------------------------------------------------------------------------------------------------------- // // Function prototypes @@ -372,5 +1002,6 @@ inline int CNavMesh::WorldToGridY( float wy ) const extern void ApproachAreaAnalysisPrep( void ); extern void CleanupApproachAreaAnalysisPrep( void ); +extern bool IsHeightDifferenceValid( float test, float other1, float other2, float other3 ); #endif // _NAV_MESH_H_ diff --git a/game/server/nav_node.h b/game/server/nav_node.h index a56ef76f5..744f711b8 100644 --- a/game/server/nav_node.h +++ b/game/server/nav_node.h @@ -16,11 +16,7 @@ // If DEBUG_NAV_NODES is true, nav_show_nodes controls drawing node positions, and // nav_show_node_id allows you to show the IDs of nodes that didn't get used to create areas. -#ifdef _DEBUG #define DEBUG_NAV_NODES 1 -#else -#define DEBUG_NAV_NODES 0 -#endif //-------------------------------------------------------------------------------------------------------------- /** @@ -31,9 +27,11 @@ class CNavNode { public: - CNavNode( const Vector &pos, const Vector &normal, CNavNode *parent = NULL ); + CNavNode( const Vector &pos, const Vector &normal, CNavNode *parent, bool onDisplacement ); + ~CNavNode(); static CNavNode *GetNode( const Vector &pos ); ///< return navigation node at the position, or NULL if none exists + static void CleanupGeneration(); CNavNode *GetConnectedNode( NavDirType dir ) const; ///< get navigation node connected in given direction, or NULL if cant go that way const Vector *GetPosition( void ) const; @@ -46,7 +44,7 @@ class CNavNode void Draw( void ); - void ConnectTo( CNavNode *node, NavDirType dir ); ///< create a connection FROM this node TO the given node, in the given direction + void ConnectTo( CNavNode *node, NavDirType dir, float obstacleHeight, float flObstacleStartDist, float flObstacleEndDist ); ///< create a connection FROM this node TO the given node, in the given direction CNavNode *GetParent( void ) const; void MarkAsVisited( NavDirType dir ); ///< mark the given direction as having been visited @@ -60,24 +58,34 @@ class CNavNode void AssignArea( CNavArea *area ); ///< assign the given area to this node CNavArea *GetArea( void ) const; ///< return associated area - void SetAttributes( unsigned char bits ) { m_attributeFlags = bits; } - unsigned char GetAttributes( void ) const { return m_attributeFlags; } + void SetAttributes( int bits ) { m_attributeFlags = bits; } + int GetAttributes( void ) const { return m_attributeFlags; } + float GetGroundHeightAboveNode( NavCornerType cornerType ) const; ///< return ground height above node in given corner direction (NUM_CORNERS for highest in any direction) + bool IsBlockedInAnyDirection( void) const; ///< return true if the node is blocked in any direction + + bool IsOnDisplacement( void ) const { return m_isOnDisplacement; } private: + CNavNode() {} // constructor used only for hash lookup friend class CNavMesh; + bool TestForCrouchArea( NavCornerType cornerNum, const Vector& mins, const Vector& maxs, float *groundHeightAboveNode ); void CheckCrouch( void ); Vector m_pos; ///< position of this node in the world Vector m_normal; ///< surface normal at this location CNavNode *m_to[ NUM_DIRECTIONS ]; ///< links to north, south, east, and west. NULL if no link + float m_obstacleHeight[ NUM_DIRECTIONS ]; ///< obstacle height (delta from nav node z position) that must be climbed to reach next node in this direction + float m_obstacleStartDist[ NUM_DIRECTIONS ]; ///< distance along this direction to reach the beginning of the obstacle + float m_obstacleEndDist[ NUM_DIRECTIONS ]; ///< distance along this direction to reach the end of the obstacle unsigned int m_id; ///< unique ID of this node - unsigned char m_attributeFlags; ///< set of attribute bit flags (see NavAttributeType) + int m_attributeFlags; ///< set of attribute bit flags (see NavAttributeType) static CNavNode *m_list; ///< the master list of all nodes for this map static unsigned int m_listLength; static unsigned int m_nextID; CNavNode *m_next; ///< next link in master list + CNavNode *m_nextAtXY; ///< next link at a particular position // below are only needed when generating unsigned char m_visited; ///< flags for automatic node generation. If direction bit is clear, that direction hasn't been explored yet. @@ -85,7 +93,10 @@ class CNavNode bool m_isCovered; ///< true when this node is "covered" by a CNavArea CNavArea *m_area; ///< the area this node is contained within + bool m_isBlocked[ NUM_CORNERS ]; bool m_crouch[ NUM_CORNERS ]; + float m_groundHeightAboveNode[ NUM_CORNERS ]; + bool m_isOnDisplacement; }; //-------------------------------------------------------------------------------------------------------------- @@ -131,5 +142,10 @@ inline CNavArea *CNavNode::GetArea( void ) const return m_area; } +inline bool CNavNode::IsBlockedInAnyDirection( void ) const +{ + return m_isBlocked[ SOUTH_EAST ] || m_isBlocked[ SOUTH_WEST ] || m_isBlocked[ NORTH_EAST ] || m_isBlocked[ NORTH_WEST ]; +} + #endif // _NAV_NODE_H_ diff --git a/game/server/nav_pathfind.h b/game/server/nav_pathfind.h index df9a18f25..32e77667c 100644 --- a/game/server/nav_pathfind.h +++ b/game/server/nav_pathfind.h @@ -12,14 +12,23 @@ #ifndef _NAV_PATHFIND_H_ #define _NAV_PATHFIND_H_ +#include "tier0/vprof.h" +#include "mathlib/ssemath.h" +#include "nav_area.h" + +extern int g_DebugPathfindCounter; + + //------------------------------------------------------------------------------------------------------------------- /** * Used when building a path to determine the kind of path to build */ enum RouteType { + DEFAULT_ROUTE, FASTEST_ROUTE, SAFEST_ROUTE, + RETREAT_ROUTE, }; @@ -30,34 +39,42 @@ enum RouteType class ShortestPathCost { public: - float operator() ( CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder ) + float operator() ( CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder, const CFuncElevator *elevator, float length ) { - if (fromArea == NULL) + if ( fromArea == NULL ) { // first area in path, no cost return 0.0f; } else { - // compute distance travelled along path so far + // compute distance traveled along path so far float dist; - if (ladder) + if ( ladder ) + { dist = ladder->m_length; + } + else if ( length > 0.0 ) + { + dist = length; + } else - dist = (area->GetCenter() - fromArea->GetCenter()).Length(); + { + dist = ( area->GetCenter() - fromArea->GetCenter() ).Length(); + } float cost = dist + fromArea->GetCostSoFar(); // if this is a "crouch" area, add penalty - if (area->GetAttributes() & NAV_MESH_CROUCH) + if ( area->GetAttributes() & NAV_MESH_CROUCH ) { const float crouchPenalty = 20.0f; // 10 cost += crouchPenalty * dist; } // if this is a "jump" area, add penalty - if (area->GetAttributes() & NAV_MESH_JUMP) + if ( area->GetAttributes() & NAV_MESH_JUMP ) { const float jumpPenalty = 5.0f; cost += jumpPenalty * dist; @@ -77,15 +94,26 @@ class ShortestPathCost * If 'closestArea' is non-NULL, the closest area to the goal is returned (useful if the path fails). * If 'goalArea' is NULL, will compute a path as close as possible to 'goalPos'. * If 'goalPos' is NULL, will use the center of 'goalArea' as the goal position. + * If 'maxPathLength' is nonzero, path building will stop when this length is reached. * Returns true if a path exists. */ +#define IGNORE_NAV_BLOCKERS true template< typename CostFunctor > -bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, CostFunctor &costFunc, CNavArea **closestArea = NULL ) +bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *startPos, const Vector *goalPos, CostFunctor &costFunc, CNavArea **closestArea = NULL, float maxPathLength = 0.0f, int teamID = TEAM_ANY, bool ignoreNavBlockers = false ) { + VPROF_BUDGET( "NavAreaBuildPath", "NextBotSpiky" ); + + if ( closestArea ) + { + *closestArea = startArea; + } + + bool isDebug = ( g_DebugPathfindCounter-- > 0 ); + if (startArea == NULL) return false; - if (goalArea != NULL && goalArea->IsBlocked()) + if (goalArea != NULL && goalArea->IsBlocked( teamID, ignoreNavBlockers )) goalArea = NULL; if (goalArea == NULL && goalPos == NULL) @@ -110,10 +138,11 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go /// @todo Cost might work as "manhattan distance" startArea->SetTotalCost( (startArea->GetCenter() - actualGoalPos).Length() ); - float initCost = costFunc( startArea, NULL, NULL ); + float initCost = costFunc( startArea, NULL, NULL, NULL, -1.0f ); if (initCost < 0.0f) return false; startArea->SetCostSoFar( initCost ); + startArea->SetPathLengthSoFar( 0.0 ); startArea->AddToOpenList(); @@ -128,8 +157,13 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go // get next area to check CNavArea *area = CNavArea::PopOpenList(); + if ( isDebug ) + { + area->DrawFilled( 0, 255, 0, 128, 30.0f ); + } + // don't consider blocked areas - if ( area->IsBlocked() ) + if ( area->IsBlocked( teamID, ignoreNavBlockers ) ) continue; // check if we have found the goal area or position @@ -144,89 +178,111 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go } // search adjacent areas - bool searchFloor = true; + enum SearchType + { + SEARCH_FLOOR, SEARCH_LADDERS, SEARCH_ELEVATORS + }; + SearchType searchWhere = SEARCH_FLOOR; + int searchIndex = 0; + int dir = NORTH; - const NavConnectList *floorList = area->GetAdjacentList( NORTH ); - int floorIter = floorList->Head(); + const NavConnectVector *floorList = area->GetAdjacentAreas( NORTH ); bool ladderUp = true; - const NavLadderConnectList *ladderList = NULL; - int ladderIter = NavLadderConnectList::InvalidIndex(); + const NavLadderConnectVector *ladderList = NULL; enum { AHEAD = 0, LEFT, RIGHT, BEHIND, NUM_TOP_DIRECTIONS }; int ladderTopDir = AHEAD; - - while(true) + bool bHaveMaxPathLength = ( maxPathLength > 0.0f ); + float length = -1; + + while( true ) { - CNavArea *newArea; + CNavArea *newArea = NULL; NavTraverseType how; const CNavLadder *ladder = NULL; + const CFuncElevator *elevator = NULL; // // Get next adjacent area - either on floor or via ladder // - if (searchFloor) + if ( searchWhere == SEARCH_FLOOR ) { // if exhausted adjacent connections in current direction, begin checking next direction - if (floorIter == floorList->InvalidIndex()) + if ( searchIndex >= floorList->Count() ) { ++dir; - if (dir == NUM_DIRECTIONS) + if ( dir == NUM_DIRECTIONS ) { // checked all directions on floor - check ladders next - searchFloor = false; + searchWhere = SEARCH_LADDERS; - ladderList = area->GetLadderList( CNavLadder::LADDER_UP ); - ladderIter = ladderList->Head(); + ladderList = area->GetLadders( CNavLadder::LADDER_UP ); + searchIndex = 0; ladderTopDir = AHEAD; } else { // start next direction - floorList = area->GetAdjacentList( (NavDirType)dir ); - floorIter = floorList->Head(); + floorList = area->GetAdjacentAreas( (NavDirType)dir ); + searchIndex = 0; } continue; } - newArea = floorList->Element(floorIter).area; + const NavConnect &floorConnect = floorList->Element( searchIndex ); + newArea = floorConnect.area; + length = floorConnect.length; how = (NavTraverseType)dir; - floorIter = floorList->Next( floorIter ); + ++searchIndex; + + if ( IsX360() && searchIndex < floorList->Count() ) + { + PREFETCH360( floorList->Element( searchIndex ).area, 0 ); + } } - else // search ladders + else if ( searchWhere == SEARCH_LADDERS ) { - if (ladderIter == ladderList->InvalidIndex()) + if ( searchIndex >= ladderList->Count() ) { - if (!ladderUp) + if ( !ladderUp ) { - // checked both ladder directions - done - break; + // checked both ladder directions - check elevators next + searchWhere = SEARCH_ELEVATORS; + searchIndex = 0; + ladder = NULL; } else { // check down ladders ladderUp = false; - ladderList = area->GetLadderList( CNavLadder::LADDER_DOWN ); - ladderIter = ladderList->Head(); + ladderList = area->GetLadders( CNavLadder::LADDER_DOWN ); + searchIndex = 0; } continue; } - if (ladderUp) + if ( ladderUp ) { - ladder = ladderList->Element( ladderIter ).ladder; + ladder = ladderList->Element( searchIndex ).ladder; // do not use BEHIND connection, as its very hard to get to when going up a ladder - if (ladderTopDir == AHEAD) + if ( ladderTopDir == AHEAD ) + { newArea = ladder->m_topForwardArea; - else if (ladderTopDir == LEFT) + } + else if ( ladderTopDir == LEFT ) + { newArea = ladder->m_topLeftArea; - else if (ladderTopDir == RIGHT) + } + else if ( ladderTopDir == RIGHT ) + { newArea = ladder->m_topRightArea; + } else { - ladderIter = ladderList->Next( ladderIter ); + ++searchIndex; ladderTopDir = AHEAD; continue; } @@ -236,31 +292,71 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go } else { - newArea = ladderList->Element(ladderIter).ladder->m_bottomArea; + newArea = ladderList->Element( searchIndex ).ladder->m_bottomArea; how = GO_LADDER_DOWN; - ladder = ladderList->Element(ladderIter).ladder; - ladderIter = ladderList->Next( ladderIter ); + ladder = ladderList->Element(searchIndex).ladder; + ++searchIndex; } - if (newArea == NULL) + if ( newArea == NULL ) continue; + + length = -1.0f; + } + else // if ( searchWhere == SEARCH_ELEVATORS ) + { + const NavConnectVector &elevatorAreas = area->GetElevatorAreas(); + + elevator = area->GetElevator(); + + if ( elevator == NULL || searchIndex >= elevatorAreas.Count() ) + { + // done searching connected areas + elevator = NULL; + break; + } + + newArea = elevatorAreas[ searchIndex++ ].area; + if ( newArea->GetCenter().z > area->GetCenter().z ) + { + how = GO_ELEVATOR_UP; + } + else + { + how = GO_ELEVATOR_DOWN; + } + + length = -1.0f; } + // don't backtrack - if (newArea == area) + if ( newArea == area ) continue; // don't consider blocked areas - if ( newArea->IsBlocked() ) + if ( newArea->IsBlocked( teamID, ignoreNavBlockers ) ) continue; - float newCostSoFar = costFunc( newArea, area, ladder ); - + float newCostSoFar = costFunc( newArea, area, ladder, elevator, length ); + // check if cost functor says this area is a dead-end - if (newCostSoFar < 0.0f) + if ( newCostSoFar < 0.0f ) continue; + + // stop if path length limit reached + if ( bHaveMaxPathLength ) + { + // keep track of path length so far + float deltaLength = ( newArea->GetCenter() - area->GetCenter() ).Length(); + float newLengthSoFar = area->GetPathLengthSoFar() + deltaLength; + if ( newLengthSoFar > maxPathLength ) + continue; + + newArea->SetPathLengthSoFar( newLengthSoFar ); + } - if ((newArea->IsOpen() || newArea->IsClosed()) && newArea->GetCostSoFar() <= newCostSoFar) + if ( ( newArea->IsOpen() || newArea->IsClosed() ) && newArea->GetCostSoFar() <= newCostSoFar ) { // this is a worse path - skip it continue; @@ -268,23 +364,25 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go else { // compute estimate of distance left to go - float newCostRemaining = (newArea->GetCenter() - actualGoalPos).Length(); + float distSq = ( newArea->GetCenter() - actualGoalPos ).LengthSqr(); + float newCostRemaining = ( distSq > 0.0 ) ? FastSqrt( distSq ) : 0.0 ; // track closest area to goal in case path fails - if (closestArea && newCostRemaining < closestAreaDist) + if ( closestArea && newCostRemaining < closestAreaDist ) { *closestArea = newArea; closestAreaDist = newCostRemaining; } - newArea->SetParent( area, how ); newArea->SetCostSoFar( newCostSoFar ); newArea->SetTotalCost( newCostSoFar + newCostRemaining ); - if (newArea->IsClosed()) + if ( newArea->IsClosed() ) + { newArea->RemoveFromClosedList(); + } - if (newArea->IsOpen()) + if ( newArea->IsOpen() ) { // area already on open list, update the list order to keep costs sorted newArea->UpdateOnOpenList(); @@ -293,6 +391,8 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go { newArea->AddToOpenList(); } + + newArea->SetParent( area, how ); } } @@ -309,7 +409,7 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go * Compute distance between two areas. Return -1 if can't reach 'endArea' from 'startArea'. */ template< typename CostFunctor > -float NavAreaTravelDistance( CNavArea *startArea, CNavArea *endArea, CostFunctor &costFunc ) +float NavAreaTravelDistance( CNavArea *startArea, CNavArea *endArea, CostFunctor &costFunc, float maxPathLength = 0.0f ) { if (startArea == NULL) return -1.0f; @@ -321,7 +421,7 @@ float NavAreaTravelDistance( CNavArea *startArea, CNavArea *endArea, CostFunctor return 0.0f; // compute path between areas using given cost heuristic - if (NavAreaBuildPath( startArea, endArea, NULL, costFunc ) == false) + if (NavAreaBuildPath( startArea, endArea, NULL, costFunc, NULL, maxPathLength ) == false) return -1.0f; // compute distance along path @@ -335,54 +435,6 @@ float NavAreaTravelDistance( CNavArea *startArea, CNavArea *endArea, CostFunctor } -//-------------------------------------------------------------------------------------------------------------- -/** - * Compute travel distance along shortest path from startPos to goalPos. - * Return -1 if can't reach endPos from goalPos. - */ -template< typename CostFunctor > -float NavAreaTravelDistance( const Vector &startPos, const Vector &goalPos, CostFunctor &costFunc ) -{ - CNavArea *startArea = TheNavMesh->GetNearestNavArea( startPos ); - if (startArea == NULL) - { - return -1.0f; - } - - // compute path between areas using given cost heuristic - CNavArea *goalArea = NULL; - if (NavAreaBuildPath( startArea, NULL, &goalPos, costFunc, &goalArea ) == false) - { - return -1.0f; - } - - // compute distance along path - if (goalArea->GetParent() == NULL) - { - // both points are in the same area - return euclidean distance - return (goalPos - startPos).Length(); - } - else - { - CNavArea *area; - float distance; - - // goalPos is assumed to be inside goalArea (or very close to it) - skip to next area - area = goalArea->GetParent(); - distance = (goalPos - area->GetCenter()).Length(); - - for( ; area->GetParent(); area = area->GetParent() ) - { - distance += (area->GetCenter() - area->GetParent()->GetCenter()).Length(); - } - - // add in distance to startPos - distance += (startPos - area->GetCenter()).Length(); - - return distance; - } -} - //-------------------------------------------------------------------------------------------------------------- /** @@ -434,8 +486,15 @@ inline void AddAreaToOpenList( CNavArea *area, CNavArea *parent, const Vector &s } +/**************************************************************** + * DEPRECATED: Use filter-based SearchSurroundingAreas below + ****************************************************************/ +#define INCLUDE_INCOMING_CONNECTIONS 0x1 +#define INCLUDE_BLOCKED_AREAS 0x2 +#define EXCLUDE_OUTGOING_CONNECTIONS 0x4 +#define EXCLUDE_ELEVATORS 0x8 template < typename Functor > -void SearchSurroundingAreas( CNavArea *startArea, const Vector &startPos, Functor &func, float maxRange = -1.0f ) +void SearchSurroundingAreas( CNavArea *startArea, const Vector &startPos, Functor &func, float maxRange = -1.0f, unsigned int options = 0, int teamID = TEAM_ANY ) { if (startArea == NULL) return; @@ -455,7 +514,7 @@ void SearchSurroundingAreas( CNavArea *startArea, const Vector &startPos, Functo CNavArea *area = CNavArea::PopOpenList(); // don't use blocked areas - if ( area->IsBlocked() ) + if ( area->IsBlocked( teamID ) && !(options & INCLUDE_BLOCKED_AREAS) ) continue; // invoke functor on area @@ -468,19 +527,42 @@ void SearchSurroundingAreas( CNavArea *startArea, const Vector &startPos, Functo for( int i=0; iGetAdjacentArea( (NavDirType)dir, i ); + if ( options & EXCLUDE_OUTGOING_CONNECTIONS ) + { + if ( !adjArea->IsConnected( area, NUM_DIRECTIONS ) ) + { + continue; // skip this outgoing connection + } + } AddAreaToOpenList( adjArea, area, startPos, maxRange ); } } + + // potentially include areas that connect TO this area via a one-way link + if (options & INCLUDE_INCOMING_CONNECTIONS) + { + for( int dir=0; dirGetIncomingConnections( (NavDirType)dir ); + + FOR_EACH_VEC( (*list), it ) + { + NavConnect connect = (*list)[ it ]; + + AddAreaToOpenList( connect.area, area, startPos, maxRange ); + } + } + } // explore adjacent areas connected by ladders // check up ladders - const NavLadderConnectList *ladderList = area->GetLadderList( CNavLadder::LADDER_UP ); + const NavLadderConnectVector *ladderList = area->GetLadders( CNavLadder::LADDER_UP ); if (ladderList) { - FOR_EACH_LL( (*ladderList), it ) + FOR_EACH_VEC( (*ladderList), it ) { const CNavLadder *ladder = (*ladderList)[ it ].ladder; @@ -492,21 +574,147 @@ void SearchSurroundingAreas( CNavArea *startArea, const Vector &startPos, Functo } // check down ladders - ladderList = area->GetLadderList( CNavLadder::LADDER_DOWN ); + ladderList = area->GetLadders( CNavLadder::LADDER_DOWN ); if (ladderList) { - FOR_EACH_LL( (*ladderList), it ) + FOR_EACH_VEC( (*ladderList), it ) { const CNavLadder *ladder = (*ladderList)[ it ].ladder; AddAreaToOpenList( ladder->m_bottomArea, area, startPos, maxRange ); } } + + if ( (options & EXCLUDE_ELEVATORS) == 0 ) + { + const NavConnectVector &elevatorList = area->GetElevatorAreas(); + FOR_EACH_VEC( elevatorList, it ) + { + CNavArea *elevatorArea = elevatorList[ it ].area; + AddAreaToOpenList( elevatorArea, area, startPos, maxRange ); + } + } } } } +//-------------------------------------------------------------------------------------------------------------- +/** + * Derive your own custom search functor from this interface method for use with SearchSurroundingAreas below. + */ +class ISearchSurroundingAreasFunctor +{ +public: + virtual ~ISearchSurroundingAreasFunctor() { } + + /** + * Perform user-defined action on area. + * Return 'false' to end the search (ie: you found what you were looking for) + */ + virtual bool operator() ( CNavArea *area, CNavArea *priorArea, float travelDistanceSoFar ) = 0; + + // return true if 'adjArea' should be included in the ongoing search + virtual bool ShouldSearch( CNavArea *adjArea, CNavArea *currentArea, float travelDistanceSoFar ) + { + return !adjArea->IsBlocked( TEAM_ANY ); + } + + /** + * Collect adjacent areas to continue the search by calling 'IncludeInSearch' on each + */ + virtual void IterateAdjacentAreas( CNavArea *area, CNavArea *priorArea, float travelDistanceSoFar ) + { + // search adjacent outgoing connections + for( int dir=0; dirGetAdjacentCount( (NavDirType)dir ); + for( int i=0; iGetAdjacentArea( (NavDirType)dir, i ); + + if ( ShouldSearch( adjArea, area, travelDistanceSoFar ) ) + { + IncludeInSearch( adjArea, area ); + } + } + } + } + + // Invoked after the search has completed + virtual void PostSearch( void ) { } + + // consider 'area' in upcoming search steps + void IncludeInSearch( CNavArea *area, CNavArea *priorArea ) + { + if ( area == NULL ) + return; + + if ( !area->IsMarked() ) + { + area->Mark(); + area->SetTotalCost( 0.0f ); + area->SetParent( priorArea ); + + // compute approximate travel distance from start area of search + if ( priorArea ) + { + float distAlong = priorArea->GetCostSoFar(); + distAlong += ( area->GetCenter() - priorArea->GetCenter() ).Length(); + area->SetCostSoFar( distAlong ); + } + else + { + area->SetCostSoFar( 0.0f ); + } + + // adding an area to the open list also marks it + area->AddToOpenList(); + } + } +}; + + +/** + * Do a breadth-first search starting from 'startArea' and continuing outward based on + * adjacent areas that pass the given filter + */ +inline void SearchSurroundingAreas( CNavArea *startArea, ISearchSurroundingAreasFunctor &func ) +{ + if ( startArea ) + { + CNavArea::MakeNewMarker(); + CNavArea::ClearSearchLists(); + + startArea->AddToOpenList(); + startArea->SetTotalCost( 0.0f ); + startArea->SetCostSoFar( 0.0f ); + startArea->SetParent( NULL ); + startArea->Mark(); + + CUtlVector< CNavArea * > adjVector; + + while( !CNavArea::IsOpenListEmpty() ) + { + // get next area to check + CNavArea *area = CNavArea::PopOpenList(); + + if ( func( area, area->GetParent(), area->GetCostSoFar() ) ) + { + func.IterateAdjacentAreas( area, area->GetParent(), area->GetCostSoFar() ); + } + else + { + // search aborted + break; + } + } + } + + func.PostSearch(); +} + + //-------------------------------------------------------------------------------------------------------------- /** * Fuctor that returns lowest cost for farthest away areas @@ -563,17 +771,16 @@ CNavArea *FindMinimumCostArea( CNavArea *startArea, CostFunctor &costFunc ) cheapAreaSet[ NUM_CHEAP_AREAS ]; int cheapAreaSetCount = 0; - FOR_EACH_LL( TheNavAreaList, iter ) + FOR_EACH_VEC( TheNavAreas, iter ) { - CNavArea *area = TheNavAreaList[iter]; + CNavArea *area = TheNavAreas[iter]; // skip the small areas - const Extent &extent = area->GetExtent(); - if (extent.hi.x - extent.lo.x < minSize || extent.hi.y - extent.lo.y < minSize) + if ( area->GetSizeX() < minSize || area->GetSizeY() < minSize) continue; // compute cost of this area - float cost = costFunc( area, startArea, NULL ); + float cost = costFunc( area, startArea, NULL, NULL ); if (cheapAreaSetCount < NUM_CHEAP_AREAS) { @@ -604,13 +811,13 @@ CNavArea *FindMinimumCostArea( CNavArea *startArea, CostFunctor &costFunc ) else { // degenerate case - no decent sized areas - pick a random area - int numAreas = TheNavAreaList.Count(); + int numAreas = TheNavAreas.Count(); int which = RandomInt( 0, numAreas-1 ); - FOR_EACH_LL( TheNavAreaList, iter ) + FOR_EACH_VEC( TheNavAreas, iter ) { if (which-- == 0) - return TheNavAreaList[iter]; + return TheNavAreas[iter]; } } diff --git a/game/server/util.cpp b/game/server/util.cpp index 1a27f5822..eaa275820 100644 --- a/game/server/util.cpp +++ b/game/server/util.cpp @@ -36,17 +36,17 @@ #include "datacache/imdlcache.h" #include "util.h" -#ifdef PORTAL -#include "PortalSimulation.h" -//#include "Portal_PhysicsEnvironmentMgr.h" -#endif + // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" -extern short g_sModelIndexSmoke; // (in combatweapon.cpp) holds the index for the smoke cloud -extern short g_sModelIndexBloodDrop; // (in combatweapon.cpp) holds the sprite index for the initial blood -extern short g_sModelIndexBloodSpray; // (in combatweapon.cpp) holds the sprite index for splattered blood +extern int g_sModelIndexSmoke; // (in combatweapon.cpp) holds the index for the smoke cloud +extern int g_sModelIndexBloodDrop; // (in combatweapon.cpp) holds the sprite index for the initial blood +extern int g_sModelIndexBloodSpray; // (in combatweapon.cpp) holds the sprite index for splattered blood + +// this is true if the engine should be sent log output. Once per frame it is rechecked to see if logging has been enabled. +bool g_bIsLogging = true; #ifdef DEBUG void DBG_AssertFunction( bool fExpr, const char *szExpr, const char *szFile, int szLine, const char *szMessage ) @@ -141,7 +141,7 @@ IEntityFactory *CEntityFactoryDictionary::FindFactory( const char *pClassName ) //----------------------------------------------------------------------------- void CEntityFactoryDictionary::InstallFactory( IEntityFactory *pFactory, const char *pClassName ) { - Assert( FindFactory( pClassName ) == NULL ); + AssertMsg1( FindFactory( pClassName ) == NULL, "Double installation of factory for %s", pClassName ); m_Factories.Insert( pClassName, pFactory ); } @@ -198,46 +198,6 @@ void CEntityFactoryDictionary::ReportEntitySizes() } -//----------------------------------------------------------------------------- -// class CFlaggedEntitiesEnum -//----------------------------------------------------------------------------- - -CFlaggedEntitiesEnum::CFlaggedEntitiesEnum( CBaseEntity **pList, int listMax, int flagMask ) -{ - m_pList = pList; - m_listMax = listMax; - m_flagMask = flagMask; - m_count = 0; -} - -bool CFlaggedEntitiesEnum::AddToList( CBaseEntity *pEntity ) -{ - if ( m_count >= m_listMax ) - { - AssertMsgOnce( 0, "reached enumerated list limit. Increase limit, decrease radius, or make it so entity flags will work for you" ); - return false; - } - m_pList[m_count] = pEntity; - m_count++; - return true; -} - -IterationRetval_t CFlaggedEntitiesEnum::EnumElement( IHandleEntity *pHandleEntity ) -{ - CBaseEntity *pEntity = gEntList.GetBaseEntity( pHandleEntity->GetRefEHandle() ); - if ( pEntity ) - { - if ( m_flagMask && !(pEntity->GetFlags() & m_flagMask) ) // Does it meet the criteria? - return ITERATION_CONTINUE; - - if ( !AddToList( pEntity ) ) - return ITERATION_STOP; - } - - return ITERATION_CONTINUE; -} - - //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -276,12 +236,6 @@ int UTIL_EntitiesInBox( const Vector &mins, const Vector &maxs, CFlaggedEntities return pEnum->GetCount(); } -int UTIL_EntitiesAlongRay( const Ray_t &ray, CFlaggedEntitiesEnum *pEnum ) -{ - partition->EnumerateElementsAlongRay( PARTITION_ENGINE_NON_STATIC_EDICTS, ray, false, pEnum ); - return pEnum->GetCount(); -} - int UTIL_EntitiesInSphere( const Vector ¢er, float radius, CFlaggedEntitiesEnum *pEnum ) { partition->EnumerateElementsInSphere( PARTITION_ENGINE_NON_STATIC_EDICTS, center, radius, false, pEnum ); @@ -464,9 +418,7 @@ void UTIL_Remove( IServerNetworkable *oldObj ) CBaseEntity *pBaseEnt = oldObj->GetBaseEntity(); if ( pBaseEnt ) { -#ifdef PORTAL //make sure entities are in the primary physics environment for the portal mod, this code should be safe even if the entity is in neither extra environment - CPortalSimulator::Pre_UTIL_Remove( pBaseEnt ); -#endif + g_bReceivedChainedUpdateOnRemove = false; pBaseEnt->UpdateOnRemove(); @@ -475,9 +427,7 @@ void UTIL_Remove( IServerNetworkable *oldObj ) // clear oldObj targetname / other flags now pBaseEnt->SetName( NULL_STRING ); -#ifdef PORTAL - CPortalSimulator::Post_UTIL_Remove( pBaseEnt ); -#endif + } gEntList.AddToDeleteList( oldObj ); @@ -517,9 +467,7 @@ void UTIL_RemoveImmediate( CBaseEntity *oldObj ) return; } -#ifdef PORTAL //make sure entities are in the primary physics environment for the portal mod, this code should be safe even if the entity is in neither extra environment - CPortalSimulator::Pre_UTIL_Remove( oldObj ); -#endif + oldObj->AddEFlags( EFL_KILLME ); // Make sure to ignore further calls into here or UTIL_Remove. @@ -533,9 +481,7 @@ void UTIL_RemoveImmediate( CBaseEntity *oldObj ) delete oldObj; g_bDisableEhandleAccess = false; -#ifdef PORTAL - CPortalSimulator::Post_UTIL_Remove( oldObj ); -#endif + } @@ -701,6 +647,12 @@ int ENTINDEX( CBaseEntity *pEnt ) void UTIL_GetPlayerConnectionInfo( int playerIndex, int& ping, int &packetloss ) { CBasePlayer *player = UTIL_PlayerByIndex( playerIndex ); + if ( player->IsSplitScreenPlayer() && + player->GetSplitScreenPlayerOwner() ) + { + player = player->GetSplitScreenPlayerOwner(); + playerIndex = player->entindex(); + } INetChannelInfo *nci = engine->GetPlayerNetInfo(playerIndex); @@ -719,10 +671,10 @@ void UTIL_GetPlayerConnectionInfo( int playerIndex, int& ping, int &packetloss ) // Source pings by half a tick to match the old GoldSrc pings. latency -= TICKS_TO_TIME( 0.5f ); - ping = (int)(latency * 1000.0f); // as msecs + ping = latency * 1000.0f; // as msecs ping = clamp( ping, 5, 1000 ); // set bounds, dont show pings under 5 msecs - packetloss = (int)(100.0f * nci->GetAvgLoss( FLOW_INCOMING )); // loss in percentage + packetloss = 100.0f * nci->GetAvgLoss( FLOW_INCOMING ); // loss in percentage packetloss = clamp( packetloss, 0, 100 ); } else @@ -736,7 +688,7 @@ static unsigned short FixedUnsigned16( float value, float scale ) { int output; - output = (int)(value * scale); + output = value * scale; if ( output < 0 ) output = 0; if ( output > 0xFFFF ) @@ -810,7 +762,7 @@ inline void TransmitShakeEvent( CBasePlayer *pPlayer, float localAmplitude, floa // bAirShake - if this is false, then it will only shake players standing on the ground. //----------------------------------------------------------------------------- const float MAX_SHAKE_AMPLITUDE = 16.0f; -void UTIL_ScreenShake( const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake ) +void UTIL_ScreenShake( const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake, CUtlVector *ignore ) { int i; float localAmplitude; @@ -821,7 +773,7 @@ void UTIL_ScreenShake( const Vector ¢er, float amplitude, float frequency, f } for ( i = 1; i <= gpGlobals->maxClients; i++ ) { - CBaseEntity *pPlayer = UTIL_PlayerByIndex( i ); + CBasePlayer *pPlayer = UTIL_PlayerByIndex( i ); // // Only start shakes for players that are on the ground unless doing an air shake. @@ -831,6 +783,11 @@ void UTIL_ScreenShake( const Vector ¢er, float amplitude, float frequency, f continue; } + if ( ignore && ignore->HasElement( pPlayer ) ) + { + continue; + } + localAmplitude = ComputeShakeAmplitude( center, pPlayer->WorldSpaceCenter(), amplitude, radius ); // This happens if the player is outside the radius, in which case we should ignore @@ -838,7 +795,7 @@ void UTIL_ScreenShake( const Vector ¢er, float amplitude, float frequency, f if (localAmplitude < 0) continue; - TransmitShakeEvent( (CBasePlayer *)pPlayer, localAmplitude, frequency, duration, eCommand ); + TransmitShakeEvent( pPlayer, localAmplitude, frequency, duration, eCommand ); } } @@ -864,7 +821,7 @@ void UTIL_ScreenShakeObject( CBaseEntity *pEnt, const Vector ¢er, float ampl { localAmplitude = amplitude; } - else if ((pPlayer->GetFlags() & FL_ONGROUND) && (pPlayer->GetGroundEntity()->GetRootMoveParent() == pHighestParent)) + else if ((pPlayer->GetFlags() & FL_ONGROUND) && pPlayer->GetGroundEntity() && (pPlayer->GetGroundEntity()->GetRootMoveParent() == pHighestParent)) { // If the player is standing on the object, use maximum amplitude localAmplitude = amplitude; @@ -890,6 +847,67 @@ void UTIL_ScreenShakeObject( CBaseEntity *pEnt, const Vector ¢er, float ampl } +//----------------------------------------------------------------------------- +// Transmits the actual tilt event +//----------------------------------------------------------------------------- +inline void TransmitTiltEvent( CBasePlayer *pPlayer, QAngle tiltAngle, float duration, float tiltTime, ShakeCommand_t eCommand, bool bEaseInOut ) +{ + CSingleUserRecipientFilter user( pPlayer ); + user.MakeReliable(); + UserMessageBegin( user, "Tilt" ); + WRITE_BYTE( eCommand ); // tilt command (SHAKE_START, STOP, FREQUENCY, AMPLITUDE) + WRITE_BYTE( bEaseInOut ); // tilt ease in/out + WRITE_FLOAT( tiltAngle.x ); // tilt angle + WRITE_FLOAT( tiltAngle.y ); + WRITE_FLOAT( tiltAngle.z ); + WRITE_FLOAT( duration ); // tilt lasts this long + WRITE_FLOAT( tiltTime ); // tilt time + MessageEnd(); +} + +//----------------------------------------------------------------------------- +// Purpose: Tilt the screen of all clients within radius. +// radius == 0, shake all clients +// Input : center - Center of screen tilt, radius is measured from here. +// tiltAngle - Angle that the world is pretending to tilt +// duration - duration of tilt in seconds. +// radius - Radius of effect, 0 shakes all clients. +// tiltTime - how long it takes to reach full tilt +// command - One of the following values: +// SHAKE_START - starts the screen tilt for all players within the radius +// SHAKE_STOP - stops the screen tilt for all players within the radius +// SHAKE_AMPLITUDE - modifies the amplitude of the screen tilt +// for all players within the radius +// SHAKE_FREQUENCY - modifies the frequency of the screen tilt +// for all players within the radius +// bAirShake - if this is false, then it will only tilt players standing on the ground. +//----------------------------------------------------------------------------- +void UTIL_ScreenTilt( const Vector ¢er, const QAngle &tiltAngle, float duration, float radius, float tiltTime, ShakeCommand_t eCommand, bool bEaseInOut ) +{ + int i; + + for ( i = 1; i <= gpGlobals->maxClients; i++ ) + { + CBaseEntity *pPlayer = UTIL_PlayerByIndex( i ); + + // + // Only start shakes for players that are on the ground unless doing an air shake. + // + if ( !pPlayer ) + { + continue; + } + + // This happens if the player is outside the radius, in which case we should ignore + // all commands + if ( radius != 0.0f && pPlayer->WorldSpaceCenter().DistTo( center ) > radius ) + continue; + + TransmitTiltEvent( (CBasePlayer *)pPlayer, tiltAngle, duration, tiltTime, eCommand, bEaseInOut ); + } +} + + //----------------------------------------------------------------------------- // Purpose: Punches the view of all clients within radius. // If radius is 0, punches all clients. @@ -952,10 +970,17 @@ void UTIL_ScreenFadeWrite( const ScreenFade_t &fade, CBaseEntity *pEntity ) if ( !pEntity || !pEntity->IsNetClient() ) return; - CSingleUserRecipientFilter user( (CBasePlayer *)pEntity ); + CBasePlayer *pRecipient = static_cast< CBasePlayer * >( pEntity ); + + if ( pRecipient->ShouldThrottleUserMessage( "Fade" ) ) + { + return; + } + + CSingleUserRecipientFilter user( pRecipient ); user.MakeReliable(); - UserMessageBegin( user, "Fade" ); // use the magic #1 for "one client" + UserMessageBegin( user, "Fade" ); WRITE_SHORT( fade.duration ); // fade lasts this long WRITE_SHORT( fade.holdTime ); // fade lasts this long WRITE_SHORT( fade.fadeFlags ); // fade type (in / out) @@ -1192,6 +1217,57 @@ void UTIL_ShowMessageAll( const char *pString ) UTIL_ShowMessage( pString, NULL ); } + +//------------------------------------------------------------------------------------------------- +// HudMessagePanel helper +void UTIL_MessageTextAll( const char *text, Color color ) +{ + CReliableBroadcastRecipientFilter filter; + UserMessageBegin( filter, "MessageText" ); + WRITE_BYTE( color.r() ); + WRITE_BYTE( color.g() ); + WRITE_BYTE( color.b() ); + WRITE_STRING( text ); + MessageEnd(); +} + + +//------------------------------------------------------------------------------------------------- +// HudMessagePanel helper +void UTIL_MessageText( CBasePlayer *player, const char *text, Color color ) +{ + CSingleUserRecipientFilter filter( player ); + filter.MakeReliable(); + UserMessageBegin( filter, "MessageText" ); + WRITE_BYTE( color.r() ); + WRITE_BYTE( color.g() ); + WRITE_BYTE( color.b() ); + WRITE_STRING( text ); + MessageEnd(); +} + + +//------------------------------------------------------------------------------------------------- +// HudMessagePanel helper +void UTIL_ResetMessageTextAll( void ) +{ + CReliableBroadcastRecipientFilter filter; + UserMessageBegin( filter, "MessageText" ); + MessageEnd(); +} + + +//------------------------------------------------------------------------------------------------- +// HudMessagePanel helper +void UTIL_ResetMessageText( CBasePlayer *player ) +{ + CSingleUserRecipientFilter filter( player ); + filter.MakeReliable(); + UserMessageBegin( filter, "MessageText" ); + MessageEnd(); +} + + // So we always return a valid surface static csurface_t g_NullSurface = { "**empty**", 0 }; @@ -1296,7 +1372,7 @@ void UTIL_SetOrigin( CBaseEntity *entity, const Vector &vecOrigin, bool bFireTri } -void UTIL_ParticleEffect( const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount ) +void UTIL_ParticleEffect( const Vector &vecOrigin, const Vector &vecDirection, uint32 ulColor, int ulCount ) { Msg( "UTIL_ParticleEffect: Disabled\n" ); } @@ -1387,7 +1463,7 @@ Vector UTIL_RandomBloodVector( void ) // Input : // Output : //------------------------------------------------------------------------------ -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) { CBaseEntity *pEntity = pTrace->m_pEnt; @@ -1506,18 +1582,18 @@ float UTIL_WaterLevel( const Vector &position, float minz, float maxz ) Vector midUp = position; midUp.z = minz; - if ( !(UTIL_PointContents(midUp) & MASK_WATER) ) + if ( !(UTIL_PointContents(midUp, MASK_WATER) & MASK_WATER) ) return minz; midUp.z = maxz; - if ( UTIL_PointContents(midUp) & MASK_WATER ) + if ( UTIL_PointContents(midUp, MASK_WATER) & MASK_WATER ) return maxz; float diff = maxz - minz; while (diff > 1.0) { midUp.z = minz + diff/2.0; - if ( UTIL_PointContents(midUp) & MASK_WATER ) + if ( UTIL_PointContents(midUp, MASK_WATER) & MASK_WATER ) { minz = midUp.z; } @@ -1571,7 +1647,7 @@ float UTIL_FindWaterSurface( const Vector &position, float minz, float maxz ) } -extern short g_sModelIndexBubbles;// holds the index for the bubbles model +extern int g_sModelIndexBubbles;// holds the index for the bubbles model void UTIL_Bubbles( const Vector& mins, const Vector& maxs, int count ) { @@ -1766,8 +1842,11 @@ void UTIL_PrecacheOther( const char *szClassname, const char *modelName ) // UTIL_LogPrintf - Prints a logged message to console. // Preceded by LOG: ( timestamp ) < message > //========================================================= -void UTIL_LogPrintf( const char *fmt, ... ) +void UTIL_LogPrintf( char *fmt, ... ) { + if ( !g_bIsLogging ) + return; + va_list argptr; char tempString[1024]; @@ -1842,7 +1921,7 @@ extern "C" void Sys_Error( char *error, ... ) // *mapData - pointer a block of entity map data // Output : -1 if the entity was not successfully created; 0 on success //----------------------------------------------------------------------------- -int DispatchSpawn( CBaseEntity *pEntity ) +int DispatchSpawn( CBaseEntity *pEntity, bool bRunVScripts ) { if ( pEntity ) { @@ -1857,6 +1936,13 @@ int DispatchSpawn( CBaseEntity *pEntity ) //pEntity->SetAbsMins( pEntity->GetOrigin() - Vector(1,1,1) ); //pEntity->SetAbsMaxs( pEntity->GetOrigin() + Vector(1,1,1) ); + + if( bRunVScripts ) + { + pEntity->RunVScripts(); + pEntity->RunPrecacheScripts(); + } + #if defined(TRACK_ENTITY_MEMORY) && defined(USE_MEM_DEBUG) const char *pszClassname = NULL; int iClassname = ((CEntityFactoryDictionary*)EntityFactoryDictionary())->m_Factories.Find( pEntity->GetClassname() ); @@ -1922,6 +2008,12 @@ int DispatchSpawn( CBaseEntity *pEntity ) } gEntList.NotifySpawn( pEntity ); + + if( bRunVScripts ) + { + pEntity->RunOnPostSpawnScripts(); + } + } return 0; @@ -2106,7 +2198,7 @@ static int UTIL_GetNewCheckClient( int check ) i = 1; } - ent = engine->PEntityOfEntIndex( i ); + ent = INDEXENT( i ); if ( !ent ) continue; @@ -2148,6 +2240,8 @@ static int UTIL_GetNewCheckClient( int check ) { g_CheckClient.m_checkCluster = clusterIndex; engine->GetPVSForCluster( clusterIndex, sizeof(g_CheckClient.m_checkPVS), g_CheckClient.m_checkPVS ); + + } } @@ -2171,7 +2265,7 @@ static edict_t *UTIL_GetCurrentCheckClient() } // return check if it might be visible - ent = engine->PEntityOfEntIndex( g_CheckClient.m_lastcheck ); + ent = INDEXENT( g_CheckClient.m_lastcheck ); // Allow dead clients -- JAY // Our monsters know the difference, and this function gates alot of behavior @@ -2185,11 +2279,13 @@ static edict_t *UTIL_GetCurrentCheckClient() return ent; } + + void UTIL_SetClientVisibilityPVS( edict_t *pClient, const unsigned char *pvs, int pvssize ) { if ( pClient == UTIL_GetCurrentCheckClient() ) { - Assert( pvssize <= (int)sizeof(g_CheckClient.m_checkVisibilityPVS) ); + Assert( pvssize <= sizeof(g_CheckClient.m_checkVisibilityPVS) ); g_CheckClient.m_bClientPVSIsExpanded = false; @@ -2262,7 +2358,7 @@ CBaseEntity *UTIL_FindClientInPVS( const Vector &vecBoxMins, const Vector &vecBo //----------------------------------------------------------------------------- ConVar sv_strict_notarget( "sv_strict_notarget", "0", 0, "If set, notarget will cause entities to never think they are in the pvs" ); -static edict_t *UTIL_FindClientInPVSGuts(edict_t *pEdict, unsigned char *pvs, unsigned pvssize ) +edict_t *UTIL_FindClientInPVSGuts(edict_t *pEdict, unsigned char *pvs, unsigned pvssize ) { Vector view; @@ -2301,7 +2397,7 @@ static edict_t *UTIL_FindClientInPVSGuts(edict_t *pEdict, unsigned char *pvs, un edict_t *UTIL_FindClientInPVS(edict_t *pEdict) { - return UTIL_FindClientInPVSGuts( pEdict, g_CheckClient.m_checkPVS, sizeof( g_CheckClient.m_checkPVS ) ); + return g_pGameRules->DoFindClientInPVS( pEdict, g_CheckClient.m_checkPVS, sizeof( g_CheckClient.m_checkPVS ) ); } //----------------------------------------------------------------------------- @@ -2309,7 +2405,7 @@ edict_t *UTIL_FindClientInPVS(edict_t *pEdict) //----------------------------------------------------------------------------- edict_t *UTIL_FindClientInVisibilityPVS( edict_t *pEdict ) { - return UTIL_FindClientInPVSGuts( pEdict, g_CheckClient.m_checkVisibilityPVS, sizeof( g_CheckClient.m_checkVisibilityPVS ) ); + return g_pGameRules->DoFindClientInPVS( pEdict, g_CheckClient.m_checkVisibilityPVS, sizeof( g_CheckClient.m_checkVisibilityPVS ) ); } @@ -2327,6 +2423,7 @@ CBaseEntity *UTIL_EntitiesInPVS( CBaseEntity *pPVSEntity, CBaseEntity *pStarting Vector org; static byte pvs[ MAX_MAP_CLUSTERS/8 ]; static Vector lastOrg( 0, 0, 0 ); + static int lastCluster = -1; if ( !pPVSEntity ) return NULL; @@ -2689,7 +2786,7 @@ bool UTIL_LoadAndSpawnEntitiesFromScript( CUtlVector &entities, c { KeyValues *pkvFile = new KeyValues( pBlock ); - if ( pkvFile->LoadFromFile( filesystem, pScriptFile, "MOD" ) ) + if ( pkvFile->LoadFromFile( filesystem, pScriptFile, "GAME" ) ) { // Load each block, and spawn the entities KeyValues *pkvNode = pkvFile->GetFirstSubKey(); @@ -2861,6 +2958,84 @@ void UTIL_BoundToWorldSize( Vector *pVecPos ) } } +//-------------------------------------------------------------------------------------------------------- +/** + * Return true if ground is fairly level within the given radius around an entity + * Trace 4 vertical hull-quadrants and test their collisions and ground heights and normals + */ +bool UTIL_IsGroundLevel( float radius, const Vector &position, float hullHeight, int mask, const CBaseEntity *ignore, bool debugTraces ) +{ + const int subdivisions = 3; + const int samples = subdivisions * subdivisions; + + // trace down below floor level to detect ledges and overhangs + trace_t result[ samples ]; + float size = 2.0f * radius / subdivisions; + + int i, j, s = 0; + float x, y = -radius; + for( j=0; jGetCrouchHullHeight() ), GetPosition() + Vector( 0, 0, -100 ), Vector( -radius, -radius, 0 ), Vector( 0, 0, 10.0f ), MASK_ZOMBIESOLID, this, COLLISION_GROUP_PLAYER_MOVEMENT, &result[0] ); +// UTIL_TraceHull( GetPosition() + Vector( 0, 0, body->GetCrouchHullHeight() ), GetPosition() + Vector( 0, 0, -100 ), Vector( -radius, 0, 0 ), Vector( 0, radius, 10.0f ), MASK_ZOMBIESOLID, this, COLLISION_GROUP_PLAYER_MOVEMENT, &result[1] ); +// UTIL_TraceHull( GetPosition() + Vector( 0, 0, body->GetCrouchHullHeight() ), GetPosition() + Vector( 0, 0, -100 ), Vector( 0, 0, 0 ), Vector( radius, radius, 10.0f ), MASK_ZOMBIESOLID, this, COLLISION_GROUP_PLAYER_MOVEMENT, &result[2] ); +// UTIL_TraceHull( GetPosition() + Vector( 0, 0, body->GetCrouchHullHeight() ), GetPosition() + Vector( 0, 0, -100 ), Vector( 0, -radius, 0 ), Vector( radius, 0, 10.0f ), MASK_ZOMBIESOLID, this, COLLISION_GROUP_PLAYER_MOVEMENT, &result[3] ); + + for( i=0; i maxZDelta ) + { + return false; + } + } + } + } + + return true; +} //============================================================================= // // Tests! @@ -3225,7 +3400,7 @@ void CC_CollisionTest( const CCommand &args ) int nMask = MASK_ALL & ~(CONTENTS_MONSTER | CONTENTS_HITBOX ); for ( int j = 0; j < 2; j++ ) { - float startTime = engine->Time(); + float startTime = Plat_FloatTime(); if ( testType == 1 ) { trace_t tr; @@ -3255,7 +3430,7 @@ void CC_CollisionTest( const CCommand &args ) } } - duration += engine->Time() - startTime; + duration += Plat_FloatTime() - startTime; } test[testType] = duration; Msg("%d collisions in %.2f ms (%u dots)\n", NUM_COLLISION_TESTS, duration*1000, dots ); diff --git a/game/server/util.h b/game/server/util.h index 330cd97c9..9784c562d 100644 --- a/game/server/util.h +++ b/game/server/util.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Misc utility code. // @@ -45,13 +45,13 @@ class IEntityFactory; #include "tier0/memdbgon.h" -CBaseEntity *CreateEntityByName(const char *className, int iForceEdictIndex); // entity creation // creates an entity that has not been linked to a classname template< class T > T *_CreateEntityTemplate( T *newEnt, const char *className ) { + MEM_ALLOC_CREDIT_("Entities"); newEnt = new T; // this is the only place 'new' should be used! newEnt->PostConstructor( className ); return newEnt; @@ -59,24 +59,6 @@ T *_CreateEntityTemplate( T *newEnt, const char *className ) #include "tier0/memdbgoff.h" -// creates an entity by name, and ensure it's correctness -// does not spawn the entity -// use the CREATE_ENTITY() macro which wraps this, instead of using it directly -template< class T > -T *_CreateEntity( T *newClass, const char *className ) -{ - T *newEnt = dynamic_cast( CreateEntityByName(className, -1) ); - if ( !newEnt ) - { - Warning( "classname %s used to create wrong class type\n" ); - Assert(0); - } - - return newEnt; -} - -#define CREATE_ENTITY( newClass, className ) _CreateEntity( (newClass*)NULL, className ) -#define CREATE_UNSAVED_ENTITY( newClass, className ) _CreateEntityTemplate( (newClass*)NULL, className ) // This is the glue that hooks .MAP entity class names to our CPP classes @@ -142,18 +124,28 @@ class CEntityFactory : public IEntityFactory // Conversion among the three types of "entity", including identity-conversions. // extern CGlobalVars *gpGlobals; -inline int ENTINDEX( edict_t *pEdict) +extern bool g_bIsLogging; + +inline int ENTINDEX( edict_t *pEdict ) { - return (int)(pEdict - gpGlobals->pEdicts); + if ( !pEdict ) + return 0; + int edictIndex = pEdict - gpGlobals->pEdicts; + Assert( edictIndex < MAX_EDICTS && edictIndex >= 0 ); + return edictIndex; } int ENTINDEX( CBaseEntity *pEnt ); inline edict_t* INDEXENT( int iEdictNum ) -{ - if (iEdictNum >= 0 && iEdictNum < gpGlobals->maxEntities) +{ + Assert(iEdictNum>=0 && iEdictNum < MAX_EDICTS); + if ( gpGlobals->pEdicts ) { - return (edict_t *)(gpGlobals->pEdicts + iEdictNum); + edict_t *pEdict = gpGlobals->pEdicts + iEdictNum; + if ( pEdict->IsFree() ) + return NULL; + return pEdict; } return NULL; } @@ -173,8 +165,6 @@ inline bool FNullEnt(const edict_t* pent) class CBaseEntity; class CBasePlayer; -extern CGlobalVars *gpGlobals; - // Misc useful inline bool FStrEq(const char *sz1, const char *sz2) { @@ -222,6 +212,23 @@ CBasePlayer* UTIL_GetLocalPlayer( void ); // get the local player on a listen server CBasePlayer *UTIL_GetListenServerHost( void ); +// Convenience function so we don't have to make this check all over +inline CBasePlayer * UTIL_GetLocalPlayerOrListenServerHost( void ) +{ + if ( gpGlobals->maxClients > 1 ) + { + if ( engine->IsDedicatedServer() ) + { + return NULL; + } + + return UTIL_GetListenServerHost(); + } + + return UTIL_GetLocalPlayer(); +} + + CBasePlayer* UTIL_PlayerByUserId( int userID ); CBasePlayer* UTIL_PlayerByName( const char *name ); // not case sensitive @@ -236,40 +243,20 @@ void UTIL_GetPlayerConnectionInfo( int playerIndex, int& ping, int &packetloss void UTIL_SetClientVisibilityPVS( edict_t *pClient, const unsigned char *pvs, int pvssize ); bool UTIL_ClientPVSIsExpanded(); + + edict_t *UTIL_FindClientInPVS( edict_t *pEdict ); edict_t *UTIL_FindClientInVisibilityPVS( edict_t *pEdict ); +edict_t *UTIL_FindClientInPVSGuts(edict_t *pEdict, unsigned char *pvs, unsigned pvssize ); + // This is a version which finds any clients whose PVS intersects the box CBaseEntity *UTIL_FindClientInPVS( const Vector &vecBoxMins, const Vector &vecBoxMaxs ); CBaseEntity *UTIL_EntitiesInPVS( CBaseEntity *pPVSEntity, CBaseEntity *pStartingEntity ); -//----------------------------------------------------------------------------- -// class CFlaggedEntitiesEnum -//----------------------------------------------------------------------------- -// enumerate entities that match a set of edict flags into a static array -class CFlaggedEntitiesEnum : public IPartitionEnumerator -{ -public: - CFlaggedEntitiesEnum( CBaseEntity **pList, int listMax, int flagMask ); - - // This gets called by the enumeration methods with each element - // that passes the test. - virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity ); - - int GetCount() { return m_count; } - bool AddToList( CBaseEntity *pEntity ); - -private: - CBaseEntity **m_pList; - int m_listMax; - int m_flagMask; - int m_count; -}; - // Pass in an array of pointers and an array size, it fills the array and returns the number inserted int UTIL_EntitiesInBox( const Vector &mins, const Vector &maxs, CFlaggedEntitiesEnum *pEnum ); -int UTIL_EntitiesAlongRay( const Ray_t &ray, CFlaggedEntitiesEnum *pEnum ); int UTIL_EntitiesInSphere( const Vector ¢er, float radius, CFlaggedEntitiesEnum *pEnum ); inline int UTIL_EntitiesInBox( CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask ) @@ -278,12 +265,6 @@ inline int UTIL_EntitiesInBox( CBaseEntity **pList, int listMax, const Vector &m return UTIL_EntitiesInBox( mins, maxs, &boxEnum ); } -inline int UTIL_EntitiesAlongRay( CBaseEntity **pList, int listMax, const Ray_t &ray, int flagMask ) -{ - CFlaggedEntitiesEnum rayEnum( pList, listMax, flagMask ); - return UTIL_EntitiesAlongRay( ray, &rayEnum ); -} - inline int UTIL_EntitiesInSphere( CBaseEntity **pList, int listMax, const Vector ¢er, float radius, int flagMask ) { CFlaggedEntitiesEnum sphereEnum( pList, listMax, flagMask ); @@ -327,9 +308,10 @@ bool UTIL_CheckBottom( CBaseEntity *pEntity, ITraceFilter *pTraceFilter, float void UTIL_SetOrigin ( CBaseEntity *entity, const Vector &vecOrigin, bool bFireTriggers = false ); void UTIL_EmitAmbientSound ( int entindex, const Vector &vecOrigin, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float soundtime = 0.0f, float *duration = NULL ); -void UTIL_ParticleEffect ( const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount ); -void UTIL_ScreenShake ( const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake=false ); +void UTIL_ParticleEffect ( const Vector &vecOrigin, const Vector &vecDirection, uint32 ulColor, int ulCount ); +void UTIL_ScreenShake ( const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake = false, CUtlVector *ignore = NULL ); void UTIL_ScreenShakeObject ( CBaseEntity *pEnt, const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake=false ); +void UTIL_ScreenTilt ( const Vector ¢er, const QAngle &tiltAngle, float duration, float radius, float tiltTime, ShakeCommand_t eCommand, bool bEaseInOut ); void UTIL_ViewPunch ( const Vector ¢er, QAngle angPunch, float radius, bool bInAir ); void UTIL_ShowMessage ( const char *pString, CBasePlayer *pPlayer ); void UTIL_ShowMessageAll ( const char *pString ); @@ -343,8 +325,9 @@ int UTIL_EntityInSolid( CBaseEntity *ent ); bool UTIL_IsMasterTriggered (string_t sMaster, CBaseEntity *pActivator); void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, int amount ); void UTIL_BloodSpray( const Vector &pos, const Vector &dir, int color, int amount, int flags ); +void UTIL_BloodSprayPrecache(); Vector UTIL_RandomBloodVector( void ); -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL ); +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL ); void UTIL_PlayerDecalTrace( trace_t *pTrace, int playernum ); void UTIL_Smoke( const Vector &origin, const float scale, const float framerate ); void UTIL_AxisStringToPointDir( Vector &start, Vector &dir, const char *pString ); @@ -466,7 +449,7 @@ void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, void UTIL_HudHintText( CBaseEntity *pEntity, const char *pMessage ); // Writes message to console with timestamp and FragLog header. -void UTIL_LogPrintf( const char *fmt, ... ); +void UTIL_LogPrintf( char *fmt, ... ); // Sorta like FInViewCone, but for nonNPCs. float UTIL_DotPoints ( const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir ); @@ -509,12 +492,11 @@ void DBG_AssertFunction(bool fExpr, const char* szExpr, const char* szFile, int #define SF_BRUSH_ROTATE_BACKWARDS 2 #define SF_BRUSH_ROTATE_Z_AXIS 4 #define SF_BRUSH_ROTATE_X_AXIS 8 -#define SF_BRUSH_ROTATE_CLIENTSIDE 16 - #define SF_BRUSH_ROTATE_SMALLRADIUS 128 #define SF_BRUSH_ROTATE_MEDIUMRADIUS 256 #define SF_BRUSH_ROTATE_LARGERADIUS 512 +#define SF_BRUSH_ROTATE_CLIENTSIDE 1024 #define PUSH_BLOCK_ONLY_X 1 #define PUSH_BLOCK_ONLY_Y 2 @@ -621,7 +603,6 @@ extern void *UTIL_FunctionFromName( datamap_t *pMap, const char *pName ); int UTIL_GetCommandClientIndex( void ); CBasePlayer *UTIL_GetCommandClient( void ); -bool UTIL_GetModDir( char *lpszTextOut, unsigned int nSize ); AngularImpulse WorldToLocalRotation( const VMatrix &localToWorld, const Vector &worldAxis, float rotation ); void UTIL_WorldToParentSpace( CBaseEntity *pEntity, Vector &vecPosition, QAngle &vecAngles ); @@ -631,6 +612,19 @@ void UTIL_ParentToWorldSpace( CBaseEntity *pEntity, Vector &vecPosition, Quatern bool UTIL_LoadAndSpawnEntitiesFromScript( CUtlVector &entities, const char *pScriptFile, const char *pBlock, bool bActivate = true ); +// HudMessagePanel helpers +void UTIL_MessageTextAll( const char *text, Color color = Color( 0, 0, 0, 0 ) ); // Send a HudMessagePanel string to clients +void UTIL_MessageText( CBasePlayer *player, const char *text, Color color = Color( 0, 0, 0, 0 ) ); // Send a HudMessagePanel string to a client +void UTIL_ResetMessageTextAll( void ); // Reset clients' HudMessagePanel +void UTIL_ResetMessageText( CBasePlayer *player ); // Reset a client's HudMessagePanel + +//-------------------------------------------------------------------------------------------------------- +/** + * Return true if ground is fairly level within the given radius around an entity + * Trace 4 vertical hull-quadrants and test their collisions and ground heights and normals + */ +bool UTIL_IsGroundLevel( float radius, const Vector &position, float hullHeight, int mask, const CBaseEntity *ignore, bool debugTraces = false ); + // Given a vector, clamps the scalar axes to MAX_COORD_FLOAT ranges from worldsize.h void UTIL_BoundToWorldSize( Vector *pVecPos ); diff --git a/game/shared/activitylist.cpp b/game/shared/activitylist.cpp index 266cd922b..b8e00c49c 100644 --- a/game/shared/activitylist.cpp +++ b/game/shared/activitylist.cpp @@ -94,7 +94,7 @@ static activitylist_t *ListFromString( const char *pString ) static activitylist_t *ListFromActivity( int activityIndex ) { // ugly linear search - for ( int i = 0; i < g_ActivityList.Size(); i++ ) + for ( int i = 0; i < g_ActivityList.Count(); i++ ) { if ( g_ActivityList[i].activityIndex == activityIndex ) { @@ -239,6 +239,8 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY( ACT_CROUCHIDLE ); REGISTER_SHARED_ACTIVITY( ACT_STAND ); REGISTER_SHARED_ACTIVITY( ACT_USE ); + REGISTER_SHARED_ACTIVITY( ACT_ALIEN_BURROW_IDLE ); + REGISTER_SHARED_ACTIVITY( ACT_ALIEN_BURROW_OUT ); REGISTER_SHARED_ACTIVITY( ACT_SIGNAL1 ); REGISTER_SHARED_ACTIVITY( ACT_SIGNAL2 ); REGISTER_SHARED_ACTIVITY( ACT_SIGNAL3 ); @@ -330,6 +332,14 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY( ACT_FLINCH_RIGHTLEG ); REGISTER_SHARED_ACTIVITY( ACT_FLINCH_PHYSICS ); + REGISTER_SHARED_ACTIVITY( ACT_FLINCH_HEAD_BACK ); + REGISTER_SHARED_ACTIVITY( ACT_FLINCH_CHEST_BACK ); + REGISTER_SHARED_ACTIVITY( ACT_FLINCH_STOMACH_BACK ); + REGISTER_SHARED_ACTIVITY( ACT_FLINCH_CROUCH_FRONT ); + REGISTER_SHARED_ACTIVITY( ACT_FLINCH_CROUCH_BACK ); + REGISTER_SHARED_ACTIVITY( ACT_FLINCH_CROUCH_LEFT ); + REGISTER_SHARED_ACTIVITY( ACT_FLINCH_CROUCH_RIGHT ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_ON_FIRE ); REGISTER_SHARED_ACTIVITY( ACT_WALK_ON_FIRE ); REGISTER_SHARED_ACTIVITY( ACT_RUN_ON_FIRE ); @@ -385,6 +395,7 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY( ACT_BARNACLE_CHEW ); REGISTER_SHARED_ACTIVITY( ACT_DO_NOT_DISTURB ); + REGISTER_SHARED_ACTIVITY( ACT_SPECIFIC_SEQUENCE ); // Viewmodel activities may belong elsewhere, but since where is unclear right now, // they'll be placed here. @@ -737,46 +748,13 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY( ACT_DEPLOY_IDLE ); REGISTER_SHARED_ACTIVITY( ACT_UNDEPLOY ); -//=========================== -// HL1 Specific Activities -//=========================== - - // Grenades - REGISTER_SHARED_ACTIVITY( ACT_GRENADE_ROLL ); - REGISTER_SHARED_ACTIVITY( ACT_GRENADE_TOSS ); - - // Hand grenade - REGISTER_SHARED_ACTIVITY( ACT_HANDGRENADE_THROW1 ); - REGISTER_SHARED_ACTIVITY( ACT_HANDGRENADE_THROW2 ); - REGISTER_SHARED_ACTIVITY( ACT_HANDGRENADE_THROW3 ); - - // Shotgun - REGISTER_SHARED_ACTIVITY( ACT_SHOTGUN_IDLE_DEEP ); - REGISTER_SHARED_ACTIVITY( ACT_SHOTGUN_IDLE4 ); - - // Glock - REGISTER_SHARED_ACTIVITY( ACT_GLOCK_SHOOTEMPTY ); - REGISTER_SHARED_ACTIVITY( ACT_GLOCK_SHOOT_RELOAD ); - - // RPG - REGISTER_SHARED_ACTIVITY( ACT_RPG_DRAW_UNLOADED ); - REGISTER_SHARED_ACTIVITY( ACT_RPG_HOLSTER_UNLOADED ); - REGISTER_SHARED_ACTIVITY( ACT_RPG_IDLE_UNLOADED ); - REGISTER_SHARED_ACTIVITY( ACT_RPG_FIDGET_UNLOADED ); - // Crossbow REGISTER_SHARED_ACTIVITY( ACT_CROSSBOW_DRAW_UNLOADED ); - REGISTER_SHARED_ACTIVITY( ACT_CROSSBOW_IDLE_UNLOADED ); - REGISTER_SHARED_ACTIVITY( ACT_CROSSBOW_FIDGET_UNLOADED ); // Gauss REGISTER_SHARED_ACTIVITY( ACT_GAUSS_SPINUP ); REGISTER_SHARED_ACTIVITY( ACT_GAUSS_SPINCYCLE ); - // Tripmine - REGISTER_SHARED_ACTIVITY( ACT_TRIPMINE_GROUND ); - REGISTER_SHARED_ACTIVITY( ACT_TRIPMINE_WORLD ); - //=========================== // CSPort Specific Activities //=========================== @@ -789,6 +767,12 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_EMPTY_LEFT ); REGISTER_SHARED_ACTIVITY ( ACT_VM_DRYFIRE_LEFT ); + + // new for CS2 + REGISTER_SHARED_ACTIVITY ( ACT_VM_IS_DRAW ); + REGISTER_SHARED_ACTIVITY ( ACT_VM_IS_HOLSTER ); + REGISTER_SHARED_ACTIVITY ( ACT_VM_IS_IDLE ); + REGISTER_SHARED_ACTIVITY ( ACT_VM_IS_PRIMARYATTACK ); REGISTER_SHARED_ACTIVITY ( ACT_PLAYER_IDLE_FIRE ); REGISTER_SHARED_ACTIVITY ( ACT_PLAYER_CROUCH_FIRE ); @@ -798,668 +782,8 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY ( ACT_IDLETORUN ); REGISTER_SHARED_ACTIVITY ( ACT_RUNTOIDLE ); -//=========================== -// DoD Specific Activities -//=========================== - - REGISTER_SHARED_ACTIVITY ( ACT_SPRINT ); - - // To get in and out of prone state. - REGISTER_SHARED_ACTIVITY ( ACT_GET_DOWN_STAND ); - REGISTER_SHARED_ACTIVITY ( ACT_GET_UP_STAND ); - REGISTER_SHARED_ACTIVITY ( ACT_GET_DOWN_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_GET_UP_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_PRONE_FORWARD ); - REGISTER_SHARED_ACTIVITY ( ACT_PRONE_IDLE ); - - REGISTER_SHARED_ACTIVITY ( ACT_DEEPIDLE1 ); - REGISTER_SHARED_ACTIVITY ( ACT_DEEPIDLE2 ); - REGISTER_SHARED_ACTIVITY ( ACT_DEEPIDLE3 ); - REGISTER_SHARED_ACTIVITY ( ACT_DEEPIDLE4 ); - - REGISTER_SHARED_ACTIVITY ( ACT_VM_RELOAD_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_RELOAD_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DRAW_DEPLOYED ); - //Weapon is empty activities - REGISTER_SHARED_ACTIVITY ( ACT_VM_DRAW_EMPTY ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_EMPTY ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_RELOAD_EMPTY ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_EMPTY ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_EMPTY ); - - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_8 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_7 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_6 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_5 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_4 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_3 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_2 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_1 ); - - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_8 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_7 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_6 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_5 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_4 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_3 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_2 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_IDLE_DEPLOYED_1 ); - - // Animation from prone idle to standing/crouch idle. Number designates bullets left - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_8 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_7 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_6 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_5 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_4 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_3 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_2 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_1 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_UNDEPLOY_EMPTY ); - - // Animation from standing/crouch idle to prone idle. Number designates bullets left - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_8 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_7 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_6 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_5 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_4 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_3 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_2 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_1 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_DEPLOY_EMPTY ); - - // Shooting animations for standing/crouch position. Number designates bullets left at START of animation - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_8 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_7 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_6 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_5 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_4 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_3 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_2 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_1 ); - - // Shooting animations for prone position. Number designates bullets left at START of animation - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_8 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_7 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_6 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_5 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_4 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_3 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_2 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_1 ); - REGISTER_SHARED_ACTIVITY ( ACT_VM_PRIMARYATTACK_DEPLOYED_EMPTY ); - - // Player anim ACTs - - // Base activities, we translate from these - REGISTER_SHARED_ACTIVITY ( ACT_DOD_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_IDLE_ZOOMED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_ZOOMED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_ZOOMED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_ZOOMED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOMED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_FORWARD_ZOOMED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_DEPLOYED ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_PRONE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM ); - - // Positions - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_PISTOL ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_C96 ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_RIFLE ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_BOLT ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_TOMMY ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_MP40 ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_MP44 ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_GREASE ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_MG ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_30CAL ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_AIM_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_AIM_GREN_FRAG ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_AIM_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_AIM_GREN_STICK ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_AIM_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_AIM_KNIFE ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_AIM_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_AIM_SPADE ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_BAZOOKA ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_PSCHRECK ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_AIM_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_AIM_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_AIM_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_AIM_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_AIM_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_AIM_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_BAR ); - - // ZOom - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_ZOOM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_ZOOM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_ZOOM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_ZOOM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_ZOOM_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_RIFLE ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_ZOOM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_ZOOM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_ZOOM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_ZOOM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_ZOOM_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_BOLT ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_ZOOM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_ZOOM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_ZOOM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_ZOOM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_ZOOM_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_BAZOOKA ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_ZOOM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_ZOOM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_ZOOM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_ZOOM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_ZOOM_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_PSCHRECK ); - - // Deployed Aim - REGISTER_SHARED_ACTIVITY ( ACT_DOD_DEPLOY_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_DEPLOY_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_DEPLOY_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_DEPLOY_30CAL ); - - // Prone Deployed Aim - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_DEPLOY_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_DEPLOY_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_DEPLOY_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_DEPLOY_30CAL ); - - // Attacks - - // Rifle - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_PRONE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_DEPLOYED_RIFLE ); - - // Bolt - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_PRONE_BOLT ); - - // Tommy - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_PRONE_TOMMY ); - - // MP40 - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_PRONE_MP40 ); - - // MP44 - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_MP44 ); - - // Greasegun - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_GREASE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_GREASE ); - - // Pistols (Colt, Luger) - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_C96 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_C96 ); - - // Mgs (mg42, mg34) - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_DEPLOYED_MG ); - - // 30cal - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_DEPLOYED_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_30CAL ); - - // Grenades - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_GREN_STICK ); - - // Knife - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_KNIFE ); - - // Spade - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_SPADE ); - - // Bazooka - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_BAZOOKA ); - - // Pschreck - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_PSCHRECK ); - - // Bar - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_PRONE_BAR ); - - // Reloads - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_GARAND ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_K43 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_M1CARBINE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_GREASEGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_FG42 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_RIFLEGRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_C96 ); - - // Crouch - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_RIFLEGRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_M1CARBINE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_CROUCH_C96 ); - - // Bazookas - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_ZOOMLOAD_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_ZOOMLOAD_PSCHRECK ); - - // Deployed - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_DEPLOYED_FG42 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_DEPLOYED_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_DEPLOYED_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_DEPLOYED_MG34 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_DEPLOYED_BAR ); - - // Prone - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_GARAND ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_M1CARBINE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_K43 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_MP40 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_GREASEGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_FG42 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_RIFLEGRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_C96 ); - - // Prone bazooka - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_ZOOMLOAD_PRONE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_ZOOMLOAD_PRONE_PSCHRECK ); - - // Prone deployed - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_DEPLOYED_BAR ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_DEPLOYED_FG42 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_DEPLOYED_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_DEPLOYED_MG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RELOAD_PRONE_DEPLOYED_MG34 ); - - // Prone zoomed aim - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_FORWARD_RIFLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_FORWARD_BOLT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_FORWARD_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONE_ZOOM_FORWARD_PSCHRECK ); - - // Crouch attack. - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_CROUCH_SPADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_CROUCH_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_CROUCH_GREN_FRAG ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRIMARYATTACK_CROUCH_GREN_STICK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_CROUCH_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SECONDARYATTACK_CROUCH_MP40 ); - - // Hand Signals - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_MG42 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_STICKGRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_IDLE_K98 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_30CAL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_BAZOOKA ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_PSCHRECK ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_KNIFE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_MG42 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_STICKGRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_TOMMY ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_MP44 ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_HS_CROUCH_K98 ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_STAND_IDLE_TNT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCH_IDLE_TNT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_CROUCHWALK_IDLE_TNT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_WALK_IDLE_TNT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_RUN_IDLE_TNT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_SPRINT_IDLE_TNT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PRONEWALK_IDLE_TNT ); - - REGISTER_SHARED_ACTIVITY ( ACT_DOD_PLANT_TNT ); - REGISTER_SHARED_ACTIVITY ( ACT_DOD_DEFUSE_TNT ); - -//HL2MP - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_PISTOL ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_PISTOL ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_SMG1 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_SMG1 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_SMG1 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_SMG1 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_SMG1 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_SMG1 ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_AR2 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_AR2 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_AR2 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_AR2 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_AR2 ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_AR2 ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_SHOTGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_SHOTGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_SHOTGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_SHOTGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_SHOTGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_SHOTGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_SHOTGUN ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_RPG ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_RPG ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_RPG ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_RPG ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_RPG ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_RPG ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_RPG ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_GRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_GRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_GRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_GRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_GRENADE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_GRENADE ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_PHYSGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_PHYSGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_PHYSGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_PHYSGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_PHYSGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_PHYSGUN ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_PHYSGUN ); - - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROSSBOW ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_CROSSBOW ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_CROSSBOW ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_CROSSBOW ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_CROSSBOW ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_CROSSBOW ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_MELEE ); REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_MELEE ); REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_MELEE ); @@ -1468,14 +792,6 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_MELEE ); REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_MELEE ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_SLAM ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_RUN_SLAM ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_IDLE_CROUCH_SLAM ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_WALK_CROUCH_SLAM ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RANGE_ATTACK_SLAM ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_SLAM ); - REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_SLAM ); - // Portal REGISTER_SHARED_ACTIVITY ( ACT_VM_FIZZLE ); @@ -1635,11 +951,53 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY ( ACT_MP_ATTACK_SWIM_GRENADE_MELEE ); REGISTER_SHARED_ACTIVITY ( ACT_MP_ATTACK_AIRWALK_GRENADE_MELEE ); + // Item1 + REGISTER_SHARED_ACTIVITY( ACT_MP_STAND_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_CROUCH_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_RUN_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_WALK_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_AIRWALK_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_CROUCHWALK_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_START_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_FLOAT_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_LAND_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_SWIM_ITEM1 ); + + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_STAND_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_STAND_ITEM1_SECONDARY ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_CROUCH_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_CROUCH_ITEM1_SECONDARY ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_SWIM_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_AIRWALK_ITEM1 ); + + // Item2 + REGISTER_SHARED_ACTIVITY( ACT_MP_STAND_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_CROUCH_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_RUN_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_WALK_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_AIRWALK_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_CROUCHWALK_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_START_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_FLOAT_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_JUMP_LAND_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_SWIM_ITEM2 ); + + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_STAND_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_STAND_ITEM2_SECONDARY ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_CROUCH_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_CROUCH_ITEM2_SECONDARY ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_SWIM_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_ATTACK_AIRWALK_ITEM2 ); + // Flinches REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH_PRIMARY ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH_SECONDARY ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH_MELEE ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH_ITEM2 ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH_HEAD ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_FLINCH_CHEST ); @@ -1678,6 +1036,19 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY ( ACT_MP_MELEE_GRENADE2_IDLE ); REGISTER_SHARED_ACTIVITY ( ACT_MP_MELEE_GRENADE2_ATTACK ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM1_GRENADE1_DRAW ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM1_GRENADE1_IDLE ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM1_GRENADE1_ATTACK ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM1_GRENADE2_DRAW ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM1_GRENADE2_IDLE ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM1_GRENADE2_ATTACK ); + + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM2_GRENADE1_DRAW ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM2_GRENADE1_IDLE ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM2_GRENADE1_ATTACK ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM2_GRENADE2_DRAW ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM2_GRENADE2_IDLE ); + REGISTER_SHARED_ACTIVITY ( ACT_MP_ITEM2_GRENADE2_ATTACK ); // Building REGISTER_SHARED_ACTIVITY ( ACT_MP_STAND_BUILDING ); @@ -1746,6 +1117,20 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_NODYES_MELEE ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_NODNO_MELEE ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_HANDMOUTH_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_FINGERPOINT_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_FISTPUMP_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_THUMBSUP_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_NODYES_ITEM1 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_NODNO_ITEM1 ); + + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_HANDMOUTH_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_FINGERPOINT_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_FISTPUMP_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_THUMBSUP_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_NODYES_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_NODNO_ITEM2 ); + REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_HANDMOUTH_BUILDING ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_FINGERPOINT_BUILDING ); REGISTER_SHARED_ACTIVITY( ACT_MP_GESTURE_VC_FISTPUMP_BUILDING ); @@ -1812,6 +1197,78 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY( ACT_PDA_VM_IDLE_LOWERED ); REGISTER_SHARED_ACTIVITY( ACT_PDA_VM_LOWERED_TO_IDLE ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_DRAW ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_HOLSTER ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_IDLE ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_PULLBACK ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_PRIMARYATTACK ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_SECONDARYATTACK ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_RELOAD ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_DRYFIRE ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_IDLE_TO_LOWERED ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_IDLE_LOWERED ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM1_VM_LOWERED_TO_IDLE ); + + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_DRAW ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_HOLSTER ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_IDLE ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_PULLBACK ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_PRIMARYATTACK ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_SECONDARYATTACK ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_RELOAD ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_DRYFIRE ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_IDLE_TO_LOWERED ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_IDLE_LOWERED ); + REGISTER_SHARED_ACTIVITY( ACT_ITEM2_VM_LOWERED_TO_IDLE ); + + // infested + REGISTER_SHARED_ACTIVITY( ACT_RELOAD_SUCCEED ); + REGISTER_SHARED_ACTIVITY( ACT_RELOAD_FAIL ); + REGISTER_SHARED_ACTIVITY( ACT_WALK_AIM_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_RUN_AIM_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_AIM_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_RELOAD_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_CROUCH_IDLE_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_RANGE_ATTACK_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_JUMP_AUTOGUN ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_AIM_PISTOL ); + REGISTER_SHARED_ACTIVITY( ACT_WALK_AIM_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_RUN_AIM_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_AIM_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_RELOAD_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_CROUCH_IDLE_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_RANGE_ATTACK_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_JUMP_DUAL ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_SHOTGUN ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_AIM_SHOTGUN ); + REGISTER_SHARED_ACTIVITY( ACT_CROUCH_IDLE_SHOTGUN ); + REGISTER_SHARED_ACTIVITY( ACT_JUMP_SHOTGUN ); + REGISTER_SHARED_ACTIVITY( ACT_IDLE_AIM_RIFLE ); + REGISTER_SHARED_ACTIVITY( ACT_RELOAD_RIFLE ); + REGISTER_SHARED_ACTIVITY( ACT_CROUCH_IDLE_RIFLE ); + REGISTER_SHARED_ACTIVITY( ACT_RANGE_ATTACK_RIFLE ); + REGISTER_SHARED_ACTIVITY( ACT_JUMP_RIFLE ); + // Infested General AI + REGISTER_SHARED_ACTIVITY( ACT_SLEEP ); + REGISTER_SHARED_ACTIVITY( ACT_WAKE ); + // Shield Bug + REGISTER_SHARED_ACTIVITY( ACT_FLICK_LEFT ); + REGISTER_SHARED_ACTIVITY( ACT_FLICK_LEFT_MIDDLE ); + REGISTER_SHARED_ACTIVITY( ACT_FLICK_RIGHT_MIDDLE ); + REGISTER_SHARED_ACTIVITY( ACT_FLICK_RIGHT ); + REGISTER_SHARED_ACTIVITY( ACT_SPINAROUND ); + // Mortar Bug + REGISTER_SHARED_ACTIVITY( ACT_PREP_TO_FIRE ); + REGISTER_SHARED_ACTIVITY( ACT_FIRE ); + REGISTER_SHARED_ACTIVITY( ACT_FIRE_RECOVER ); + // Shaman + REGISTER_SHARED_ACTIVITY( ACT_SPRAY ); + // Boomer + REGISTER_SHARED_ACTIVITY( ACT_PREP_EXPLODE ); + REGISTER_SHARED_ACTIVITY( ACT_EXPLODE ); + AssertMsg( g_HighestActivity == LAST_SHARED_ACTIVITY - 1, "Not all activities from ai_activity.h registered in activitylist.cpp" ); } @@ -1914,7 +1371,6 @@ void UTIL_LoadActivityRemapFile( const char *filename, const char *section, CUtl KeyValues *pRemapKey = pTestKey->GetFirstSubKey(); CActivityRemap actMap; - actMap.mappedActivity = ACT_IDLE; actMap.activity = ActBase; while ( pRemapKey ) diff --git a/game/shared/ai_activity.h b/game/shared/ai_activity.h index 71c7e77e7..ddfb415ec 100644 --- a/game/shared/ai_activity.h +++ b/game/shared/ai_activity.h @@ -64,6 +64,9 @@ typedef enum ACT_CROUCHIDLE, // FIXME: obsolete? only used be soldier (holding body in crouched position (loops)) ACT_STAND, // FIXME: obsolete? should be transition (the act of standing from a crouched position) ACT_USE, + ACT_ALIEN_BURROW_IDLE, + ACT_ALIEN_BURROW_OUT, + ACT_SIGNAL1, ACT_SIGNAL2, ACT_SIGNAL3, @@ -150,6 +153,13 @@ typedef enum ACT_FLINCH_LEFTLEG, ACT_FLINCH_RIGHTLEG, ACT_FLINCH_PHYSICS, + ACT_FLINCH_HEAD_BACK, + ACT_FLINCH_CHEST_BACK, + ACT_FLINCH_STOMACH_BACK, + ACT_FLINCH_CROUCH_FRONT, + ACT_FLINCH_CROUCH_BACK, + ACT_FLINCH_CROUCH_LEFT, + ACT_FLINCH_CROUCH_RIGHT, ACT_IDLE_ON_FIRE, // ON FIRE animations ACT_WALK_ON_FIRE, @@ -214,6 +224,8 @@ typedef enum // with the NPC's current sequence. (SJB) ACT_DO_NOT_DISTURB, + ACT_SPECIFIC_SEQUENCE, + // viewmodel (weapon) activities // FIXME: move these to the specific viewmodels, no need to make global ACT_VM_DRAW, @@ -570,45 +582,13 @@ typedef enum ACT_DEPLOY_IDLE, ACT_UNDEPLOY, -//=========================== -// HL1 Specific Activities -//=========================== - // Grenades - ACT_GRENADE_ROLL, - ACT_GRENADE_TOSS, - - // Hand grenade - ACT_HANDGRENADE_THROW1, - ACT_HANDGRENADE_THROW2, - ACT_HANDGRENADE_THROW3, - - // Shotgun - ACT_SHOTGUN_IDLE_DEEP, - ACT_SHOTGUN_IDLE4, - - // Glock - ACT_GLOCK_SHOOTEMPTY, - ACT_GLOCK_SHOOT_RELOAD, - - // RPG - ACT_RPG_DRAW_UNLOADED, - ACT_RPG_HOLSTER_UNLOADED, - ACT_RPG_IDLE_UNLOADED, - ACT_RPG_FIDGET_UNLOADED, - // Crossbow ACT_CROSSBOW_DRAW_UNLOADED, - ACT_CROSSBOW_IDLE_UNLOADED, - ACT_CROSSBOW_FIDGET_UNLOADED, // Gauss ACT_GAUSS_SPINUP, ACT_GAUSS_SPINCYCLE, - // Tripmine - ACT_TRIPMINE_GROUND, - ACT_TRIPMINE_WORLD, - //=========================== // CSPort Specific Activities //=========================== @@ -621,6 +601,12 @@ typedef enum ACT_VM_IDLE_EMPTY_LEFT, ACT_VM_DRYFIRE_LEFT, + // new for CS2 + ACT_VM_IS_DRAW, + ACT_VM_IS_HOLSTER, + ACT_VM_IS_IDLE, + ACT_VM_IS_PRIMARYATTACK, + ACT_PLAYER_IDLE_FIRE, ACT_PLAYER_CROUCH_FIRE, ACT_PLAYER_CROUCH_WALK_FIRE, @@ -630,664 +616,8 @@ typedef enum ACT_IDLETORUN, ACT_RUNTOIDLE, - -//=========================== -// DoD Specific Activities -//=========================== - ACT_SPRINT, - - ACT_GET_DOWN_STAND, - ACT_GET_UP_STAND, - ACT_GET_DOWN_CROUCH, - ACT_GET_UP_CROUCH, - ACT_PRONE_FORWARD, - ACT_PRONE_IDLE, - - ACT_DEEPIDLE1, - ACT_DEEPIDLE2, - ACT_DEEPIDLE3, - ACT_DEEPIDLE4, - - ACT_VM_RELOAD_DEPLOYED, - ACT_VM_RELOAD_IDLE, - ACT_VM_DRAW_DEPLOYED, - //Weapon is empty activities - ACT_VM_DRAW_EMPTY, - ACT_VM_PRIMARYATTACK_EMPTY, - ACT_VM_RELOAD_EMPTY, - ACT_VM_IDLE_EMPTY, - ACT_VM_IDLE_DEPLOYED_EMPTY, - - ACT_VM_IDLE_8, - ACT_VM_IDLE_7, - ACT_VM_IDLE_6, - ACT_VM_IDLE_5, - ACT_VM_IDLE_4, - ACT_VM_IDLE_3, - ACT_VM_IDLE_2, - ACT_VM_IDLE_1, - - ACT_VM_IDLE_DEPLOYED, - ACT_VM_IDLE_DEPLOYED_8, - ACT_VM_IDLE_DEPLOYED_7, - ACT_VM_IDLE_DEPLOYED_6, - ACT_VM_IDLE_DEPLOYED_5, - ACT_VM_IDLE_DEPLOYED_4, - ACT_VM_IDLE_DEPLOYED_3, - ACT_VM_IDLE_DEPLOYED_2, - ACT_VM_IDLE_DEPLOYED_1, - - // Animation from prone idle to standing/crouch idle. Number designates bullets left - ACT_VM_UNDEPLOY, - ACT_VM_UNDEPLOY_8, - ACT_VM_UNDEPLOY_7, - ACT_VM_UNDEPLOY_6, - ACT_VM_UNDEPLOY_5, - ACT_VM_UNDEPLOY_4, - ACT_VM_UNDEPLOY_3, - ACT_VM_UNDEPLOY_2, - ACT_VM_UNDEPLOY_1, - ACT_VM_UNDEPLOY_EMPTY, - - // Animation from standing/crouch idle to prone idle. Number designates bullets left - ACT_VM_DEPLOY, - ACT_VM_DEPLOY_8, - ACT_VM_DEPLOY_7, - ACT_VM_DEPLOY_6, - ACT_VM_DEPLOY_5, - ACT_VM_DEPLOY_4, - ACT_VM_DEPLOY_3, - ACT_VM_DEPLOY_2, - ACT_VM_DEPLOY_1, - ACT_VM_DEPLOY_EMPTY, - - // Shooting animations for standing/crouch position. Number designates bullets left at START of animation - ACT_VM_PRIMARYATTACK_8, - ACT_VM_PRIMARYATTACK_7, - ACT_VM_PRIMARYATTACK_6, - ACT_VM_PRIMARYATTACK_5, - ACT_VM_PRIMARYATTACK_4, - ACT_VM_PRIMARYATTACK_3, - ACT_VM_PRIMARYATTACK_2, - ACT_VM_PRIMARYATTACK_1, - - // Shooting animations for prone position. Number designates bullets left at START of animation - ACT_VM_PRIMARYATTACK_DEPLOYED, - ACT_VM_PRIMARYATTACK_DEPLOYED_8, - ACT_VM_PRIMARYATTACK_DEPLOYED_7, - ACT_VM_PRIMARYATTACK_DEPLOYED_6, - ACT_VM_PRIMARYATTACK_DEPLOYED_5, - ACT_VM_PRIMARYATTACK_DEPLOYED_4, - ACT_VM_PRIMARYATTACK_DEPLOYED_3, - ACT_VM_PRIMARYATTACK_DEPLOYED_2, - ACT_VM_PRIMARYATTACK_DEPLOYED_1, - ACT_VM_PRIMARYATTACK_DEPLOYED_EMPTY, - - // Player anim ACTs - ACT_DOD_DEPLOYED, - ACT_DOD_PRONE_DEPLOYED, - ACT_DOD_IDLE_ZOOMED, - ACT_DOD_WALK_ZOOMED, - ACT_DOD_CROUCH_ZOOMED, - ACT_DOD_CROUCHWALK_ZOOMED, - ACT_DOD_PRONE_ZOOMED, - ACT_DOD_PRONE_FORWARD_ZOOMED, - ACT_DOD_PRIMARYATTACK_DEPLOYED, - ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED, - ACT_DOD_RELOAD_DEPLOYED, - ACT_DOD_RELOAD_PRONE_DEPLOYED, - ACT_DOD_PRIMARYATTACK_PRONE, - ACT_DOD_SECONDARYATTACK_PRONE, - ACT_DOD_RELOAD_CROUCH, - ACT_DOD_RELOAD_PRONE, - ACT_DOD_STAND_IDLE, - ACT_DOD_STAND_AIM, - ACT_DOD_CROUCH_IDLE, - ACT_DOD_CROUCH_AIM, - ACT_DOD_CROUCHWALK_IDLE, - ACT_DOD_CROUCHWALK_AIM, - ACT_DOD_WALK_IDLE, - ACT_DOD_WALK_AIM, - ACT_DOD_RUN_IDLE, - ACT_DOD_RUN_AIM, - - // Positions - ACT_DOD_STAND_AIM_PISTOL, - ACT_DOD_CROUCH_AIM_PISTOL, - ACT_DOD_CROUCHWALK_AIM_PISTOL, - ACT_DOD_WALK_AIM_PISTOL, - ACT_DOD_RUN_AIM_PISTOL, - ACT_DOD_PRONE_AIM_PISTOL, - ACT_DOD_STAND_IDLE_PISTOL, - ACT_DOD_CROUCH_IDLE_PISTOL, - ACT_DOD_CROUCHWALK_IDLE_PISTOL, - ACT_DOD_WALK_IDLE_PISTOL, - ACT_DOD_RUN_IDLE_PISTOL, - ACT_DOD_SPRINT_IDLE_PISTOL, - ACT_DOD_PRONEWALK_IDLE_PISTOL, - - ACT_DOD_STAND_AIM_C96, - ACT_DOD_CROUCH_AIM_C96, - ACT_DOD_CROUCHWALK_AIM_C96, - ACT_DOD_WALK_AIM_C96, - ACT_DOD_RUN_AIM_C96, - ACT_DOD_PRONE_AIM_C96, - ACT_DOD_STAND_IDLE_C96, - ACT_DOD_CROUCH_IDLE_C96, - ACT_DOD_CROUCHWALK_IDLE_C96, - ACT_DOD_WALK_IDLE_C96, - ACT_DOD_RUN_IDLE_C96, - ACT_DOD_SPRINT_IDLE_C96, - ACT_DOD_PRONEWALK_IDLE_C96, - - ACT_DOD_STAND_AIM_RIFLE, - ACT_DOD_CROUCH_AIM_RIFLE, - ACT_DOD_CROUCHWALK_AIM_RIFLE, - ACT_DOD_WALK_AIM_RIFLE, - ACT_DOD_RUN_AIM_RIFLE, - ACT_DOD_PRONE_AIM_RIFLE, - ACT_DOD_STAND_IDLE_RIFLE, - ACT_DOD_CROUCH_IDLE_RIFLE, - ACT_DOD_CROUCHWALK_IDLE_RIFLE, - ACT_DOD_WALK_IDLE_RIFLE, - ACT_DOD_RUN_IDLE_RIFLE, - ACT_DOD_SPRINT_IDLE_RIFLE, - ACT_DOD_PRONEWALK_IDLE_RIFLE, - - ACT_DOD_STAND_AIM_BOLT, - ACT_DOD_CROUCH_AIM_BOLT, - ACT_DOD_CROUCHWALK_AIM_BOLT, - ACT_DOD_WALK_AIM_BOLT, - ACT_DOD_RUN_AIM_BOLT, - ACT_DOD_PRONE_AIM_BOLT, - ACT_DOD_STAND_IDLE_BOLT, - ACT_DOD_CROUCH_IDLE_BOLT, - ACT_DOD_CROUCHWALK_IDLE_BOLT, - ACT_DOD_WALK_IDLE_BOLT, - ACT_DOD_RUN_IDLE_BOLT, - ACT_DOD_SPRINT_IDLE_BOLT, - ACT_DOD_PRONEWALK_IDLE_BOLT, - - ACT_DOD_STAND_AIM_TOMMY, - ACT_DOD_CROUCH_AIM_TOMMY, - ACT_DOD_CROUCHWALK_AIM_TOMMY, - ACT_DOD_WALK_AIM_TOMMY, - ACT_DOD_RUN_AIM_TOMMY, - ACT_DOD_PRONE_AIM_TOMMY, - ACT_DOD_STAND_IDLE_TOMMY, - ACT_DOD_CROUCH_IDLE_TOMMY, - ACT_DOD_CROUCHWALK_IDLE_TOMMY, - ACT_DOD_WALK_IDLE_TOMMY, - ACT_DOD_RUN_IDLE_TOMMY, - ACT_DOD_SPRINT_IDLE_TOMMY, - ACT_DOD_PRONEWALK_IDLE_TOMMY, - - ACT_DOD_STAND_AIM_MP40, - ACT_DOD_CROUCH_AIM_MP40, - ACT_DOD_CROUCHWALK_AIM_MP40, - ACT_DOD_WALK_AIM_MP40, - ACT_DOD_RUN_AIM_MP40, - ACT_DOD_PRONE_AIM_MP40, - ACT_DOD_STAND_IDLE_MP40, - ACT_DOD_CROUCH_IDLE_MP40, - ACT_DOD_CROUCHWALK_IDLE_MP40, - ACT_DOD_WALK_IDLE_MP40, - ACT_DOD_RUN_IDLE_MP40, - ACT_DOD_SPRINT_IDLE_MP40, - ACT_DOD_PRONEWALK_IDLE_MP40, - - ACT_DOD_STAND_AIM_MP44, - ACT_DOD_CROUCH_AIM_MP44, - ACT_DOD_CROUCHWALK_AIM_MP44, - ACT_DOD_WALK_AIM_MP44, - ACT_DOD_RUN_AIM_MP44, - ACT_DOD_PRONE_AIM_MP44, - ACT_DOD_STAND_IDLE_MP44, - ACT_DOD_CROUCH_IDLE_MP44, - ACT_DOD_CROUCHWALK_IDLE_MP44, - ACT_DOD_WALK_IDLE_MP44, - ACT_DOD_RUN_IDLE_MP44, - ACT_DOD_SPRINT_IDLE_MP44, - ACT_DOD_PRONEWALK_IDLE_MP44, - - ACT_DOD_STAND_AIM_GREASE, - ACT_DOD_CROUCH_AIM_GREASE, - ACT_DOD_CROUCHWALK_AIM_GREASE, - ACT_DOD_WALK_AIM_GREASE, - ACT_DOD_RUN_AIM_GREASE, - ACT_DOD_PRONE_AIM_GREASE, - ACT_DOD_STAND_IDLE_GREASE, - ACT_DOD_CROUCH_IDLE_GREASE, - ACT_DOD_CROUCHWALK_IDLE_GREASE, - ACT_DOD_WALK_IDLE_GREASE, - ACT_DOD_RUN_IDLE_GREASE, - ACT_DOD_SPRINT_IDLE_GREASE, - ACT_DOD_PRONEWALK_IDLE_GREASE, - - ACT_DOD_STAND_AIM_MG, - ACT_DOD_CROUCH_AIM_MG, - ACT_DOD_CROUCHWALK_AIM_MG, - ACT_DOD_WALK_AIM_MG, - ACT_DOD_RUN_AIM_MG, - ACT_DOD_PRONE_AIM_MG, - ACT_DOD_STAND_IDLE_MG, - ACT_DOD_CROUCH_IDLE_MG, - ACT_DOD_CROUCHWALK_IDLE_MG, - ACT_DOD_WALK_IDLE_MG, - ACT_DOD_RUN_IDLE_MG, - ACT_DOD_SPRINT_IDLE_MG, - ACT_DOD_PRONEWALK_IDLE_MG, - - ACT_DOD_STAND_AIM_30CAL, - ACT_DOD_CROUCH_AIM_30CAL, - ACT_DOD_CROUCHWALK_AIM_30CAL, - ACT_DOD_WALK_AIM_30CAL, - ACT_DOD_RUN_AIM_30CAL, - ACT_DOD_PRONE_AIM_30CAL, - ACT_DOD_STAND_IDLE_30CAL, - ACT_DOD_CROUCH_IDLE_30CAL, - ACT_DOD_CROUCHWALK_IDLE_30CAL, - ACT_DOD_WALK_IDLE_30CAL, - ACT_DOD_RUN_IDLE_30CAL, - ACT_DOD_SPRINT_IDLE_30CAL, - ACT_DOD_PRONEWALK_IDLE_30CAL, - - ACT_DOD_STAND_AIM_GREN_FRAG, - ACT_DOD_CROUCH_AIM_GREN_FRAG, - ACT_DOD_CROUCHWALK_AIM_GREN_FRAG, - ACT_DOD_WALK_AIM_GREN_FRAG, - ACT_DOD_RUN_AIM_GREN_FRAG, - ACT_DOD_PRONE_AIM_GREN_FRAG, - ACT_DOD_SPRINT_AIM_GREN_FRAG, - ACT_DOD_PRONEWALK_AIM_GREN_FRAG, - ACT_DOD_STAND_AIM_GREN_STICK, - ACT_DOD_CROUCH_AIM_GREN_STICK, - ACT_DOD_CROUCHWALK_AIM_GREN_STICK, - ACT_DOD_WALK_AIM_GREN_STICK, - ACT_DOD_RUN_AIM_GREN_STICK, - ACT_DOD_PRONE_AIM_GREN_STICK, - ACT_DOD_SPRINT_AIM_GREN_STICK, - ACT_DOD_PRONEWALK_AIM_GREN_STICK, - - ACT_DOD_STAND_AIM_KNIFE, - ACT_DOD_CROUCH_AIM_KNIFE, - ACT_DOD_CROUCHWALK_AIM_KNIFE, - ACT_DOD_WALK_AIM_KNIFE, - ACT_DOD_RUN_AIM_KNIFE, - ACT_DOD_PRONE_AIM_KNIFE, - ACT_DOD_SPRINT_AIM_KNIFE, - ACT_DOD_PRONEWALK_AIM_KNIFE, - - ACT_DOD_STAND_AIM_SPADE, - ACT_DOD_CROUCH_AIM_SPADE, - ACT_DOD_CROUCHWALK_AIM_SPADE, - ACT_DOD_WALK_AIM_SPADE, - ACT_DOD_RUN_AIM_SPADE, - ACT_DOD_PRONE_AIM_SPADE, - ACT_DOD_SPRINT_AIM_SPADE, - ACT_DOD_PRONEWALK_AIM_SPADE, - - ACT_DOD_STAND_AIM_BAZOOKA, - ACT_DOD_CROUCH_AIM_BAZOOKA, - ACT_DOD_CROUCHWALK_AIM_BAZOOKA, - ACT_DOD_WALK_AIM_BAZOOKA, - ACT_DOD_RUN_AIM_BAZOOKA, - ACT_DOD_PRONE_AIM_BAZOOKA, - ACT_DOD_STAND_IDLE_BAZOOKA, - ACT_DOD_CROUCH_IDLE_BAZOOKA, - ACT_DOD_CROUCHWALK_IDLE_BAZOOKA, - ACT_DOD_WALK_IDLE_BAZOOKA, - ACT_DOD_RUN_IDLE_BAZOOKA, - ACT_DOD_SPRINT_IDLE_BAZOOKA, - ACT_DOD_PRONEWALK_IDLE_BAZOOKA, - - ACT_DOD_STAND_AIM_PSCHRECK, - ACT_DOD_CROUCH_AIM_PSCHRECK, - ACT_DOD_CROUCHWALK_AIM_PSCHRECK, - ACT_DOD_WALK_AIM_PSCHRECK, - ACT_DOD_RUN_AIM_PSCHRECK, - ACT_DOD_PRONE_AIM_PSCHRECK, - ACT_DOD_STAND_IDLE_PSCHRECK, - ACT_DOD_CROUCH_IDLE_PSCHRECK, - ACT_DOD_CROUCHWALK_IDLE_PSCHRECK, - ACT_DOD_WALK_IDLE_PSCHRECK, - ACT_DOD_RUN_IDLE_PSCHRECK, - ACT_DOD_SPRINT_IDLE_PSCHRECK, - ACT_DOD_PRONEWALK_IDLE_PSCHRECK, - - ACT_DOD_STAND_AIM_BAR, - ACT_DOD_CROUCH_AIM_BAR, - ACT_DOD_CROUCHWALK_AIM_BAR, - ACT_DOD_WALK_AIM_BAR, - ACT_DOD_RUN_AIM_BAR, - ACT_DOD_PRONE_AIM_BAR, - ACT_DOD_STAND_IDLE_BAR, - ACT_DOD_CROUCH_IDLE_BAR, - ACT_DOD_CROUCHWALK_IDLE_BAR, - ACT_DOD_WALK_IDLE_BAR, - ACT_DOD_RUN_IDLE_BAR, - ACT_DOD_SPRINT_IDLE_BAR, - ACT_DOD_PRONEWALK_IDLE_BAR, - - // Zoomed aims - ACT_DOD_STAND_ZOOM_RIFLE, - ACT_DOD_CROUCH_ZOOM_RIFLE, - ACT_DOD_CROUCHWALK_ZOOM_RIFLE, - ACT_DOD_WALK_ZOOM_RIFLE, - ACT_DOD_RUN_ZOOM_RIFLE, - ACT_DOD_PRONE_ZOOM_RIFLE, - - ACT_DOD_STAND_ZOOM_BOLT, - ACT_DOD_CROUCH_ZOOM_BOLT, - ACT_DOD_CROUCHWALK_ZOOM_BOLT, - ACT_DOD_WALK_ZOOM_BOLT, - ACT_DOD_RUN_ZOOM_BOLT, - ACT_DOD_PRONE_ZOOM_BOLT, - - ACT_DOD_STAND_ZOOM_BAZOOKA, - ACT_DOD_CROUCH_ZOOM_BAZOOKA, - ACT_DOD_CROUCHWALK_ZOOM_BAZOOKA, - ACT_DOD_WALK_ZOOM_BAZOOKA, - ACT_DOD_RUN_ZOOM_BAZOOKA, - ACT_DOD_PRONE_ZOOM_BAZOOKA, - - ACT_DOD_STAND_ZOOM_PSCHRECK, - ACT_DOD_CROUCH_ZOOM_PSCHRECK, - ACT_DOD_CROUCHWALK_ZOOM_PSCHRECK, - ACT_DOD_WALK_ZOOM_PSCHRECK, - ACT_DOD_RUN_ZOOM_PSCHRECK, - ACT_DOD_PRONE_ZOOM_PSCHRECK, - - // Deployed Aim - ACT_DOD_DEPLOY_RIFLE, - ACT_DOD_DEPLOY_TOMMY, - ACT_DOD_DEPLOY_MG, - ACT_DOD_DEPLOY_30CAL, - - // Prone Deployed Aim - ACT_DOD_PRONE_DEPLOY_RIFLE , - ACT_DOD_PRONE_DEPLOY_TOMMY, - ACT_DOD_PRONE_DEPLOY_MG, - ACT_DOD_PRONE_DEPLOY_30CAL, - - // Attacks - - // Rifle - ACT_DOD_PRIMARYATTACK_RIFLE, - ACT_DOD_SECONDARYATTACK_RIFLE, - ACT_DOD_PRIMARYATTACK_PRONE_RIFLE, - ACT_DOD_SECONDARYATTACK_PRONE_RIFLE, - ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_RIFLE, - ACT_DOD_PRIMARYATTACK_DEPLOYED_RIFLE, - - // Bolt - ACT_DOD_PRIMARYATTACK_BOLT, - ACT_DOD_SECONDARYATTACK_BOLT, - ACT_DOD_PRIMARYATTACK_PRONE_BOLT , - ACT_DOD_SECONDARYATTACK_PRONE_BOLT , - - // Tommy - ACT_DOD_PRIMARYATTACK_TOMMY, - ACT_DOD_PRIMARYATTACK_PRONE_TOMMY, - ACT_DOD_SECONDARYATTACK_TOMMY, - ACT_DOD_SECONDARYATTACK_PRONE_TOMMY, - - // MP40 - ACT_DOD_PRIMARYATTACK_MP40, - ACT_DOD_PRIMARYATTACK_PRONE_MP40 , - ACT_DOD_SECONDARYATTACK_MP40, - ACT_DOD_SECONDARYATTACK_PRONE_MP40 , - - // MP44 - ACT_DOD_PRIMARYATTACK_MP44, - ACT_DOD_PRIMARYATTACK_PRONE_MP44 , - - // Greasegun - ACT_DOD_PRIMARYATTACK_GREASE, - ACT_DOD_PRIMARYATTACK_PRONE_GREASE , - - // Pistols (Colt, Luger) - ACT_DOD_PRIMARYATTACK_PISTOL, - ACT_DOD_PRIMARYATTACK_PRONE_PISTOL , - ACT_DOD_PRIMARYATTACK_C96, - ACT_DOD_PRIMARYATTACK_PRONE_C96, - - // Mgs (mg42, mg34) - ACT_DOD_PRIMARYATTACK_MG, - ACT_DOD_PRIMARYATTACK_PRONE_MG , - ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_MG , - ACT_DOD_PRIMARYATTACK_DEPLOYED_MG , - - // 30cal - ACT_DOD_PRIMARYATTACK_30CAL, - ACT_DOD_PRIMARYATTACK_PRONE_30CAL, - ACT_DOD_PRIMARYATTACK_DEPLOYED_30CAL, - ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_30CAL , - - // Grenades - ACT_DOD_PRIMARYATTACK_GREN_FRAG, - ACT_DOD_PRIMARYATTACK_PRONE_GREN_FRAG, - ACT_DOD_PRIMARYATTACK_GREN_STICK, - ACT_DOD_PRIMARYATTACK_PRONE_GREN_STICK, - - // Knife - ACT_DOD_PRIMARYATTACK_KNIFE, - ACT_DOD_PRIMARYATTACK_PRONE_KNIFE, - - // Spade - ACT_DOD_PRIMARYATTACK_SPADE, - ACT_DOD_PRIMARYATTACK_PRONE_SPADE, - - // Bazooka - ACT_DOD_PRIMARYATTACK_BAZOOKA, - ACT_DOD_PRIMARYATTACK_PRONE_BAZOOKA, - - // Pschreck - ACT_DOD_PRIMARYATTACK_PSCHRECK, - ACT_DOD_PRIMARYATTACK_PRONE_PSCHRECK , - - // Bar - ACT_DOD_PRIMARYATTACK_BAR, - ACT_DOD_PRIMARYATTACK_PRONE_BAR, - - // Reloads - ACT_DOD_RELOAD_GARAND, - ACT_DOD_RELOAD_K43, - ACT_DOD_RELOAD_BAR, - ACT_DOD_RELOAD_MP40, - ACT_DOD_RELOAD_MP44, - ACT_DOD_RELOAD_BOLT, - ACT_DOD_RELOAD_M1CARBINE, - ACT_DOD_RELOAD_TOMMY, - ACT_DOD_RELOAD_GREASEGUN, - ACT_DOD_RELOAD_PISTOL, - ACT_DOD_RELOAD_FG42, - ACT_DOD_RELOAD_RIFLE, - ACT_DOD_RELOAD_RIFLEGRENADE, - ACT_DOD_RELOAD_C96, - - // Crouch - ACT_DOD_RELOAD_CROUCH_BAR, - ACT_DOD_RELOAD_CROUCH_RIFLE, - ACT_DOD_RELOAD_CROUCH_RIFLEGRENADE, - ACT_DOD_RELOAD_CROUCH_BOLT, - ACT_DOD_RELOAD_CROUCH_MP44, - ACT_DOD_RELOAD_CROUCH_MP40, - ACT_DOD_RELOAD_CROUCH_TOMMY, - ACT_DOD_RELOAD_CROUCH_BAZOOKA, - ACT_DOD_RELOAD_CROUCH_PSCHRECK, - ACT_DOD_RELOAD_CROUCH_PISTOL, - ACT_DOD_RELOAD_CROUCH_M1CARBINE, - ACT_DOD_RELOAD_CROUCH_C96, - - // Bazookas - ACT_DOD_RELOAD_BAZOOKA, - ACT_DOD_ZOOMLOAD_BAZOOKA, - ACT_DOD_RELOAD_PSCHRECK, - ACT_DOD_ZOOMLOAD_PSCHRECK, - - // Deployed - ACT_DOD_RELOAD_DEPLOYED_FG42, - ACT_DOD_RELOAD_DEPLOYED_30CAL, - ACT_DOD_RELOAD_DEPLOYED_MG, - ACT_DOD_RELOAD_DEPLOYED_MG34, - ACT_DOD_RELOAD_DEPLOYED_BAR, - - // Prone - ACT_DOD_RELOAD_PRONE_PISTOL, - ACT_DOD_RELOAD_PRONE_GARAND, - ACT_DOD_RELOAD_PRONE_M1CARBINE, - ACT_DOD_RELOAD_PRONE_BOLT, - ACT_DOD_RELOAD_PRONE_K43, - ACT_DOD_RELOAD_PRONE_MP40, - ACT_DOD_RELOAD_PRONE_MP44, - ACT_DOD_RELOAD_PRONE_BAR, - ACT_DOD_RELOAD_PRONE_GREASEGUN, - ACT_DOD_RELOAD_PRONE_TOMMY, - ACT_DOD_RELOAD_PRONE_FG42, - ACT_DOD_RELOAD_PRONE_RIFLE, - ACT_DOD_RELOAD_PRONE_RIFLEGRENADE, - ACT_DOD_RELOAD_PRONE_C96, - - // Prone bazooka - ACT_DOD_RELOAD_PRONE_BAZOOKA, - ACT_DOD_ZOOMLOAD_PRONE_BAZOOKA, - ACT_DOD_RELOAD_PRONE_PSCHRECK, - ACT_DOD_ZOOMLOAD_PRONE_PSCHRECK, - - // Prone deployed - ACT_DOD_RELOAD_PRONE_DEPLOYED_BAR, - ACT_DOD_RELOAD_PRONE_DEPLOYED_FG42, - ACT_DOD_RELOAD_PRONE_DEPLOYED_30CAL, - ACT_DOD_RELOAD_PRONE_DEPLOYED_MG, - ACT_DOD_RELOAD_PRONE_DEPLOYED_MG34, - - // Prone zoomed aim - ACT_DOD_PRONE_ZOOM_FORWARD_RIFLE, - ACT_DOD_PRONE_ZOOM_FORWARD_BOLT, - ACT_DOD_PRONE_ZOOM_FORWARD_BAZOOKA, - ACT_DOD_PRONE_ZOOM_FORWARD_PSCHRECK, - - // Crouch attack - ACT_DOD_PRIMARYATTACK_CROUCH, - ACT_DOD_PRIMARYATTACK_CROUCH_SPADE, - ACT_DOD_PRIMARYATTACK_CROUCH_KNIFE, - ACT_DOD_PRIMARYATTACK_CROUCH_GREN_FRAG, - ACT_DOD_PRIMARYATTACK_CROUCH_GREN_STICK, - ACT_DOD_SECONDARYATTACK_CROUCH, - ACT_DOD_SECONDARYATTACK_CROUCH_TOMMY, - ACT_DOD_SECONDARYATTACK_CROUCH_MP40, - - // Hand Signals - ACT_DOD_HS_IDLE, - ACT_DOD_HS_CROUCH, - ACT_DOD_HS_IDLE_30CAL, - ACT_DOD_HS_IDLE_BAZOOKA, - ACT_DOD_HS_IDLE_PSCHRECK, - ACT_DOD_HS_IDLE_KNIFE, - ACT_DOD_HS_IDLE_MG42, - ACT_DOD_HS_IDLE_PISTOL, - ACT_DOD_HS_IDLE_STICKGRENADE, - ACT_DOD_HS_IDLE_TOMMY, - ACT_DOD_HS_IDLE_MP44, - ACT_DOD_HS_IDLE_K98, - ACT_DOD_HS_CROUCH_30CAL, - ACT_DOD_HS_CROUCH_BAZOOKA, - ACT_DOD_HS_CROUCH_PSCHRECK, - ACT_DOD_HS_CROUCH_KNIFE, - ACT_DOD_HS_CROUCH_MG42, - ACT_DOD_HS_CROUCH_PISTOL, - ACT_DOD_HS_CROUCH_STICKGRENADE, - ACT_DOD_HS_CROUCH_TOMMY, - ACT_DOD_HS_CROUCH_MP44, - ACT_DOD_HS_CROUCH_K98, - - ACT_DOD_STAND_IDLE_TNT, - ACT_DOD_CROUCH_IDLE_TNT, - ACT_DOD_CROUCHWALK_IDLE_TNT, - ACT_DOD_WALK_IDLE_TNT, - ACT_DOD_RUN_IDLE_TNT, - ACT_DOD_SPRINT_IDLE_TNT, - ACT_DOD_PRONEWALK_IDLE_TNT, - - ACT_DOD_PLANT_TNT, - ACT_DOD_DEFUSE_TNT, - -// HL2MP - ACT_HL2MP_IDLE, - ACT_HL2MP_RUN, - ACT_HL2MP_IDLE_CROUCH, - ACT_HL2MP_WALK_CROUCH, - ACT_HL2MP_GESTURE_RANGE_ATTACK, - ACT_HL2MP_GESTURE_RELOAD, - ACT_HL2MP_JUMP, - - ACT_HL2MP_IDLE_PISTOL, - ACT_HL2MP_RUN_PISTOL, - ACT_HL2MP_IDLE_CROUCH_PISTOL, - ACT_HL2MP_WALK_CROUCH_PISTOL, - ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, - ACT_HL2MP_GESTURE_RELOAD_PISTOL, - ACT_HL2MP_JUMP_PISTOL, - - ACT_HL2MP_IDLE_SMG1, - ACT_HL2MP_RUN_SMG1, - ACT_HL2MP_IDLE_CROUCH_SMG1, - ACT_HL2MP_WALK_CROUCH_SMG1, - ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1, - ACT_HL2MP_GESTURE_RELOAD_SMG1, - ACT_HL2MP_JUMP_SMG1, - - ACT_HL2MP_IDLE_AR2, - ACT_HL2MP_RUN_AR2, - ACT_HL2MP_IDLE_CROUCH_AR2, - ACT_HL2MP_WALK_CROUCH_AR2, - ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2, - ACT_HL2MP_GESTURE_RELOAD_AR2, - ACT_HL2MP_JUMP_AR2, - - ACT_HL2MP_IDLE_SHOTGUN, - ACT_HL2MP_RUN_SHOTGUN, - ACT_HL2MP_IDLE_CROUCH_SHOTGUN, - ACT_HL2MP_WALK_CROUCH_SHOTGUN, - ACT_HL2MP_GESTURE_RANGE_ATTACK_SHOTGUN, - ACT_HL2MP_GESTURE_RELOAD_SHOTGUN, - ACT_HL2MP_JUMP_SHOTGUN, - - ACT_HL2MP_IDLE_RPG, - ACT_HL2MP_RUN_RPG, - ACT_HL2MP_IDLE_CROUCH_RPG, - ACT_HL2MP_WALK_CROUCH_RPG, - ACT_HL2MP_GESTURE_RANGE_ATTACK_RPG, - ACT_HL2MP_GESTURE_RELOAD_RPG, - ACT_HL2MP_JUMP_RPG, - - ACT_HL2MP_IDLE_GRENADE, - ACT_HL2MP_RUN_GRENADE, - ACT_HL2MP_IDLE_CROUCH_GRENADE, - ACT_HL2MP_WALK_CROUCH_GRENADE, - ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, - ACT_HL2MP_GESTURE_RELOAD_GRENADE, - ACT_HL2MP_JUMP_GRENADE, - - ACT_HL2MP_IDLE_PHYSGUN, - ACT_HL2MP_RUN_PHYSGUN, - ACT_HL2MP_IDLE_CROUCH_PHYSGUN, - ACT_HL2MP_WALK_CROUCH_PHYSGUN, - ACT_HL2MP_GESTURE_RANGE_ATTACK_PHYSGUN, - ACT_HL2MP_GESTURE_RELOAD_PHYSGUN, - ACT_HL2MP_JUMP_PHYSGUN, - - ACT_HL2MP_IDLE_CROSSBOW, - ACT_HL2MP_RUN_CROSSBOW, - ACT_HL2MP_IDLE_CROUCH_CROSSBOW, - ACT_HL2MP_WALK_CROUCH_CROSSBOW, - ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, - ACT_HL2MP_GESTURE_RELOAD_CROSSBOW, - ACT_HL2MP_JUMP_CROSSBOW, - ACT_HL2MP_IDLE_MELEE, ACT_HL2MP_RUN_MELEE, ACT_HL2MP_IDLE_CROUCH_MELEE, @@ -1296,14 +626,6 @@ typedef enum ACT_HL2MP_GESTURE_RELOAD_MELEE, ACT_HL2MP_JUMP_MELEE, - ACT_HL2MP_IDLE_SLAM, - ACT_HL2MP_RUN_SLAM, - ACT_HL2MP_IDLE_CROUCH_SLAM, - ACT_HL2MP_WALK_CROUCH_SLAM, - ACT_HL2MP_GESTURE_RANGE_ATTACK_SLAM, - ACT_HL2MP_GESTURE_RELOAD_SLAM, - ACT_HL2MP_JUMP_SLAM, - // Portal! ACT_VM_FIZZLE, @@ -1463,11 +785,53 @@ typedef enum ACT_MP_ATTACK_SWIM_GRENADE_MELEE, ACT_MP_ATTACK_AIRWALK_GRENADE_MELEE, + // Item1 + ACT_MP_STAND_ITEM1, + ACT_MP_CROUCH_ITEM1, + ACT_MP_RUN_ITEM1, + ACT_MP_WALK_ITEM1, + ACT_MP_AIRWALK_ITEM1, + ACT_MP_CROUCHWALK_ITEM1, + ACT_MP_JUMP_ITEM1, + ACT_MP_JUMP_START_ITEM1, + ACT_MP_JUMP_FLOAT_ITEM1, + ACT_MP_JUMP_LAND_ITEM1, + ACT_MP_SWIM_ITEM1, + + ACT_MP_ATTACK_STAND_ITEM1, // RUN, WALK + ACT_MP_ATTACK_STAND_ITEM1_SECONDARY, + ACT_MP_ATTACK_CROUCH_ITEM1, // CROUCHWALK + ACT_MP_ATTACK_CROUCH_ITEM1_SECONDARY, + ACT_MP_ATTACK_SWIM_ITEM1, + ACT_MP_ATTACK_AIRWALK_ITEM1, + + // Item2 + ACT_MP_STAND_ITEM2, + ACT_MP_CROUCH_ITEM2, + ACT_MP_RUN_ITEM2, + ACT_MP_WALK_ITEM2, + ACT_MP_AIRWALK_ITEM2, + ACT_MP_CROUCHWALK_ITEM2, + ACT_MP_JUMP_ITEM2, + ACT_MP_JUMP_START_ITEM2, + ACT_MP_JUMP_FLOAT_ITEM2, + ACT_MP_JUMP_LAND_ITEM2, + ACT_MP_SWIM_ITEM2, + + ACT_MP_ATTACK_STAND_ITEM2, // RUN, WALK + ACT_MP_ATTACK_STAND_ITEM2_SECONDARY, + ACT_MP_ATTACK_CROUCH_ITEM2, // CROUCHWALK + ACT_MP_ATTACK_CROUCH_ITEM2_SECONDARY, + ACT_MP_ATTACK_SWIM_ITEM2, + ACT_MP_ATTACK_AIRWALK_ITEM2, + // Flinches ACT_MP_GESTURE_FLINCH, ACT_MP_GESTURE_FLINCH_PRIMARY, ACT_MP_GESTURE_FLINCH_SECONDARY, ACT_MP_GESTURE_FLINCH_MELEE, + ACT_MP_GESTURE_FLINCH_ITEM1, + ACT_MP_GESTURE_FLINCH_ITEM2, ACT_MP_GESTURE_FLINCH_HEAD, ACT_MP_GESTURE_FLINCH_CHEST, @@ -1506,6 +870,20 @@ typedef enum ACT_MP_MELEE_GRENADE2_IDLE, ACT_MP_MELEE_GRENADE2_ATTACK, + ACT_MP_ITEM1_GRENADE1_DRAW, + ACT_MP_ITEM1_GRENADE1_IDLE, + ACT_MP_ITEM1_GRENADE1_ATTACK, + ACT_MP_ITEM1_GRENADE2_DRAW, + ACT_MP_ITEM1_GRENADE2_IDLE, + ACT_MP_ITEM1_GRENADE2_ATTACK, + + ACT_MP_ITEM2_GRENADE1_DRAW, + ACT_MP_ITEM2_GRENADE1_IDLE, + ACT_MP_ITEM2_GRENADE1_ATTACK, + ACT_MP_ITEM2_GRENADE2_DRAW, + ACT_MP_ITEM2_GRENADE2_IDLE, + ACT_MP_ITEM2_GRENADE2_ATTACK, + // Building ACT_MP_STAND_BUILDING, ACT_MP_CROUCH_BUILDING, @@ -1572,6 +950,20 @@ typedef enum ACT_MP_GESTURE_VC_NODYES_MELEE, ACT_MP_GESTURE_VC_NODNO_MELEE, + ACT_MP_GESTURE_VC_HANDMOUTH_ITEM1, + ACT_MP_GESTURE_VC_FINGERPOINT_ITEM1, + ACT_MP_GESTURE_VC_FISTPUMP_ITEM1, + ACT_MP_GESTURE_VC_THUMBSUP_ITEM1, + ACT_MP_GESTURE_VC_NODYES_ITEM1, + ACT_MP_GESTURE_VC_NODNO_ITEM1, + + ACT_MP_GESTURE_VC_HANDMOUTH_ITEM2, + ACT_MP_GESTURE_VC_FINGERPOINT_ITEM2, + ACT_MP_GESTURE_VC_FISTPUMP_ITEM2, + ACT_MP_GESTURE_VC_THUMBSUP_ITEM2, + ACT_MP_GESTURE_VC_NODYES_ITEM2, + ACT_MP_GESTURE_VC_NODNO_ITEM2, + ACT_MP_GESTURE_VC_HANDMOUTH_BUILDING, ACT_MP_GESTURE_VC_FINGERPOINT_BUILDING, ACT_MP_GESTURE_VC_FISTPUMP_BUILDING, @@ -1640,6 +1032,88 @@ typedef enum ACT_PDA_VM_IDLE_LOWERED, ACT_PDA_VM_LOWERED_TO_IDLE, + ACT_ITEM1_VM_DRAW, + ACT_ITEM1_VM_HOLSTER, + ACT_ITEM1_VM_IDLE, + ACT_ITEM1_VM_PULLBACK, + ACT_ITEM1_VM_PRIMARYATTACK, + ACT_ITEM1_VM_SECONDARYATTACK, + ACT_ITEM1_VM_RELOAD, + ACT_ITEM1_VM_DRYFIRE, + ACT_ITEM1_VM_IDLE_TO_LOWERED, + ACT_ITEM1_VM_IDLE_LOWERED, + ACT_ITEM1_VM_LOWERED_TO_IDLE, + + ACT_ITEM2_VM_DRAW, + ACT_ITEM2_VM_HOLSTER, + ACT_ITEM2_VM_IDLE, + ACT_ITEM2_VM_PULLBACK, + ACT_ITEM2_VM_PRIMARYATTACK, + ACT_ITEM2_VM_SECONDARYATTACK, + ACT_ITEM2_VM_RELOAD, + ACT_ITEM2_VM_DRYFIRE, + ACT_ITEM2_VM_IDLE_TO_LOWERED, + ACT_ITEM2_VM_IDLE_LOWERED, + ACT_ITEM2_VM_LOWERED_TO_IDLE, + + // Infested activities + ACT_RELOAD_SUCCEED, + ACT_RELOAD_FAIL, + // Autogun + ACT_WALK_AIM_AUTOGUN, + ACT_RUN_AIM_AUTOGUN, + ACT_IDLE_AUTOGUN, + ACT_IDLE_AIM_AUTOGUN, + ACT_RELOAD_AUTOGUN, + ACT_CROUCH_IDLE_AUTOGUN, + ACT_RANGE_ATTACK_AUTOGUN, + ACT_JUMP_AUTOGUN, + // Pistol + ACT_IDLE_AIM_PISTOL, + // PDW + ACT_WALK_AIM_DUAL, + ACT_RUN_AIM_DUAL, + ACT_IDLE_DUAL, + ACT_IDLE_AIM_DUAL, + ACT_RELOAD_DUAL, + ACT_CROUCH_IDLE_DUAL, + ACT_RANGE_ATTACK_DUAL, + ACT_JUMP_DUAL, + // Shotgun + ACT_IDLE_SHOTGUN, + ACT_IDLE_AIM_SHOTGUN, + ACT_CROUCH_IDLE_SHOTGUN, + ACT_JUMP_SHOTGUN, + // Rifle + ACT_IDLE_AIM_RIFLE, + ACT_RELOAD_RIFLE, + ACT_CROUCH_IDLE_RIFLE, + ACT_RANGE_ATTACK_RIFLE, + ACT_JUMP_RIFLE, + + // Infested General AI + ACT_SLEEP, + ACT_WAKE, + + // Shield Bug + ACT_FLICK_LEFT, + ACT_FLICK_LEFT_MIDDLE, + ACT_FLICK_RIGHT_MIDDLE, + ACT_FLICK_RIGHT, + ACT_SPINAROUND, + + // Mortar Bug + ACT_PREP_TO_FIRE, + ACT_FIRE, + ACT_FIRE_RECOVER, + + // Shaman + ACT_SPRAY, + + // Boomer + ACT_PREP_EXPLODE, + ACT_EXPLODE, + // this is the end of the global activities, private per-monster activities start here. LAST_SHARED_ACTIVITY, } Activity; diff --git a/game/shared/animation.cpp b/game/shared/animation.cpp index 3668dc4c3..80d79a150 100644 --- a/game/shared/animation.cpp +++ b/game/shared/animation.cpp @@ -25,10 +25,7 @@ // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" -#ifdef _MSC_VER #pragma warning( disable : 4244 ) -#endif - #define iabs(i) (( (i) >= 0 ) ? (i) : -(i) ) int ExtractBbox( CStudioHdr *pstudiohdr, int sequence, Vector& mins, Vector& maxs ) @@ -65,14 +62,18 @@ void SetEventIndexForSequence( mstudioseqdesc_t &seqdesc ) if ( &seqdesc == NULL ) return; - seqdesc.flags |= STUDIO_EVENT; - if ( seqdesc.numevents == 0 ) return; +#ifndef CLIENT_DLL + seqdesc.flags |= STUDIO_EVENT; +#else + seqdesc.flags |= STUDIO_EVENT_CLIENT; +#endif + for ( int index = 0; index < (int)seqdesc.numevents; index++ ) { - mstudioevent_t *pevent = seqdesc.pEvent( index ); + mstudioevent_t *pevent = (mstudioevent_for_client_server_t*)seqdesc.pEvent( index ); if ( !pevent ) continue; @@ -85,25 +86,29 @@ void SetEventIndexForSequence( mstudioseqdesc_t &seqdesc ) if ( iEventIndex == -1 ) { - pevent->event = EventList_RegisterPrivateEvent( pEventName ); + pevent->event_newsystem = EventList_RegisterPrivateEvent( pEventName ); } else { - pevent->event = iEventIndex; + pevent->event_newsystem = iEventIndex; pevent->type |= EventList_GetEventType( iEventIndex ); } } } } -mstudioevent_t *GetEventIndexForSequence( mstudioseqdesc_t &seqdesc ) +mstudioevent_for_client_server_t *GetEventIndexForSequence( mstudioseqdesc_t &seqdesc ) { - if (!(seqdesc.flags & STUDIO_EVENT)) +#ifndef CLIENT_DLL + if ( !(seqdesc.flags & STUDIO_EVENT) ) +#else + if ( !(seqdesc.flags & STUDIO_EVENT_CLIENT) ) +#endif { SetEventIndexForSequence( seqdesc ); } - return seqdesc.pEvent( 0 ); + return (mstudioevent_for_client_server_t*)seqdesc.pEvent( 0 ); } @@ -232,6 +237,11 @@ bool IsInPrediction() int SelectWeightedSequence( CStudioHdr *pstudiohdr, int activity, int curSequence ) { VPROF( "SelectWeightedSequence" ); +#ifdef CLIENT_DLL + VPROF_INCREMENT_COUNTER( "Client SelectWeightedSequence", 1 ); +#else // ifdef GAME_DLL + VPROF_INCREMENT_COUNTER( "Server SelectWeightedSequence", 1 ); +#endif if (! pstudiohdr) return 0; @@ -241,38 +251,13 @@ int SelectWeightedSequence( CStudioHdr *pstudiohdr, int activity, int curSequenc VerifySequenceIndex( pstudiohdr ); -#if STUDIO_SEQUENCE_ACTIVITY_LOOKUPS_ARE_SLOW - int weighttotal = 0; - int seq = ACTIVITY_NOT_AVAILABLE; - int weight = 0; - for (int i = 0; i < pstudiohdr->GetNumSeq(); i++) + int numSeq = pstudiohdr->GetNumSeq(); + if ( numSeq == 1 ) { - int curActivity = GetSequenceActivity( pstudiohdr, i, &weight ); - if (curActivity == activity) - { - if ( curSequence == i && weight < 0 ) - { - seq = i; - break; - } - weighttotal += iabs(weight); - - int randomValue; - - if ( IsInPrediction() ) - randomValue = SharedRandomInt( "SelectWeightedSequence", 0, weighttotal - 1, i ); - else - randomValue = RandomInt( 0, weighttotal - 1 ); - - if (!weighttotal || randomValue < iabs(weight)) - seq = i; - } + return ( GetSequenceActivity( pstudiohdr, 0, NULL ) == activity ) ? 0 : ACTIVITY_NOT_AVAILABLE; } - return seq; -#else return pstudiohdr->SelectWeightedSequence( activity, curSequence ); -#endif } @@ -282,6 +267,26 @@ int SelectWeightedSequence( CStudioHdr *pstudiohdr, int activity, int curSequenc // sequence having a number of spaces corresponding to its weight. int CStudioHdr::CActivityToSequenceMapping::SelectWeightedSequence( CStudioHdr *pstudiohdr, int activity, int curSequence ) { + // is the current sequence appropriate? + if (curSequence >= 0) + { + mstudioseqdesc_t &seqdesc = pstudiohdr->pSeqdesc( curSequence ); + + if (seqdesc.activity == activity && seqdesc.actweight < 0) + return curSequence; + } + + if ( !pstudiohdr->SequencesAvailable() ) + { + return ACTIVITY_NOT_AVAILABLE; + } + + if ( pstudiohdr->GetNumSeq() == 1 ) + { + AssertMsg( 0, "Expected single sequence case to be handled in ::SelectWeightedSequence()" ); + return ACTIVITY_NOT_AVAILABLE; + } + if (!ValidateAgainst(pstudiohdr)) { AssertMsg1(false, "CStudioHdr %s has changed its vmodel pointer without reinitializing its activity mapping! Now performing emergency reinitialization.", pstudiohdr->pszName()); @@ -293,15 +298,6 @@ int CStudioHdr::CActivityToSequenceMapping::SelectWeightedSequence( CStudioHdr * if (!m_pSequenceTuples) return ACTIVITY_NOT_AVAILABLE; - // is the current sequence appropriate? - if (curSequence >= 0) - { - mstudioseqdesc_t &seqdesc = pstudiohdr->pSeqdesc( curSequence ); - - if (seqdesc.activity == activity && seqdesc.actweight < 0) - return curSequence; - } - // get the data for the given activity HashValueType dummy( activity, 0, 0, 0 ); UtlHashHandle_t handle = m_ActToSeqHash.Find(dummy); @@ -311,18 +307,36 @@ int CStudioHdr::CActivityToSequenceMapping::SelectWeightedSequence( CStudioHdr * } const HashValueType * __restrict actData = &m_ActToSeqHash[handle]; + AssertMsg2( actData->totalWeight > 0, "Activity %s has total weight of %d!", + activity, actData->totalWeight ); int weighttotal = actData->totalWeight; - // generate a random number from 0 to the total weight - int randomValue; - if ( IsInPrediction() ) + + // failsafe if the weight is 0: assume the artist screwed up and that the first sequence + // for this activity should be returned. + int randomValue = 0; + if ( actData->totalWeight <= 0 ) { - randomValue = SharedRandomInt( "SelectWeightedSequence", 0, weighttotal - 1 ); + Warning( "Activity %s has %d sequences with a total weight of %d!", ActivityList_NameForIndex(activity), actData->count, actData->totalWeight ); + return (m_pSequenceTuples + actData->startingIdx)->seqnum; + } + else if ( actData->totalWeight == 1 ) + { + randomValue = 0; } else { - randomValue = RandomInt( 0, weighttotal - 1 ); + // generate a random number from 0 to the total weight + if ( IsInPrediction() ) + { + randomValue = SharedRandomInt( "SelectWeightedSequence", 0, weighttotal - 1 ); + } + else + { + randomValue = RandomInt( 0, weighttotal - 1 ); + } } + // chug through the entries in the list (they are sequential therefore cache-coherent) // until we run out of random juice SequenceTuple * __restrict sequenceInfo = m_pSequenceTuples + actData->startingIdx; @@ -342,6 +356,77 @@ int CStudioHdr::CActivityToSequenceMapping::SelectWeightedSequence( CStudioHdr * } +int CStudioHdr::CActivityToSequenceMapping::SelectWeightedSequenceFromModifiers( CStudioHdr *pstudiohdr, int activity, CUtlSymbol *pActivityModifiers, int iModifierCount ) +{ + if ( !pstudiohdr->SequencesAvailable() ) + { + return ACTIVITY_NOT_AVAILABLE; + } + + VerifySequenceIndex( pstudiohdr ); + + if ( pstudiohdr->GetNumSeq() == 1 ) + { + return ( ::GetSequenceActivity( pstudiohdr, 0, NULL ) == activity ) ? 0 : ACTIVITY_NOT_AVAILABLE; + } + + if (!ValidateAgainst(pstudiohdr)) + { + AssertMsg1(false, "CStudioHdr %s has changed its vmodel pointer without reinitializing its activity mapping! Now performing emergency reinitialization.", pstudiohdr->pszName()); + ExecuteOnce(DebuggerBreakIfDebugging()); + Reinitialize(pstudiohdr); + } + + // a null m_pSequenceTuples just means that this studio header has no activities. + if (!m_pSequenceTuples) + return ACTIVITY_NOT_AVAILABLE; + + // get the data for the given activity + HashValueType dummy( activity, 0, 0, 0 ); + UtlHashHandle_t handle = m_ActToSeqHash.Find(dummy); + if (!m_ActToSeqHash.IsValidHandle(handle)) + { + return ACTIVITY_NOT_AVAILABLE; + } + const HashValueType * __restrict actData = &m_ActToSeqHash[handle]; + + // go through each sequence and give it a score + int top_score = -1; + CUtlVector topScoring( actData->count, actData->count ); + for ( int i = 0; i < actData->count; i++ ) + { + SequenceTuple * __restrict sequenceInfo = m_pSequenceTuples + actData->startingIdx + i; + int score = 0; + // count matching activity modifiers + for ( int m = 0; m < iModifierCount; m++ ) + { + int num_modifiers = sequenceInfo->iNumActivityModifiers; + for ( int k = 0; k < num_modifiers; k++ ) + { + if ( sequenceInfo->pActivityModifiers[ k ] == pActivityModifiers[ m ] ) + { + score++; + break; + } + } + } + if ( score > top_score ) + { + topScoring.RemoveAll(); + topScoring.AddToTail( sequenceInfo->seqnum ); + top_score = score; + } + } + + // randomly pick between the highest scoring sequences ( NOTE: this method of selecting a sequence ignores activity weights ) + if ( IsInPrediction() ) + { + return topScoring[ SharedRandomInt( "SelectWeightedSequence", 0, topScoring.Count() - 1 ) ]; + } + + return topScoring[ RandomInt( 0, topScoring.Count() - 1 ) ]; +} + #endif @@ -476,6 +561,36 @@ void GetSequenceLinearMotion( CStudioHdr *pstudiohdr, int iSequence, const float QAngle vecAngles; Studio_SeqMovement( pstudiohdr, iSequence, 0, 1.0, poseParameter, (*pVec), vecAngles ); } + +float GetSequenceLinearMotionAndDuration( CStudioHdr *pstudiohdr, int iSequence, const float poseParameter[], Vector *pVec ) +{ + pVec->Init(); + if ( !pstudiohdr ) + { + Msg( "Bad pstudiohdr in GetSequenceLinearMotion()!\n" ); + return 0.0f; + } + + if ( !pstudiohdr->SequencesAvailable() ) + return 0.0f; + + if ( iSequence < 0 || iSequence >= pstudiohdr->GetNumSeq() ) + { + // Don't spam on bogus model + if ( pstudiohdr->GetNumSeq() > 0 ) + { + static int msgCount = 0; + while ( ++msgCount < 10 ) + { + Msg( "Bad sequence (%i out of %i max) in GetSequenceLinearMotion() for model '%s'!\n", iSequence, pstudiohdr->GetNumSeq(), pstudiohdr->pszName() ); + } + } + return 0.0f; + } + + return Studio_SeqMovementAndDuration( pstudiohdr, iSequence, 0, 1.0, poseParameter, (*pVec) ); +} + #endif const char *GetSequenceName( CStudioHdr *pstudiohdr, int iSequence ) @@ -549,7 +664,7 @@ bool HasAnimationEventOfType( CStudioHdr *pstudiohdr, int sequence, int type ) int index; for ( index = 0; index < (int)seqdesc.numevents; index++ ) { - if ( pevent[ index ].event == type ) + if ( pevent[ index ].Event() == type ) { return true; } @@ -577,7 +692,7 @@ int GetAnimationEvent( CStudioHdr *pstudiohdr, int sequence, animevent_t *pNPCEv if ( !(pevent[index].type & AE_TYPE_SERVER) ) continue; } - else if ( pevent[index].event >= EVENT_CLIENT ) //Adrian - Support the old event system + else if ( pevent[index].Event_OldSystem() >= EVENT_CLIENT ) //Adrian - Support the old event system continue; bool bOverlapEvent = false; @@ -604,9 +719,9 @@ int GetAnimationEvent( CStudioHdr *pstudiohdr, int sequence, animevent_t *pNPCEv #else pNPCEvent->eventtime = 0.0f; #endif - pNPCEvent->event = pevent[index].event; - pNPCEvent->options = pevent[index].pszOptions(); pNPCEvent->type = pevent[index].type; + pNPCEvent->Event( pevent[index].Event() ); + pNPCEvent->options = pevent[index].pszOptions(); return index + 1; } } @@ -850,6 +965,21 @@ const char *GetBodygroupName( CStudioHdr *pstudiohdr, int iGroup ) return pbodypart->pszName(); } +const char *GetBodygroupPartName( CStudioHdr *pstudiohdr, int iGroup, int iPart ) +{ + if ( !pstudiohdr) + return ""; + + if (iGroup >= pstudiohdr->numbodyparts()) + return ""; + + mstudiobodyparts_t *pbodypart = pstudiohdr->pBodypart( iGroup ); + if ( iPart < 0 && iPart >= pbodypart->nummodels ) + return ""; + + return pbodypart->pModel( iPart )->name; +} + int FindBodygroupByName( CStudioHdr *pstudiohdr, const char *name ) { if ( !pstudiohdr ) @@ -897,6 +1027,7 @@ int GetSequenceActivity( CStudioHdr *pstudiohdr, int sequence, int *pweight ) return 0; } + Assert(sequence >= 0 && sequence < pstudiohdr->GetNumSeq()); mstudioseqdesc_t &seqdesc = pstudiohdr->pSeqdesc( sequence ); if (!(seqdesc.flags & STUDIO_ACTIVITY)) diff --git a/game/shared/animation.h b/game/shared/animation.h index 464cfac04..a6a73e5fe 100644 --- a/game/shared/animation.h +++ b/game/shared/animation.h @@ -1,13 +1,18 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // // $NoKeywords: $ // -//=============================================================================// +//===========================================================================// #ifndef ANIMATION_H #define ANIMATION_H +#ifdef _WIN32 +#pragma once +#endif + + #define ACTIVITY_NOT_AVAILABLE -1 struct animevent_t; @@ -25,6 +30,7 @@ int SelectHeaviestSequence( CStudioHdr *pstudiohdr, int activity ); void SetEventIndexForSequence( mstudioseqdesc_t &seqdesc ); void BuildAllAnimationEventIndexes( CStudioHdr *pstudiohdr ); void ResetEventIndexes( CStudioHdr *pstudiohdr ); +float GetSequenceLinearMotionAndDuration( CStudioHdr *pstudiohdr, int iSequence, const float poseParameter[], Vector *pVec ); void GetEyePosition( CStudioHdr *pstudiohdr, Vector &vecEyePosition ); @@ -49,6 +55,7 @@ int GetBodygroup( CStudioHdr *pstudiohdr, int body, int iGroup ); const char *GetBodygroupName( CStudioHdr *pstudiohdr, int iGroup ); int FindBodygroupByName( CStudioHdr *pstudiohdr, const char *name ); +const char *GetBodygroupPartName( CStudioHdr *pstudiohdr, int iGroup, int iPart ); int GetBodygroupCount( CStudioHdr *pstudiohdr, int iGroup ); int GetNumBodyGroups( CStudioHdr *pstudiohdr ); diff --git a/game/shared/eventlist.cpp b/game/shared/eventlist.cpp index 2f791ab49..167b2a16b 100644 --- a/game/shared/eventlist.cpp +++ b/game/shared/eventlist.cpp @@ -85,7 +85,7 @@ static eventlist_t *ListFromString( const char *pString ) static eventlist_t *ListFromEvent( int eventIndex ) { // ugly linear search - for ( int i = 0; i < g_EventList.Size(); i++ ) + for ( int i = 0; i < g_EventList.Count(); i++ ) { if ( g_EventList[i].eventIndex == eventIndex ) { @@ -154,7 +154,13 @@ Animevent EventList_RegisterPrivateEvent( const char *pszEventName ) } } - pList = EventList_AddEventEntry( pszEventName, g_HighestEvent+1, true, AE_TYPE_SERVER ); + int iType = AE_TYPE_SERVER; + +#ifdef CLIENT_DLL + iType = AE_TYPE_CLIENT; +#endif + + pList = EventList_AddEventEntry( pszEventName, g_HighestEvent+1, true, iType ); return (Animevent)pList->eventIndex; } @@ -233,12 +239,16 @@ void EventList_RegisterSharedEvents( void ) REGISTER_SHARED_ANIMEVENT( AE_SV_DUSTTRAIL, AE_TYPE_SERVER ); REGISTER_SHARED_ANIMEVENT( AE_CL_CREATE_PARTICLE_EFFECT, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_CL_STOP_PARTICLE_EFFECT, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_CL_ADD_PARTICLE_EFFECT_CP, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_CL_CREATE_PARTICLE_BRASS, AE_TYPE_CLIENT ); REGISTER_SHARED_ANIMEVENT( AE_RAGDOLL, AE_TYPE_SERVER ); REGISTER_SHARED_ANIMEVENT( AE_CL_ENABLE_BODYGROUP, AE_TYPE_CLIENT ); REGISTER_SHARED_ANIMEVENT( AE_CL_DISABLE_BODYGROUP, AE_TYPE_CLIENT ); REGISTER_SHARED_ANIMEVENT( AE_CL_BODYGROUP_SET_VALUE, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_CL_BODYGROUP_SET_VALUE_CMODEL_WPN, AE_TYPE_CLIENT ); REGISTER_SHARED_ANIMEVENT( AE_WPN_PRIMARYATTACK, AE_TYPE_CLIENT | AE_TYPE_SERVER ); REGISTER_SHARED_ANIMEVENT( AE_WPN_INCREMENTAMMO, AE_TYPE_CLIENT | AE_TYPE_SERVER ); @@ -246,5 +256,25 @@ void EventList_RegisterSharedEvents( void ) REGISTER_SHARED_ANIMEVENT( AE_WPN_HIDE, AE_TYPE_CLIENT | AE_TYPE_SERVER ); REGISTER_SHARED_ANIMEVENT( AE_WPN_UNHIDE, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_ASW_FOOTSTEP, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_MARINE_FOOTSTEP, AE_TYPE_CLIENT ); + + REGISTER_SHARED_ANIMEVENT( AE_MARINE_RELOAD_SOUND_A, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_MARINE_RELOAD_SOUND_B, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_MARINE_RELOAD_SOUND_C, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_REMOVE_CLIENT_AIM, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_WPN_PLAYWPNSOUND, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + + REGISTER_SHARED_ANIMEVENT( AE_MELEE_DAMAGE, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_MELEE_START_COLLISION_DAMAGE, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_MELEE_STOP_COLLISION_DAMAGE, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_SCREEN_SHAKE, AE_TYPE_CLIENT ); + REGISTER_SHARED_ANIMEVENT( AE_START_DETECTING_COMBO, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_STOP_DETECTING_COMBO, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_COMBO_TRANSITION, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_ALLOW_MOVEMENT, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + REGISTER_SHARED_ANIMEVENT( AE_SKILL_EVENT, AE_TYPE_CLIENT | AE_TYPE_SERVER ); + + REGISTER_SHARED_ANIMEVENT( AE_TUG_INCAP, AE_TYPE_SERVER ); } diff --git a/game/shared/eventlist.h b/game/shared/eventlist.h index 732433a65..f38ea927b 100644 --- a/game/shared/eventlist.h +++ b/game/shared/eventlist.h @@ -69,12 +69,16 @@ typedef enum AE_SV_DUSTTRAIL, AE_CL_CREATE_PARTICLE_EFFECT, + AE_CL_STOP_PARTICLE_EFFECT, + AE_CL_ADD_PARTICLE_EFFECT_CP, + AE_CL_CREATE_PARTICLE_BRASS, AE_RAGDOLL, AE_CL_ENABLE_BODYGROUP, AE_CL_DISABLE_BODYGROUP, AE_CL_BODYGROUP_SET_VALUE, + AE_CL_BODYGROUP_SET_VALUE_CMODEL_WPN, AE_WPN_PRIMARYATTACK, // Used by weapons that want their primary attack to occur during an attack anim (i.e. grenade throwing) AE_WPN_INCREMENTAMMO, @@ -84,6 +88,26 @@ typedef enum AE_WPN_PLAYWPNSOUND, // Play a weapon sound from the weapon script file + // Alien Swarm Infested shared events + AE_ASW_FOOTSTEP, // asw, played as each foot steps down + AE_MARINE_FOOTSTEP, + AE_MARINE_RELOAD_SOUND_A, // anim event fired reloading sound + AE_MARINE_RELOAD_SOUND_B, // anim event fired reloading sound + AE_MARINE_RELOAD_SOUND_C, // anim event fired reloading sound + AE_REMOVE_CLIENT_AIM, // asw, removes this entity from the client autoaim list + + AE_MELEE_DAMAGE, + AE_MELEE_START_COLLISION_DAMAGE, + AE_MELEE_STOP_COLLISION_DAMAGE, + AE_SCREEN_SHAKE, + AE_START_DETECTING_COMBO, + AE_STOP_DETECTING_COMBO, + AE_COMBO_TRANSITION, + AE_ALLOW_MOVEMENT, + AE_SKILL_EVENT, // marine skill event triggered (event options describes the skill) + + AE_TUG_INCAP, + LAST_SHARED_ANIMEVENT, } Animevent; diff --git a/game/shared/npcevent.h b/game/shared/npcevent.h index a3037426d..61086c515 100644 --- a/game/shared/npcevent.h +++ b/game/shared/npcevent.h @@ -11,16 +11,60 @@ #pragma once #endif + +#include "eventlist.h" + + class CBaseAnimating; struct animevent_t { - int event; +#ifdef CLIENT_DLL + // see mstudioevent_for_client_server_t comment below + union + { + unsigned short _event_highword; + unsigned short event_newsystem; + }; + unsigned short _event_lowword; +#else + // see mstudioevent_for_client_server_t comment below + unsigned short _event_highword; + union + { + unsigned short _event_lowword; + unsigned short event_newsystem; + }; +#endif + const char *options; float cycle; float eventtime; int type; CBaseAnimating *pSource; + bool m_bHandledByScript; + + // see mstudioevent_for_client_server_t comment below + int Event_OldSystem( void ) const { return *static_cast< const int* >( static_cast< const void* >( &_event_highword ) ); } + void Event_OldSystem( int nEvent ) { *static_cast< int* >( static_cast< void* >( &_event_highword ) ) = nEvent; } + int Event( void ) const + { + if ( type & AE_TYPE_NEWEVENTSYSTEM ) + return event_newsystem; + + return Event_OldSystem(); + } + void Event( int nEvent ) + { + if ( type & AE_TYPE_NEWEVENTSYSTEM ) + { + event_newsystem = nEvent; + } + else + { + Event_OldSystem( nEvent ); + } + } }; #define EVENT_SPECIFIC 0 #define EVENT_SCRIPTED 1000 // see scriptevent.h @@ -74,4 +118,76 @@ struct animevent_t // NOTE: MUST BE THE LAST WEAPON EVENT -- ONLY WEAPON EVENTS BETWEEN EVENT_WEAPON AND THIS #define EVENT_WEAPON_LAST 3999 + +// Because the client and server have a shared memory space for event data, +// but use different indexes for the event (servers cache them all upfront, +// while client creates them as sequences fire) we're going to store the server +// index in the low word and the client index in the high word. +// +// studio.h is a public header, so we'll use this matching struct to do the +// conversion and not force us to macro all the code that checks the event member. +// This struct's data MUST match mstudioevent_t +// +// BUT events that use the old event system use the entire dword which will always +// match between client and server. Instead of wrapping everything in if checks, +// for ( type & AE_TYPE_NEWEVENTSYSTEM ) we use the Event accessors to set/get +// while doing the check under the hood. +// +// -Jeep +struct mstudioevent_for_client_server_t +{ + DECLARE_BYTESWAP_DATADESC(); + float cycle; +#ifdef CLIENT_DLL + union + { + // Client shares with the high word + unsigned short _event_highword; + unsigned short event_newsystem; + }; + unsigned short _event_lowword; // Placeholder for the low word +#else + unsigned short _event_highword; // Placeholder for the high word + union + { + // Server shares with the low word + unsigned short _event_lowword; + unsigned short event_newsystem; + }; +#endif + + int type; + inline const char * pszOptions( void ) const { return options; } + char options[64]; + + int szeventindex; + inline char * const pszEventName( void ) const { return ((char *)this) + szeventindex; } + + // For setting and getting through Event, check the AE_TYPE_NEWEVENTSYSTEM flag to decide + // if we should set/get just the short used by the client/server or use the whole int. + int Event_OldSystem( void ) const { return *static_cast< const int* >( static_cast< const void* >( &_event_highword ) ); } + void Event_OldSystem( int nEvent ) { *static_cast< int* >( static_cast< void* >( &_event_highword ) ) = nEvent; } + int Event( void ) const + { + if ( type & AE_TYPE_NEWEVENTSYSTEM ) + return event_newsystem; + + return Event_OldSystem(); + } + void Event( int nEvent ) + { + if ( type & AE_TYPE_NEWEVENTSYSTEM ) + { + event_newsystem = nEvent; + } + else + { + Event_OldSystem( nEvent ); + } + } +}; + +#define mstudioevent_t mstudioevent_for_client_server_t + + #endif // NPCEVENT_H diff --git a/game/shared/predictioncopy.cpp b/game/shared/predictioncopy.cpp index 74535d747..b41f6557d 100644 --- a/game/shared/predictioncopy.cpp +++ b/game/shared/predictioncopy.cpp @@ -9,12 +9,9 @@ #if !defined( NO_ENTITY_PREDICTION ) -#if defined( CLIENT_DLL ) - #include "IGameSystem.h" #include - -#endif +#include "cdll_int.h" #include #include #include "tier0/dbg.h" @@ -22,10 +19,15 @@ #include "predictioncopy.h" #include "engine/ivmodelinfo.h" #include "tier1/fmtstr.h" +#include "utlvector.h" +#include "tier0/vprof.h" +#include "tier1/tokenset.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" +CClassMemoryPool< optimized_datamap_t > g_OptimizedDataMapPool( 20, CUtlMemoryPool::GROW_SLOW ); + // -------------------------------------------------------------- // // CSave @@ -62,246 +64,500 @@ static const char *g_FieldTypes[ FIELD_TYPECOUNT ] = "FIELD_MODELINDEX" // FIELD_MODELINDEX }; -CPredictionCopy::CPredictionCopy( int type, void *dest, bool dest_packed, void const *src, bool src_packed, - bool counterrors /*= false*/, bool reporterrors /*= false*/, bool performcopy /*= true*/, - bool describefields /*= false*/, FN_FIELD_COMPARE func /*= NULL*/ ) -{ +static int g_FieldSizes[FIELD_TYPECOUNT] = +{ + 0, // FIELD_VOID + sizeof(float), // FIELD_FLOAT + sizeof(int), // FIELD_STRING + sizeof(Vector), // FIELD_VECTOR + sizeof(Quaternion), // FIELD_QUATERNION + sizeof(int), // FIELD_INTEGER + sizeof(char), // FIELD_BOOLEAN + sizeof(short), // FIELD_SHORT + sizeof(char), // FIELD_CHARACTER + sizeof(color32), // FIELD_COLOR32 + sizeof(int), // FIELD_EMBEDDED (handled specially) + sizeof(int), // FIELD_CUSTOM (handled specially) + + //--------------------------------- + + sizeof(int), // FIELD_CLASSPTR + sizeof(EHANDLE), // FIELD_EHANDLE + sizeof(int), // FIELD_EDICT + + sizeof(Vector), // FIELD_POSITION_VECTOR + sizeof(float), // FIELD_TIME + sizeof(int), // FIELD_TICK + sizeof(int), // FIELD_MODELNAME + sizeof(int), // FIELD_SOUNDNAME + + sizeof(int), // FIELD_INPUT (uses custom type) + sizeof(int *), // FIELD_FUNCTION + sizeof(VMatrix), // FIELD_VMATRIX + sizeof(VMatrix), // FIELD_VMATRIX_WORLDSPACE + sizeof(matrix3x4_t),// FIELD_MATRIX3X4_WORLDSPACE // NOTE: Use array(FIELD_FLOAT, 12) for matrix3x4_t NOT in worldspace + sizeof(interval_t), // FIELD_INTERVAL + sizeof(int), // FIELD_MODELINDEX +}; + +#define PREDICTIONCOPY_APPLY( func, nFieldType, pCurrentMap, pField, pOutputData, pInputData, fieldSize ) \ + switch( nFieldType ) \ + { \ + case FIELD_EMBEDDED: \ + { \ + Error( "FIELD_EMBEDDED in flat list!!!" ); \ + } \ + break; \ + case FIELD_FLOAT: \ + func( pCurrentMap, pField, (float *)pOutputData, (const float *)pInputData, fieldSize ); \ + break; \ + case FIELD_STRING: \ + func( pCurrentMap, pField, (char *)pOutputData, (const char *)pInputData, fieldSize ); \ + break; \ + case FIELD_VECTOR: \ + func( pCurrentMap, pField, (Vector *)pOutputData, (const Vector *)pInputData, fieldSize ); \ + break; \ + case FIELD_QUATERNION: \ + func( pCurrentMap, pField, (Quaternion *)pOutputData, (const Quaternion *)pInputData, fieldSize );\ + break; \ + case FIELD_COLOR32: \ + func( pCurrentMap, pField, (color32 *)pOutputData, (const color32 *)pInputData, fieldSize ); \ + break; \ + case FIELD_BOOLEAN: \ + func( pCurrentMap, pField, (bool *)pOutputData, (const bool *)pInputData, fieldSize ); \ + break; \ + case FIELD_INTEGER: \ + func( pCurrentMap, pField, (int *)pOutputData, (const int *)pInputData, fieldSize ); \ + break; \ + case FIELD_SHORT: \ + func( pCurrentMap, pField, (short *)pOutputData, (const short *)pInputData, fieldSize ); \ + break; \ + case FIELD_CHARACTER: \ + func( pCurrentMap, pField, (uint8 *)pOutputData, (const uint8 *)pInputData, fieldSize ); \ + break; \ + case FIELD_EHANDLE: \ + func( pCurrentMap, pField, (EHANDLE *)pOutputData, (const EHANDLE *)pInputData, fieldSize );\ + break; \ + default: \ + break; \ + } + +#define PREDICTIONCOPY_APPLY_NOEMBEDDED( func, nFieldType, pCurrentMap, pField, pOutputData, pInputData, fieldSize ) \ + switch( nFieldType ) \ + { \ + case FIELD_FLOAT: \ + func( pCurrentMap, pField, (float *)pOutputData, (const float *)pInputData, fieldSize ); \ + break; \ + case FIELD_STRING: \ + func( pCurrentMap, pField, (char *)pOutputData, (const char *)pInputData, fieldSize ); \ + break; \ + case FIELD_VECTOR: \ + func( pCurrentMap, pField, (Vector *)pOutputData, (const Vector *)pInputData, fieldSize ); \ + break; \ + case FIELD_QUATERNION: \ + func( pCurrentMap, pField, (Quaternion *)pOutputData, (const Quaternion *)pInputData, fieldSize );\ + break; \ + case FIELD_COLOR32: \ + func( pCurrentMap, pField, (color32 *)pOutputData, (const color32 *)pInputData, fieldSize ); \ + break; \ + case FIELD_BOOLEAN: \ + func( pCurrentMap, pField, (bool *)pOutputData, (const bool *)pInputData, fieldSize ); \ + break; \ + case FIELD_INTEGER: \ + func( pCurrentMap, pField, (int *)pOutputData, (const int *)pInputData, fieldSize ); \ + break; \ + case FIELD_SHORT: \ + func( pCurrentMap, pField, (short *)pOutputData, (const short *)pInputData, fieldSize ); \ + break; \ + case FIELD_CHARACTER: \ + func( pCurrentMap, pField, (uint8 *)pOutputData, (const uint8 *)pInputData, fieldSize ); \ + break; \ + case FIELD_EHANDLE: \ + func( pCurrentMap, pField, (EHANDLE *)pOutputData, (const EHANDLE *)pInputData, fieldSize );\ + break; \ + default: \ + break; \ + } + +CPredictionCopy::CPredictionCopy( int type, byte *dest, bool dest_packed, const byte *src, bool src_packed, + optype_t opType, FN_FIELD_COMPARE func /*= NULL*/ ) +{ + m_OpType = opType; m_nType = type; m_pDest = dest; m_pSrc = src; m_nDestOffsetIndex = dest_packed ? TD_OFFSET_PACKED : TD_OFFSET_NORMAL; m_nSrcOffsetIndex = src_packed ? TD_OFFSET_PACKED : TD_OFFSET_NORMAL; - m_bErrorCheck = counterrors; - m_bReportErrors = reporterrors; - m_bPerformCopy = performcopy; - m_bDescribeFields = describefields; - - m_pCurrentField = NULL; - m_pCurrentMap = NULL; - m_pCurrentClassName = NULL; - m_bShouldReport = false; - m_bShouldDescribe = false; + m_nErrorCount = 0; + m_nEntIndex = -1; + m_pWatchField = NULL; m_FieldCompareFunc = func; } -//----------------------------------------------------------------------------- -// Purpose: -// Input : *fmt - -// ... - -//----------------------------------------------------------------------------- -void CPredictionCopy::ReportFieldsDiffer( const char *fmt, ... ) -{ - ++m_nErrorCount; +static ConVar cl_pred_error_verbose( "cl_pred_error_verbose", "0", 0, "Show more field info when spewing prediction errors." ); - if ( !m_bShouldReport ) - return; +template< class T > +inline void CPredictionCopy::CopyField( difftype_t difftype, T *outvalue, const T *invalue, int count ) +{ + for ( int i = 0; i < count; ++i ) + { + outvalue[ i ] = invalue[ i ]; + } +} - if ( m_bDescribeFields && m_FieldCompareFunc ) - return; +// specialized for strings +template<> +inline void CPredictionCopy::CopyField( difftype_t difftype, char *outvalue, const char *invalue, int count ) +{ + Q_strcpy( outvalue, invalue ); +} - Assert( m_pCurrentMap ); - Assert( m_pCurrentClassName ); +template< class T > +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const T *outvalue, int count ) +{ + Assert( 0 ); +} - const char *fieldname = "empty"; - int flags = 0; +// Short +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const short *outvalue, int count ) +{ + WatchMsg( pField, "short (%i)", (int)(outvalue[0]) ); +} - if ( m_pCurrentField ) +// Int +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const int *outvalue, int count ) +{ + bool described = false; + if ( pField->flags & FTYPEDESC_MODELINDEX ) { - flags = m_pCurrentField->flags; - fieldname = m_pCurrentField->fieldName ? m_pCurrentField->fieldName : "NULL"; - } + int modelindex = outvalue[0]; + model_t const *m = modelinfo->GetModel( modelindex ); + if ( m ) + { + described = true; + char shortfile[ 512 ]; + shortfile[ 0 ] = 0; + Q_FileBase( modelinfo->GetModelName( m ), shortfile, sizeof( shortfile ) ); - va_list argptr; - char data[ 4096 ]; - int len; - va_start(argptr, fmt); - len = Q_vsnprintf(data, sizeof( data ), fmt, argptr); - va_end(argptr); + WatchMsg( pField, "integer (%i->%s)", outvalue[0], shortfile ); + } + } - if ( m_nErrorCount == 1 ) + if ( !described ) { - Msg( "\n" ); + WatchMsg( pField, "integer (%i)", outvalue[0] ); } +} - Msg( "%03i %s::%s - %s", - m_nErrorCount, - m_pCurrentClassName, - fieldname, - data ); +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const bool *outvalue, int count ) +{ + WatchMsg( pField, "bool (%s)", (outvalue[0]) ? "true" : "false" ); +} - m_bShouldReport = false; +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const float *outvalue, int count ) +{ + WatchMsg( pField, "float (%f)", outvalue[ 0 ] ); } -//----------------------------------------------------------------------------- -// Purpose: -// Input : *fmt - -// ... - -//----------------------------------------------------------------------------- -void CPredictionCopy::DescribeFields( difftype_t dt, const char *fmt, ... ) +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const char *outstring, int count ) { - if ( !m_bShouldDescribe ) - return; + WatchMsg( pField, "string (%s)", outstring ); +} - if ( !m_FieldCompareFunc ) - return; +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const Vector* outValue, int count ) +{ + WatchMsg( pField, "vector (%f %f %f)", outValue[0].x, outValue[0].y, outValue[0].z ); +} - Assert( m_pCurrentMap ); - Assert( m_pCurrentClassName ); +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const Quaternion* outValue, int count ) +{ + WatchMsg( pField, "quaternion (%f %f %f %f)", outValue[0].x, outValue[0].y, outValue[0].z, outValue[0].w ); +} - const char *fieldname = "empty"; - int flags = 0; +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const EHANDLE *outvalue, int count ) +{ + C_BaseEntity *ent = outvalue[0].Get(); + if ( ent ) + { + const char *classname = ent->GetClassname(); + if ( !classname[0] ) + { + classname = typeid( *ent ).name(); + } - if ( m_pCurrentField ) + WatchMsg( pField, "EHandle (0x%p->%s)", (void *)outvalue[ 0 ], classname ); + } + else { - flags = m_pCurrentField->flags; - fieldname = m_pCurrentField->fieldName ? m_pCurrentField->fieldName : "NULL"; + WatchMsg( pField, "EHandle (NULL)" ); } +} - va_list argptr; - char data[ 4096 ]; - int len; - va_start(argptr, fmt); - len = Q_vsnprintf(data, sizeof( data ), fmt, argptr); - va_end(argptr); - - bool isnetworked = ( flags & FTYPEDESC_INSENDTABLE ) ? true : false; - bool isnoterrorchecked = ( flags & FTYPEDESC_NOERRORCHECK ) ? true : false; - - ( *m_FieldCompareFunc )( - m_pCurrentClassName, - fieldname, - g_FieldTypes[ m_pCurrentField->fieldType ], - isnetworked, - isnoterrorchecked, - dt != IDENTICAL ? true : false, - dt == WITHINTOLERANCE ? true : false, - data - ); - - m_bShouldDescribe = false; +void CPredictionCopy::DumpWatchField( const typedescription_t *pField, const byte *outvalue, int count ) +{ + switch ( pField->fieldType ) + { + case FIELD_FLOAT: + WatchField( pField, (const float *)outvalue, count ); + break; + case FIELD_STRING: + WatchField( pField, (const char *)outvalue, count ); + break; + case FIELD_VECTOR: + WatchField( pField, (const Vector *)outvalue, count ); + break; + case FIELD_QUATERNION: + WatchField( pField, (const Quaternion *)outvalue, count ); + break; + case FIELD_COLOR32: + WatchField( pField, (const color32 *)outvalue, count ); + break; + case FIELD_BOOLEAN: + WatchField( pField, (const bool *)outvalue, count ); + break; + case FIELD_INTEGER: + WatchField( pField, (const int *)outvalue, count ); + break; + case FIELD_SHORT: + WatchField( pField, (const short *)outvalue, count ); + break; + case FIELD_CHARACTER: + WatchField( pField, (const uint8 *)outvalue, count ); + break; + case FIELD_EHANDLE: + WatchField( pField, (const EHANDLE *)outvalue, count ); + break; + default: + break; + } } -//----------------------------------------------------------------------------- -// Purpose: -// Output : Returns true on success, false on failure. -//----------------------------------------------------------------------------- -bool CPredictionCopy::CanCheck( void ) +// color32 +template<> +inline void CPredictionCopy::WatchField( const typedescription_t *pField, const color32 *outvalue, int count ) { - Assert( m_pCurrentField ); + WatchMsg( pField, "color32 (%d %d %d %d)", outvalue[0].r, outvalue[0].g, outvalue[0].b, outvalue[0].a ); +} - if ( m_pCurrentField->flags & FTYPEDESC_NOERRORCHECK ) +inline bool QuaternionCompare( const Quaternion& q1, const Quaternion& q2 ) +{ + for ( int i = 0; i < 4; ++i ) { - return false; + if ( q1[i] != q2[i] ) + return false; } - return true; } -//----------------------------------------------------------------------------- -// Purpose: -// Input : size - -// *outdata - -// *indata - -//----------------------------------------------------------------------------- -/* -void CPredictionCopy::CopyData( difftype_t dt, int size, char *outdata, const char *indata ) +template< class T > +inline CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const T *outvalue, const T *invalue, int count ) { - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - memcpy( outdata, indata, size ); + for ( int i = 0; i < count; i++ ) + { + if ( outvalue[ i ] == invalue[ i ] ) + continue; + return DIFFERS; + } + return IDENTICAL; } -*/ -CPredictionCopy::difftype_t CPredictionCopy::CompareData( int size, char *outdata, const char *indata ) +// float uses tolerance +template<> +inline CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const float *outvalue, const float *invalue, int count ) { - if ( !m_bErrorCheck ) - return DIFFERS; + difftype_t retval = IDENTICAL; + + float tolerance = pField->fieldTolerance; + Assert( tolerance >= 0.0f ); + bool usetolerance = tolerance > 0.0f; - if ( CanCheck() ) + if ( usetolerance ) { - if ( memcmp( outdata, indata, size ) ) + for ( int i = 0; i < count; ++i ) { + float diff = fabs( outvalue[ i ] - invalue[ i ] ); + if ( diff <= tolerance ) + { + retval = WITHINTOLERANCE; + continue; + } + return DIFFERS; } - else + } + else + { + for ( int i = 0; i < count; ++i ) { - // No difference, so no need to copy - return IDENTICAL; + if ( outvalue[ i ] == invalue[ i ] ) + continue; + return DIFFERS; } } - - // Fields differ - return IDENTICAL; + return retval; } -void CPredictionCopy::DescribeData( difftype_t dt, int size, char *outdata, const char *indata ) +// vector uses tolerance +template<> +inline CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const Vector *outvalue, const Vector *invalue, int count ) { - if ( !m_bErrorCheck ) - return; + difftype_t retval = IDENTICAL; + + float tolerance = pField->fieldTolerance; + Assert( tolerance >= 0.0f ); + bool usetolerance = tolerance > 0.0f; - if ( dt == DIFFERS ) + if ( usetolerance ) { - ReportFieldsDiffer( "binary data differs (%i bytes)\n", size ); - } + for ( int i = 0; i < count; ++i ) + { + Vector delta = outvalue[ i ] - invalue[ i ]; + + if ( delta.x <= tolerance && + delta.y <= tolerance && + delta.z <= tolerance ) + { + retval = WITHINTOLERANCE; + continue; + } - DescribeFields( dt, "binary (%i bytes)\n", size ); + return DIFFERS; + } + } + else + { + for ( int i = 0; i < count; ++i ) + { + if ( outvalue[ i ] == invalue[ i ] ) + continue; + return DIFFERS; + } + } + return retval; } -void CPredictionCopy::WatchData( difftype_t dt, int size, char *outdata, const char *indata ) +// quaternion uses tolerance +template<> +inline CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const Quaternion *outvalue, const Quaternion *invalue, int count ) { - if ( m_pWatchField != m_pCurrentField ) - return; + difftype_t retval = IDENTICAL; + + + float tolerance = pField->fieldTolerance; + Assert( tolerance >= 0.0f ); + bool usetolerance = tolerance > 0.0f; + + if ( usetolerance ) + { + for ( int i = 0; i < count; ++i ) + { + Quaternion delta; + for ( int j = 0; j < 4; j++ ) + { + delta[i] = outvalue[i][j] - invalue[i][j]; + } + + if ( delta.x <= tolerance && + delta.y <= tolerance && + delta.z <= tolerance && + delta.w <= tolerance ) + { + retval = WITHINTOLERANCE; + continue; + } - WatchMsg( "binary (%i bytes)", size ); + return DIFFERS; + } + } + else + { + for ( int i = 0; i < count; ++i ) + { + if ( QuaternionCompare( outvalue[ i ], invalue[ i ] ) ) + continue; + return DIFFERS; + } + } + return retval; } -void CPredictionCopy::DescribeShort( difftype_t dt, short *outvalue, const short *invalue, int count ) +// string +template<> +inline CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const char *outvalue, const char *invalue, int count ) { - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) + if ( Q_strcmp( outvalue, invalue ) ) { - int i = 0; - ReportFieldsDiffer( "short differs (net %i pred %i) diff(%i)\n", (int)(invalue[i]), (int)(outvalue[i]), (int)(outvalue[i] - invalue[i]) ); + return DIFFERS; } + return IDENTICAL; +} - DescribeFields( dt, "short (%i)\n", (int)(outvalue[0]) ); +// ehandle +template<> +inline CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const EHANDLE *outvalue, const EHANDLE *invalue, int count ) +{ + for ( int i = 0; i < count; i++ ) + { + if ( outvalue[ i ].Get() == invalue[ i ].Get() ) + continue; + return DIFFERS; + } + return IDENTICAL; } -void CPredictionCopy::WatchShort( difftype_t dt, short *outvalue, const short *invalue, int count ) +// color32 +template<> +inline CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const color32 *outvalue, const color32 *invalue, int count ) { - if ( m_pWatchField != m_pCurrentField ) - return; + for ( int i = 0; i < count; i++ ) + { + if ( outvalue[ i ] != invalue[ i ] ) + return DIFFERS; + } + return IDENTICAL; +} - WatchMsg( "short (%i)", (int)(outvalue[0]) ); +template< class T > +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const T *outvalue, const T *invalue, int count ) +{ + Assert( 0 ); } -#if defined( CLIENT_DLL ) -#include "cdll_int.h" +// short +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const short *outvalue, const short *invalue, int count ) +{ + if ( difftype == DIFFERS ) + { + int i = 0; + ReportFieldsDiffer( pCurrentMap, pField, "short differs (net %i pred %i) diff(%i)\n", (int)(invalue[i]), (int)(outvalue[i]), (int)(outvalue[i] - invalue[i]) ); + } -#endif + OutputFieldDescription( pCurrentMap, pField, difftype, "short (%i)\n", (int)(outvalue[0]) ); +} -void CPredictionCopy::DescribeInt( difftype_t dt, int *outvalue, const int *invalue, int count ) +// int +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const int *outvalue, const int *invalue, int count ) { - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) + if ( difftype == DIFFERS ) { int i = 0; - ReportFieldsDiffer( "int differs (net %i pred %i) diff(%i)\n", invalue[i], outvalue[i], outvalue[i] - invalue[i] ); + ReportFieldsDiffer( pCurrentMap, pField, "int differs (net %i pred %i) diff(%i)\n", invalue[i], outvalue[i], outvalue[i] - invalue[i] ); } -#if defined( CLIENT_DLL ) bool described = false; - if ( m_pCurrentField->flags & FTYPEDESC_MODELINDEX ) + if ( pField->flags & FTYPEDESC_MODELINDEX ) { int modelindex = outvalue[0]; model_t const *m = modelinfo->GetModel( modelindex ); @@ -312,280 +568,98 @@ void CPredictionCopy::DescribeInt( difftype_t dt, int *outvalue, const int *inva shortfile[ 0 ] = 0; Q_FileBase( modelinfo->GetModelName( m ), shortfile, sizeof( shortfile ) ); - DescribeFields( dt, "integer (%i->%s)\n", outvalue[0], shortfile ); + OutputFieldDescription( pCurrentMap, pField, difftype, "integer (%i->%s)\n", outvalue[0], shortfile ); } } if ( !described ) { - DescribeFields( dt, "integer (%i)\n", outvalue[0] ); + OutputFieldDescription( pCurrentMap, pField, difftype, "integer (%i)\n", outvalue[0] ); } -#else - DescribeFields( dt, "integer (%i)\n", outvalue[0] ); -#endif } -void CPredictionCopy::WatchInt( difftype_t dt, int *outvalue, const int *invalue, int count ) +// bool +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const bool *outvalue, const bool *invalue, int count ) { - if ( m_pWatchField != m_pCurrentField ) - return; + if ( difftype == DIFFERS ) + { + int i = 0; + ReportFieldsDiffer( pCurrentMap, pField, "bool differs (net %s pred %s)\n", (invalue[i]) ? "true" : "false", (outvalue[i]) ? "true" : "false" ); + } -#if defined( CLIENT_DLL ) - bool described = false; - if ( m_pCurrentField->flags & FTYPEDESC_MODELINDEX ) - { - int modelindex = outvalue[0]; - model_t const *m = modelinfo->GetModel( modelindex ); - if ( m ) - { - described = true; - char shortfile[ 512 ]; - shortfile[ 0 ] = 0; - Q_FileBase( modelinfo->GetModelName( m ), shortfile, sizeof( shortfile ) ); - - WatchMsg( "integer (%i->%s)", outvalue[0], shortfile ); - } - } - - if ( !described ) - { - WatchMsg( "integer (%i)", outvalue[0] ); - } -#else - WatchMsg( "integer (%i)", outvalue[0] ); -#endif -} - -void CPredictionCopy::DescribeBool( difftype_t dt, bool *outvalue, const bool *invalue, int count ) -{ - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) - { - int i = 0; - ReportFieldsDiffer( "bool differs (net %s pred %s)\n", (invalue[i]) ? "true" : "false", (outvalue[i]) ? "true" : "false" ); - } - - DescribeFields( dt, "bool (%s)\n", (outvalue[0]) ? "true" : "false" ); -} - - -void CPredictionCopy::WatchBool( difftype_t dt, bool *outvalue, const bool *invalue, int count ) -{ - if ( m_pWatchField != m_pCurrentField ) - return; - - WatchMsg( "bool (%s)", (outvalue[0]) ? "true" : "false" ); -} - -void CPredictionCopy::DescribeFloat( difftype_t dt, float *outvalue, const float *invalue, int count ) -{ - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) + OutputFieldDescription( pCurrentMap, pField, difftype, "bool (%s)\n", (outvalue[0]) ? "true" : "false" ); +} + +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const float *outvalue, const float *invalue, int count ) +{ + if ( difftype == DIFFERS ) { int i = 0; - ReportFieldsDiffer( "float differs (net %f pred %f) diff(%f)\n", invalue[ i ], outvalue[ i ], outvalue[ i ] - invalue[ i ] ); - } - - DescribeFields( dt, "float (%f)\n", outvalue[ 0 ] ); -} - -void CPredictionCopy::WatchFloat( difftype_t dt, float *outvalue, const float *invalue, int count ) -{ - if ( m_pWatchField != m_pCurrentField ) - return; - - WatchMsg( "float (%f)", outvalue[ 0 ] ); -} - -void CPredictionCopy::DescribeString( difftype_t dt, char *outstring, const char *instring ) -{ - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) - { - ReportFieldsDiffer( "string differs (net %s pred %s)\n", instring, outstring ); + ReportFieldsDiffer( pCurrentMap, pField, "float differs (net %f pred %f) diff(%f)\n", invalue[ i ], outvalue[ i ], outvalue[ i ] - invalue[ i ] ); } - DescribeFields( dt, "string (%s)\n", outstring ); -} - -void CPredictionCopy::WatchString( difftype_t dt, char *outstring, const char *instring ) -{ - if ( m_pWatchField != m_pCurrentField ) - return; - - WatchMsg( "string (%s)", outstring ); + OutputFieldDescription( pCurrentMap, pField, difftype, "float (%f)\n", outvalue[ 0 ] ); } -void CPredictionCopy::DescribeVector( difftype_t dt, Vector& outValue, const Vector &inValue ) +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const char *outstring, const char *instring, int count ) { - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) + if ( difftype == DIFFERS ) { - Vector delta = outValue - inValue; - - ReportFieldsDiffer( "vec differs (net %f %f %f - pred %f %f %f) delta(%f %f %f)\n", - inValue.x, inValue.y, inValue.z, - outValue.x, outValue.y, outValue.z, - delta.x, delta.y, delta.z ); + ReportFieldsDiffer( pCurrentMap, pField, "string differs (net %s pred %s)\n", instring, outstring ); } - DescribeFields( dt, "vector (%f %f %f)\n", - outValue.x, outValue.y, outValue.z ); + OutputFieldDescription( pCurrentMap, pField, difftype, "string (%s)\n", outstring ); } -void CPredictionCopy::DescribeVector( difftype_t dt, Vector* outValue, const Vector *inValue, int count ) +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const Vector *outValue, const Vector *inValue, int count ) { - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) + if ( difftype == DIFFERS ) { int i = 0; Vector delta = outValue[ i ] - inValue[ i ]; - - ReportFieldsDiffer( "vec[] differs (1st diff) (net %f %f %f - pred %f %f %f) delta(%f %f %f)\n", + ReportFieldsDiffer( pCurrentMap, pField, "vec[] differs (1st diff) (net %f %f %f - pred %f %f %f) delta(%f %f %f)\n", inValue[i].x, inValue[i].y, inValue[i].z, outValue[i].x, outValue[i].y, outValue[i].z, delta.x, delta.y, delta.z ); } - - DescribeFields( dt, "vector (%f %f %f)\n", - outValue[0].x, outValue[0].y, outValue[0].z ); -} - -void CPredictionCopy::WatchVector( difftype_t dt, Vector& outValue, const Vector &inValue ) -{ - if ( m_pWatchField != m_pCurrentField ) - return; - - WatchMsg( "vector (%f %f %f)", outValue.x, outValue.y, outValue.z ); -} - -void CPredictionCopy::WatchVector( difftype_t dt, Vector* outValue, const Vector *inValue, int count ) -{ - if ( m_pWatchField != m_pCurrentField ) - return; - - WatchMsg( "vector (%f %f %f)", outValue[0].x, outValue[0].y, outValue[0].z ); -} - - - -void CPredictionCopy::DescribeQuaternion( difftype_t dt, Quaternion& outValue, const Quaternion &inValue ) -{ - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) - { - Quaternion delta; - - for ( int i = 0; i < 4; i++ ) - { - delta[i] = outValue[i] - inValue[i]; - } - - ReportFieldsDiffer( "quaternion differs (net %f %f %f %f - pred %f %f %f %f) delta(%f %f %f %f)\n", - inValue[0], inValue[1], inValue[2], inValue[3], - outValue[0], outValue[1], outValue[2], outValue[3], - delta[0], delta[1], delta[2], delta[3] ); - } - - DescribeFields( dt, "quaternion (%f %f %f %f)\n", - outValue[0], outValue[1], outValue[2], outValue[3] ); + OutputFieldDescription( pCurrentMap, pField, difftype, "vector (%f %f %f)\n", + outValue[0].x, outValue[0].y, outValue[0].z ); } -void CPredictionCopy::DescribeQuaternion( difftype_t dt, Quaternion* outValue, const Quaternion *inValue, int count ) +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const Quaternion *outValue, const Quaternion *inValue, int count ) { - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) + if ( difftype == DIFFERS ) { int i = 0; Quaternion delta; - for ( int j = 0; j < 4; j++ ) { delta[i] = outValue[i][j] - inValue[i][j]; } - ReportFieldsDiffer( "quaternion[] differs (1st diff) (net %f %f %f %f - pred %f %f %f %f) delta(%f %f %f %f)\n", - inValue->x, inValue->y, inValue->z, inValue->w, - outValue->x, outValue->y, outValue->z, outValue->w, - delta.x, delta.y, delta.z, delta.w ); + ReportFieldsDiffer( pCurrentMap, pField, "quaternion[] differs (1st diff) (net %f %f %f %f - pred %f %f %f %f) delta(%f %f %f %f)\n", + inValue[i].x, inValue[i].y, inValue[i].z, inValue[i].w, + outValue[i].x, outValue[i].y, outValue[i].z, outValue[i].w, + delta[0], delta[1], delta[2], delta[3] ); } - DescribeFields( dt, "quaternion (%f %f %f %f)\n", - outValue->x, outValue->y, outValue->z, outValue->w ); -} - -void CPredictionCopy::WatchQuaternion( difftype_t dt, Quaternion& outValue, const Quaternion &inValue ) -{ - if ( m_pWatchField != m_pCurrentField ) - return; - - WatchMsg( "quaternion (%f %f %f %f)", outValue[0], outValue[1], outValue[2], outValue[3] ); + OutputFieldDescription( pCurrentMap, pField, difftype, "quaternion (%f %f %f %f)\n", outValue[0][0], outValue[0][1], outValue[0][2], outValue[3] ); } -void CPredictionCopy::WatchQuaternion( difftype_t dt, Quaternion* outValue, const Quaternion *inValue, int count ) +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const EHANDLE *outvalue, EHANDLE const *invalue, int count ) { - if ( m_pWatchField != m_pCurrentField ) - return; - - WatchMsg( "quaternion (%f %f %f %f)", outValue[0][0], outValue[0][1], outValue[0][2], outValue[0][3] ); -} - - - -void CPredictionCopy::DescribeEHandle( difftype_t dt, EHANDLE *outvalue, EHANDLE const *invalue, int count ) -{ - if ( !m_bErrorCheck ) - return; - - if ( dt == DIFFERS ) + if ( difftype == DIFFERS ) { int i = 0; - ReportFieldsDiffer( "EHandles differ (net) 0x%p (pred) 0x%p\n", (void const *)invalue[ i ].Get(), (void *)outvalue[ i ].Get() ); - } - -#if defined( CLIENT_DLL ) - C_BaseEntity *ent = outvalue[0].Get(); - if ( ent ) - { - const char *classname = ent->GetClassname(); - if ( !classname[0] ) - { - classname = typeid( *ent ).name(); - } - - DescribeFields( dt, "EHandle (0x%p->%s)", (void *)outvalue[ 0 ], classname ); + ReportFieldsDiffer( pCurrentMap, pField, "EHandles differ (net) 0x%p (pred) 0x%p\n", (void const *)invalue[ i ].Get(), (void *)outvalue[ i ].Get() ); } - else - { - DescribeFields( dt, "EHandle (NULL)" ); - } - -#else - DescribeFields( dt, "EHandle (0x%p)", (void *)outvalue[ 0 ] ); -#endif - -} -void CPredictionCopy::WatchEHandle( difftype_t dt, EHANDLE *outvalue, EHANDLE const *invalue, int count ) -{ - if ( m_pWatchField != m_pCurrentField ) - return; - -#if defined( CLIENT_DLL ) C_BaseEntity *ent = outvalue[0].Get(); if ( ent ) { @@ -595,733 +669,229 @@ void CPredictionCopy::WatchEHandle( difftype_t dt, EHANDLE *outvalue, EHANDLE co classname = typeid( *ent ).name(); } - WatchMsg( "EHandle (0x%p->%s)", (void *)outvalue[ 0 ], classname ); + OutputFieldDescription( pCurrentMap, pField, difftype, "EHandle (0x%p->%s)", (void *)outvalue[ 0 ], classname ); } else { - WatchMsg( "EHandle (NULL)" ); + OutputFieldDescription( pCurrentMap, pField, difftype, "EHandle (NULL)" ); } - -#else - WatchMsg( "EHandle (0x%p)", (void *)outvalue[ 0 ] ); -#endif - -} - -void CPredictionCopy::CopyShort( difftype_t dt, short *outvalue, const short *invalue, int count ) -{ - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - CopyData( dt, sizeof(short) * count, (char *)outvalue, (const char *)invalue ); } -CPredictionCopy::difftype_t CPredictionCopy::CompareShort( short *outvalue, const short *invalue, int count ) +// color32 +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const color32 *outvalue, const color32 *invalue, int count ) { - if ( !m_bErrorCheck ) - return DIFFERS; - - if ( CanCheck() ) + if ( difftype == DIFFERS ) { - for ( int i = 0; i < count; i++ ) - { - if ( outvalue[ i ] == invalue[ i ] ) - continue; - - return DIFFERS; - } + ReportFieldsDiffer( pCurrentMap, pField, "color differs (net %d %d %d %d pred %d %d %d %d)\n", + outvalue[ 0 ].r, + outvalue[ 0 ].g, + outvalue[ 0 ].b, + outvalue[ 0 ].a, + invalue[ 0 ].r, + invalue[ 0 ].g, + invalue[ 0 ].b, + invalue[ 0 ].a + ); } - return IDENTICAL; -} - - -void CPredictionCopy::CopyInt( difftype_t dt, int *outvalue, const int *invalue, int count ) -{ - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - CopyData( dt, sizeof(int) * count, (char *)outvalue, (const char *)invalue ); + OutputFieldDescription( pCurrentMap, pField, difftype, "color (%d %d %d %d)\n", + outvalue[ 0 ].r, + outvalue[ 0 ].g, + outvalue[ 0 ].b, + outvalue[ 0 ].a ); } -CPredictionCopy::difftype_t CPredictionCopy::CompareInt( int *outvalue, const int *invalue, int count ) +template<> +inline void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const uint8 *outstring, const uint8 *instring, int count ) { - if ( !m_bErrorCheck ) - return DIFFERS; - - if ( CanCheck() ) + if ( difftype == DIFFERS ) { - for ( int i = 0; i < count; i++ ) - { - if ( outvalue[ i ] == invalue[ i ] ) - continue; - - ReportFieldsDiffer( "int differs (net %i pred %i) diff(%i)\n", invalue[i], outvalue[i], outvalue[i] - invalue[i] ); - return DIFFERS; - } + ReportFieldsDiffer( pCurrentMap, pField, "byte differs (net %d pred %d)\n", int(instring[0]), int(outstring[0]) ); } - return IDENTICAL; + OutputFieldDescription( pCurrentMap, pField, difftype, "byte (%d)\n", int(outstring[0]) ); } -void CPredictionCopy::CopyBool( difftype_t dt, bool *outvalue, const bool *invalue, int count ) +//----------------------------------------------------------------------------- +// Purpose: +// Input : *fmt - +// ... - +//----------------------------------------------------------------------------- +void CPredictionCopy::ReportFieldsDiffer( const datamap_t *pCurrentMap, const typedescription_t *pField, const char *fmt, ... ) { - if ( !m_bPerformCopy ) - return; + ++m_nErrorCount; - if ( dt == IDENTICAL ) + if ( m_FieldCompareFunc ) return; - CopyData( dt, sizeof( bool ) * count, (char *)outvalue, (const char *)invalue ); -} - -CPredictionCopy::difftype_t CPredictionCopy::CompareBool( bool *outvalue, const bool *invalue, int count ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; + const char *fieldname = "empty"; + const char *classname = "empty"; + int flags = 0; - if ( CanCheck() ) + if ( pField ) { - for ( int i = 0; i < count; i++ ) - { - if ( outvalue[ i ] == invalue[ i ] ) - continue; - - return DIFFERS; - } + flags = pField->flags; + fieldname = pField->fieldName ? pField->fieldName : "NULL"; + classname = pCurrentMap->dataClassName; } - return IDENTICAL; -} - -void CPredictionCopy::CopyFloat( difftype_t dt, float *outvalue, const float *invalue, int count ) -{ - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - CopyData( dt, sizeof( float ) * count, (char *)outvalue, (const char *)invalue ); -} - -CPredictionCopy::difftype_t CPredictionCopy::CompareFloat( float *outvalue, const float *invalue, int count ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; - - difftype_t retval = IDENTICAL; + va_list argptr; + char data[ 4096 ]; + int len; + va_start(argptr, fmt); + len = Q_vsnprintf(data, sizeof( data ), fmt, argptr); + va_end(argptr); - if ( CanCheck() ) + bool bUseLongName = cl_pred_error_verbose.GetBool(); + CUtlString longName; + for ( int i = 0; i < m_FieldStack.Count(); ++i ) { - float tolerance = m_pCurrentField->fieldTolerance; - Assert( tolerance >= 0.0f ); - bool usetolerance = tolerance > 0.0f; - - for ( int i = 0; i < count; i++ ) - { - if ( outvalue[ i ] == invalue[ i ] ) - continue; + const typedescription_t *top = m_FieldStack[ i ]; + if ( !top ) + continue; - if ( usetolerance && - ( fabs( outvalue[ i ] - invalue[ i ] ) <= tolerance ) ) - { - retval = WITHINTOLERANCE; - continue; - } + if ( top->flags & FTYPEDESC_KEY ) + bUseLongName = true; - return DIFFERS; - } + longName += top->fieldName ? top->fieldName : "NULL"; + longName += "/"; } - return retval; -} - -void CPredictionCopy::CopyString( difftype_t dt, char *outstring, const char *instring ) -{ - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - CopyData( dt, Q_strlen( instring ) + 1, (char *)outstring, (const char *)instring ); -} - -CPredictionCopy::difftype_t CPredictionCopy::CompareString( char *outstring, const char *instring ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; - - if ( CanCheck() ) + if ( bUseLongName ) + { + Msg( "%2d (%d)%s%s::%s - %s", + m_nErrorCount, + m_nEntIndex, + longName.String(), + classname, + fieldname, + data ); + } + else { - if ( Q_strcmp( outstring, instring ) ) - { - return DIFFERS; - } + Msg( "%2d (%d)%s::%s - %s", + m_nErrorCount, + m_nEntIndex, + classname, + fieldname, + data ); } - - return IDENTICAL; -} - -void CPredictionCopy::CopyVector( difftype_t dt, Vector& outValue, const Vector &inValue ) -{ - CopyVector( dt, &outValue, &inValue, 1 ); } -void CPredictionCopy::CopyQuaternion( difftype_t dt, Quaternion& outValue, const Quaternion &inValue ) -{ - CopyQuaternion( dt, &outValue, &inValue, 1 ); -} - -CPredictionCopy::difftype_t CPredictionCopy::CompareVector( Vector& outValue, const Vector &inValue ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; - - if ( CanCheck() ) - { - float tolerance = m_pCurrentField->fieldTolerance; - Assert( tolerance >= 0.0f ); - - if ( outValue != inValue && ( tolerance > 0.0f ) ) - { - Vector delta = outValue - inValue; - - if ( fabs( delta.x ) <= tolerance && - fabs( delta.y ) <= tolerance && - fabs( delta.z ) <= tolerance ) - { - return WITHINTOLERANCE; - } - } - - return DIFFERS; - } - - return IDENTICAL; -} - -static int QuaternionCompare (const Quaternion& q1, const Quaternion& q2 ) -{ - for ( int i = 0; i < 4; i++ ) - { - if ( q1[i] != q2[i] ) - return 0; - } - - return 1; -} - -CPredictionCopy::difftype_t CPredictionCopy::CompareQuaternion( Quaternion& outValue, const Quaternion &inValue ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; - - if ( CanCheck() ) - { - float tolerance = m_pCurrentField->fieldTolerance; - Assert( tolerance >= 0.0f ); - - if ( QuaternionCompare( outValue, inValue ) == 0 - && ( tolerance > 0.0f ) ) - { - Quaternion delta; - - for ( int j = 0; j < 4; j++ ) - { - delta[j] = outValue[j] - inValue[j]; - } - - if ( fabs( delta[0] ) <= tolerance && - fabs( delta[1] ) <= tolerance && - fabs( delta[2] ) <= tolerance && - fabs( delta[3] ) <= tolerance ) - { - return WITHINTOLERANCE; - } - } - - return DIFFERS; - } - - return IDENTICAL; -} - -void CPredictionCopy::CopyVector( difftype_t dt, Vector* outValue, const Vector *inValue, int count ) -{ - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - CopyData( dt, sizeof( Vector ) * count, (char *)outValue, (const char *)inValue ); -} - -void CPredictionCopy::CopyQuaternion( difftype_t dt, Quaternion* outValue, const Quaternion *inValue, int count ) -{ - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - CopyData( dt, sizeof( Quaternion ) * count, (char *)outValue, (const char *)inValue ); -} - - -CPredictionCopy::difftype_t CPredictionCopy::CompareVector( Vector* outValue, const Vector *inValue, int count ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; - - difftype_t retval = IDENTICAL; - - if ( CanCheck() ) - { - float tolerance = m_pCurrentField->fieldTolerance; - Assert( tolerance >= 0.0f ); - - for ( int i = 0; i < count; i++ ) - { - if ( outValue[ i ] == inValue[ i ] ) - continue; - - Vector delta = outValue[ i ] - inValue[ i ]; - - if ( tolerance > 0.0f ) - { - if ( fabs( delta.x ) <= tolerance && - fabs( delta.y ) <= tolerance && - fabs( delta.z ) <= tolerance ) - { - retval = WITHINTOLERANCE; - continue; - } - } - return DIFFERS; - } - } - - return retval; -} - -CPredictionCopy::difftype_t CPredictionCopy::CompareQuaternion( Quaternion* outValue, const Quaternion *inValue, int count ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; - - difftype_t retval = IDENTICAL; - - if ( CanCheck() ) - { - float tolerance = m_pCurrentField->fieldTolerance; - Assert( tolerance >= 0.0f ); - - for ( int i = 0; i < count; i++ ) - { - if ( QuaternionCompare( outValue[ i ], inValue[ i ] ) ) - continue; - - Quaternion delta; - - for ( int j = 0; j < 4; j++ ) - { - delta[i] = outValue[i][j] - inValue[i][j]; - } - - if ( tolerance > 0.0f ) - { - if ( fabs( delta[0] ) <= tolerance && - fabs( delta[1] ) <= tolerance && - fabs( delta[2] ) <= tolerance && - fabs( delta[3] ) <= tolerance ) - { - retval = WITHINTOLERANCE; - continue; - } - } - return DIFFERS; - } - } - - return retval; -} - -void CPredictionCopy::CopyEHandle( difftype_t dt, EHANDLE *outvalue, EHANDLE const *invalue, int count ) -{ - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - for ( int i = 0; i < count; i++ ) - { - outvalue[ i ] = invalue[ i ]; - } -} - -CPredictionCopy::difftype_t CPredictionCopy::CompareEHandle( EHANDLE *outvalue, EHANDLE const *invalue, int count ) -{ - if ( !m_bErrorCheck ) - return DIFFERS; - - int i; - if ( CanCheck() ) - { - for ( i = 0; i < count; i++ ) - { - if ( outvalue[ i ].Get() == invalue[ i ].Get() ) - continue; - - return DIFFERS; - } - } - - return IDENTICAL; -} - -void CPredictionCopy::CopyFields( int chain_count, datamap_t *pRootMap, typedescription_t *pFields, int fieldCount ) -{ - int i; - int flags; - int fieldOffsetSrc; - int fieldOffsetDest; - int fieldSize; - - m_pCurrentMap = pRootMap; - if ( !m_pCurrentClassName ) - { - m_pCurrentClassName = pRootMap->dataClassName; - } - - for ( i = 0; i < fieldCount; i++ ) - { - m_pCurrentField = &pFields[ i ]; - flags = m_pCurrentField->flags; - - // Mark any subchains first - if ( m_pCurrentField->override_field != NULL ) - { - m_pCurrentField->override_field->override_count = chain_count; - } - - // Skip this field? - if ( m_pCurrentField->override_count == chain_count ) - { - continue; - } - - // Always recurse into embeddeds - if ( m_pCurrentField->fieldType != FIELD_EMBEDDED ) - { - // Don't copy fields that are private to server or client - if ( flags & FTYPEDESC_PRIVATE ) - continue; - - // For PC_NON_NETWORKED_ONLYs skip any fields that are present in the network send tables - if ( m_nType == PC_NON_NETWORKED_ONLY && ( flags & FTYPEDESC_INSENDTABLE ) ) - continue; - - // For PC_NETWORKED_ONLYs skip any fields that are not present in the network send tables - if ( m_nType == PC_NETWORKED_ONLY && !( flags & FTYPEDESC_INSENDTABLE ) ) - continue; - } - - void *pOutputData; - void const *pInputData; - - fieldOffsetDest = m_pCurrentField->fieldOffset[ m_nDestOffsetIndex ]; - fieldOffsetSrc = m_pCurrentField->fieldOffset[ m_nSrcOffsetIndex ]; - fieldSize = m_pCurrentField->fieldSize; - - pOutputData = (void *)((char *)m_pDest + fieldOffsetDest ); - pInputData = (void const *)((char *)m_pSrc + fieldOffsetSrc ); - - // Assume we can report - m_bShouldReport = m_bReportErrors; - m_bShouldDescribe = true; - - bool bShouldWatch = m_pWatchField == m_pCurrentField; - - difftype_t difftype; - - switch( m_pCurrentField->fieldType ) - { - case FIELD_EMBEDDED: - { - typedescription_t *save = m_pCurrentField; - void *saveDest = m_pDest; - void const *saveSrc = m_pSrc; - const char *saveName = m_pCurrentClassName; - - m_pCurrentClassName = m_pCurrentField->td->dataClassName; - - // FIXME: Should this be done outside the FIELD_EMBEDDED case?? - // Don't follow the pointer if we're reading from a compressed packet - m_pSrc = pInputData; - if ( ( flags & FTYPEDESC_PTR ) && (m_nSrcOffsetIndex == PC_DATA_NORMAL) ) - { - m_pSrc = *((void**)m_pSrc); - } - - m_pDest = pOutputData; - if ( ( flags & FTYPEDESC_PTR ) && (m_nDestOffsetIndex == PC_DATA_NORMAL) ) - { - m_pDest = *((void**)m_pDest); - } - - CopyFields( chain_count, pRootMap, m_pCurrentField->td->dataDesc, m_pCurrentField->td->dataNumFields ); - - m_pCurrentClassName = saveName; - m_pCurrentField = save; - m_pDest = saveDest; - m_pSrc = saveSrc; - } - break; - case FIELD_FLOAT: - { - difftype = CompareFloat( (float *)pOutputData, (float const *)pInputData, fieldSize ); - CopyFloat( difftype, (float *)pOutputData, (float const *)pInputData, fieldSize ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeFloat( difftype, (float *)pOutputData, (float const *)pInputData, fieldSize ); - if ( bShouldWatch ) WatchFloat( difftype, (float *)pOutputData, (float const *)pInputData, fieldSize ); - } - break; - - case FIELD_TIME: - case FIELD_TICK: - Assert( 0 ); - break; - - case FIELD_STRING: - { - difftype = CompareString( (char *)pOutputData, (char const*)pInputData ); - CopyString( difftype, (char *)pOutputData, (char const*)pInputData ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeString( difftype,(char *)pOutputData, (char const*)pInputData ); - if ( bShouldWatch ) WatchString( difftype,(char *)pOutputData, (char const*)pInputData ); - } - break; - - case FIELD_MODELINDEX: - Assert( 0 ); - break; - - case FIELD_MODELNAME: - case FIELD_SOUNDNAME: - Assert( 0 ); - break; - - case FIELD_CUSTOM: - Assert( 0 ); - break; - - case FIELD_CLASSPTR: - case FIELD_EDICT: - Assert( 0 ); - break; - - case FIELD_POSITION_VECTOR: - Assert( 0 ); - break; - - case FIELD_VECTOR: - { - difftype = CompareVector( (Vector *)pOutputData, (Vector const *)pInputData, fieldSize ); - CopyVector( difftype, (Vector *)pOutputData, (Vector const *)pInputData, fieldSize ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeVector( difftype, (Vector *)pOutputData, (Vector const *)pInputData, fieldSize ); - if ( bShouldWatch ) WatchVector( difftype, (Vector *)pOutputData, (Vector const *)pInputData, fieldSize ); - } - break; - - case FIELD_QUATERNION: - { - difftype = CompareQuaternion( (Quaternion *)pOutputData, (Quaternion const *)pInputData, fieldSize ); - CopyQuaternion( difftype, (Quaternion *)pOutputData, (Quaternion const *)pInputData, fieldSize ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeQuaternion( difftype, (Quaternion *)pOutputData, (Quaternion const *)pInputData, fieldSize ); - if ( bShouldWatch ) WatchQuaternion( difftype, (Quaternion *)pOutputData, (Quaternion const *)pInputData, fieldSize ); - } - break; - - case FIELD_COLOR32: - { - difftype = CompareData( 4*fieldSize, (char *)pOutputData, (const char *)pInputData ); - CopyData( difftype, 4*fieldSize, (char *)pOutputData, (const char *)pInputData ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeData( difftype, 4*fieldSize, (char *)pOutputData, (const char *)pInputData ); - if ( bShouldWatch ) WatchData( difftype, 4*fieldSize, (char *)pOutputData, (const char *)pInputData ); - } - break; - - case FIELD_BOOLEAN: - { - difftype = CompareBool( (bool *)pOutputData, (bool const *)pInputData, fieldSize ); - CopyBool( difftype, (bool *)pOutputData, (bool const *)pInputData, fieldSize ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeBool( difftype, (bool *)pOutputData, (bool const *)pInputData, fieldSize ); - if ( bShouldWatch ) WatchBool( difftype, (bool *)pOutputData, (bool const *)pInputData, fieldSize ); - } - break; - - case FIELD_INTEGER: - { - difftype = CompareInt( (int *)pOutputData, (int const *)pInputData, fieldSize ); - CopyInt( difftype, (int *)pOutputData, (int const *)pInputData, fieldSize ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeInt( difftype, (int *)pOutputData, (int const *)pInputData, fieldSize ); - if ( bShouldWatch ) WatchInt( difftype, (int *)pOutputData, (int const *)pInputData, fieldSize ); - } - break; - - case FIELD_SHORT: - { - difftype = CompareShort( (short *)pOutputData, (short const *)pInputData, fieldSize ); - CopyShort( difftype, (short *)pOutputData, (short const *)pInputData, fieldSize ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeShort( difftype, (short *)pOutputData, (short const *)pInputData, fieldSize ); - if ( bShouldWatch ) WatchShort( difftype, (short *)pOutputData, (short const *)pInputData, fieldSize ); - } - break; - - case FIELD_CHARACTER: - { - difftype = CompareData( fieldSize, ((char *)pOutputData), (const char *)pInputData ); - CopyData( difftype, fieldSize, ((char *)pOutputData), (const char *)pInputData ); - - int valOut = *((char *)pOutputData); - int valIn = *((const char *)pInputData); - - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeInt( difftype, &valOut, &valIn, fieldSize ); - if ( bShouldWatch ) WatchData( difftype, fieldSize, ((char *)pOutputData), (const char *)pInputData ); - } - break; - case FIELD_EHANDLE: - { - difftype = CompareEHandle( (EHANDLE *)pOutputData, (EHANDLE const *)pInputData, fieldSize ); - CopyEHandle( difftype, (EHANDLE *)pOutputData, (EHANDLE const *)pInputData, fieldSize ); - if ( m_bErrorCheck && m_bShouldDescribe ) DescribeEHandle( difftype, (EHANDLE *)pOutputData, (EHANDLE const *)pInputData, fieldSize ); - if ( bShouldWatch ) WatchEHandle( difftype, (EHANDLE *)pOutputData, (EHANDLE const *)pInputData, fieldSize ); - } - break; - case FIELD_FUNCTION: - { - Assert( 0 ); - } - break; - case FIELD_VOID: - { - // Don't do anything, it's an empty data description - } - break; - default: - { - Warning( "Bad field type\n" ); - Assert(0); - } - break; - } - } - - m_pCurrentClassName = NULL; -} - -void CPredictionCopy::TransferData_R( int chaincount, datamap_t *dmap ) -{ - // Copy from here first, then baseclasses - CopyFields( chaincount, dmap, dmap->dataDesc, dmap->dataNumFields ); - - if ( dmap->baseMap ) - { - TransferData_R( chaincount, dmap->baseMap ); - } -} - -static int g_nChainCount = 1; - -static typedescription_t *FindFieldByName_R( const char *fieldname, datamap_t *dmap ) -{ - int c = dmap->dataNumFields; - for ( int i = 0; i < c; i++ ) - { - typedescription_t *td = &dmap->dataDesc[ i ]; - if ( td->fieldType == FIELD_VOID ) - continue; - - if ( td->fieldType == FIELD_EMBEDDED ) - { - // TODO: this will only find the first subclass with the variable of the specified name - // At some point we might want to support multiple levels of overriding automatically - typedescription_t *ret = FindFieldByName_R( fieldname, td->td ); - if ( ret ) - { - return ret; - } - } +//----------------------------------------------------------------------------- +// Purpose: +// Input : *fmt - +// ... - +//----------------------------------------------------------------------------- +void CPredictionCopy::OutputFieldDescription( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t dt, const char *fmt, ... ) +{ + if ( !m_FieldCompareFunc ) + return; - if ( !stricmp( td->fieldName, fieldname ) ) - { - return td; - } - } + const char *fieldname = "empty"; + const char *classname = "empty"; + int flags = 0; - if ( dmap->baseMap ) + if ( pField ) { - return FindFieldByName_R( fieldname, dmap->baseMap ); + flags = pField->flags; + fieldname = pField->fieldName ? pField->fieldName : "NULL"; + classname = pCurrentMap->dataClassName; } - return NULL; + + va_list argptr; + char data[ 4096 ]; + int len; + va_start(argptr, fmt); + len = Q_vsnprintf(data, sizeof( data ), fmt, argptr); + va_end(argptr); + + bool isnetworked = ( flags & FTYPEDESC_INSENDTABLE ) ? true : false; + bool isnoterrorchecked = ( flags & FTYPEDESC_NOERRORCHECK ) ? true : false; + + ( *m_FieldCompareFunc )( + classname, + fieldname, + g_FieldTypes[ pField->fieldType ], + isnetworked, + isnoterrorchecked, + dt != IDENTICAL ? true : false, + dt == WITHINTOLERANCE ? true : false, + data + ); } -void ValidateChains_R( datamap_t *dmap ) +void CPredictionCopy::DescribeFields( const CUtlVector< const datamap_t * > &vecGroups, const datamap_t *pCurrentMap, int nPredictionCopyType ) { - dmap->chains_validated = true; + int i; + int flags; + int fieldOffsetSrc; + int fieldOffsetDest; + int fieldSize; - int c = dmap->dataNumFields; - for ( int i = 0; i < c; i++ ) - { - typedescription_t *td = &dmap->dataDesc[ i ]; - if ( td->fieldType == FIELD_VOID ) - continue; + const flattenedoffsets_t &flat = pCurrentMap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat; + int fieldCount = flat.m_Flattened.Count(); + const typedescription_t * RESTRICT pField = &flat.m_Flattened[ 0 ]; + PREFETCH360(pField, 0); - if ( td->fieldType == FIELD_EMBEDDED ) + for ( i = 0; i < fieldCount; ++i, pField++ ) + { +#if _X360 + if ( !(i & 0xF) ) { - ValidateChains_R( td->td ); - continue; + PREFETCH360(pField, 128); } +#endif + flags = pField->flags; + int nFieldType = pField->fieldType; - if ( !( td->flags & FTYPEDESC_OVERRIDE ) ) - continue; + const byte * RESTRICT pOutputData; + const byte * RESTRICT pInputData; - if ( dmap->baseMap ) - { - typedescription_t *basefield = FindFieldByName_R( td->fieldName, dmap->baseMap ); - if ( basefield ) - { - td->override_field = basefield; - } - } - } + fieldOffsetDest = pField->flatOffset[ m_nSrcOffsetIndex ]; + fieldOffsetSrc = pField->flatOffset[ m_nDestOffsetIndex ]; + fieldSize = pField->fieldSize; - if ( dmap->baseMap ) - { - if ( !dmap->baseMap->chains_validated ) + pOutputData = (m_pDest + fieldOffsetDest ); + pInputData = (m_pSrc + fieldOffsetSrc ); + + const datamap_t *sourceGroup = pCurrentMap; + if ( pField->flatGroup >= 0 && pField->flatGroup < vecGroups.Count() ) { - ValidateChains_R( dmap->baseMap ); + sourceGroup = vecGroups[ pField->flatGroup ]; } + + PREDICTIONCOPY_APPLY( ProcessField_Describe, nFieldType, sourceGroup, pField, pOutputData, pInputData, fieldSize ); } } + //----------------------------------------------------------------------------- -// Purpose: +// Purpose: static method // Input : *fieldname - // *dmap - // Output : typedescription_t //----------------------------------------------------------------------------- -typedescription_t *FindFieldByName( const char *fieldname, datamap_t *dmap ) +// static method +const typedescription_t *CPredictionCopy::FindFlatFieldByName( const char *fieldname, const datamap_t *dmap ) { - return FindFieldByName_R( fieldname, dmap ); + PrepareDataMap( const_cast< datamap_t * >( dmap ) ); + + for ( int i = 0; i < PC_COPYTYPE_COUNT; ++i ) + { + const flattenedoffsets_t &flat = dmap->m_pOptimizedDataMap->m_Info[ i ].m_Flat; + int c = flat.m_Flattened.Count(); + for ( int j = 0; j < c; ++j ) + { + const typedescription_t *td = &flat.m_Flattened[ j ]; + if ( !Q_stricmp( td->fieldName, fieldname ) ) + { + return td; + } + } + } + return NULL; } static ConVar pwatchent( "pwatchent", "-1", FCVAR_CHEAT, "Entity to watch for prediction system changes." ); @@ -1332,9 +902,9 @@ static ConVar pwatchvar( "pwatchvar", "", FCVAR_CHEAT, "Entity variable to watch // Input : *fmt - // ... - //----------------------------------------------------------------------------- -void CPredictionCopy::WatchMsg( const char *fmt, ... ) +void CPredictionCopy::WatchMsg( const typedescription_t *pField, const char *fmt, ... ) { - Assert( m_pCurrentField && (m_pCurrentField == m_pWatchField) ); + Assert( pField ); Assert( m_pOperation ); va_list argptr; @@ -1344,7 +914,7 @@ void CPredictionCopy::WatchMsg( const char *fmt, ... ) len = Q_vsnprintf(data, sizeof( data ), fmt, argptr); va_end(argptr); - Msg( "%i %s %s : %s\n", gpGlobals->tickcount, m_pOperation, m_pCurrentField->fieldName, data ); + Msg( "%i %s %s : %s\n", gpGlobals->tickcount, m_pOperation, pField->fieldName, data ); } //----------------------------------------------------------------------------- @@ -1353,7 +923,7 @@ void CPredictionCopy::WatchMsg( const char *fmt, ... ) // entindex - // *dmap - //----------------------------------------------------------------------------- -void CPredictionCopy::DetermineWatchField( const char *operation, int entindex, datamap_t *dmap ) +void CPredictionCopy::DetermineWatchField( const char *operation, int entindex, const datamap_t *dmap ) { m_pWatchField = NULL; m_pOperation = operation; @@ -1371,873 +941,786 @@ void CPredictionCopy::DetermineWatchField( const char *operation, int entindex, if ( pwatchvar.GetString()[0] == 0 ) return; - m_pWatchField = FindFieldByName( pwatchvar.GetString(), dmap ); + m_pWatchField = CPredictionCopy::FindFlatFieldByName( pwatchvar.GetString(), dmap ); } -//----------------------------------------------------------------------------- -// Purpose: -// Input : *operation - -// entindex - -// *dmap - -// Output : int -//----------------------------------------------------------------------------- -int CPredictionCopy::TransferData( const char *operation, int entindex, datamap_t *dmap ) +static void RemoveFieldsByName( char const *pchFieldName, CUtlVector< typedescription_t > &build ) { - ++g_nChainCount; - - if ( !dmap->chains_validated ) + // Don't start at final field, since it the one we just added with FTYPEDESC_OVERRIDE + for ( int i = build.Count() - 2; i >= 0 ; --i ) { - ValidateChains_R( dmap ); - } - - DetermineWatchField( operation, entindex, dmap ); - - TransferData_R( g_nChainCount, dmap ); + // Embedded field "offsets" can be the same as their first data field, so don't remove + if ( build[ i ].fieldType == FIELD_EMBEDDED ) + continue; - return m_nErrorCount; + if ( !Q_stricmp( build[ i ].fieldName, pchFieldName ) ) + { + // Msg( "Removing %s %d due to override\n", build[ i ]->fieldName, build[ i ]->flatOffset[ TD_OFFSET_NORMAL ] ); + build.Remove( i ); + } + } } -/* -//----------------------------------------------------------------------------- -// Purpose: Simply dumps all data fields in object -//----------------------------------------------------------------------------- -class CPredictionDescribeData -{ -public: - CPredictionDescribeData( void const *src ); - - void DescribeShort( const short *invalue, int count ); - void DescribeInt( const int *invalue, int count ); - void DescribeBool( const bool *invalue, int count ); - void DescribeFloat( const float *invalue, int count ); - void DescribeData( int size, const char *indata ); - void DescribeString( const char *instring ); - void DescribeVector( const Vector &inValue ); - void DescribeVector( const Vector *inValue, int count ); - void DescribeEHandle( EHANDLE const *invalue, int count ); - - void DescribeFields( datamap_t *pMap, typedescription_t *pFields, int fieldCount ); - -private: - - void const *m_pSrc; - void Describe( const char *fmt, ... ); - - typedescription_t *m_pCurrentField; - char const *m_pCurrentClassName; - datamap_t *m_pCurrentMap; -}; -*/ - -CPredictionDescribeData::CPredictionDescribeData( void const *src, bool src_packed, FN_FIELD_DESCRIPTION func /*= 0*/ ) +static void BuildGroupList_R( int nPredictionCopyType, int nGroup, const datamap_t *dmap, CUtlVector< const datamap_t * > &vecGroups ) { - m_pSrc = src; - m_nSrcOffsetIndex = src_packed ? TD_OFFSET_PACKED : TD_OFFSET_NORMAL; - - m_pCurrentField = NULL; - m_pCurrentMap = NULL; - m_pCurrentClassName = NULL; - m_bShouldReport = false; + // Descend to base classes first so FTYPEDESC_OVERRIDE can remove the previous ones + if ( dmap->baseMap ) + { + BuildGroupList_R( nPredictionCopyType, nGroup + 1, dmap->baseMap, vecGroups ); + } - m_FieldDescFunc = func; + vecGroups.AddToTail( dmap ); } -//----------------------------------------------------------------------------- -// Purpose: -// Input : *fmt - -// ... - -//----------------------------------------------------------------------------- -void CPredictionDescribeData::Describe( const char *fmt, ... ) +static void BuildFlattenedChains_R( + int nPredictionCopyType, + int &nMaxGroupSeen, + int nGroup, + datamap_t *dmap, + CUtlVector< typedescription_t > &build, + int nBaseOffset ) { -// if ( !m_bShouldReport ) -// return; - - Assert( m_pCurrentMap ); - Assert( m_pCurrentClassName ); - - const char *fieldname = "empty"; - int flags = 0; - - if ( m_pCurrentField ) + // Descend to base classes first so FTYPEDESC_OVERRIDE can remove the previous ones + if ( dmap->baseMap ) { - flags = m_pCurrentField->flags; - fieldname = m_pCurrentField->fieldName ? m_pCurrentField->fieldName : "NULL"; + BuildFlattenedChains_R( nPredictionCopyType, nMaxGroupSeen, nGroup + 1, dmap->baseMap, build, nBaseOffset ); } - va_list argptr; - char data[ 4096 ]; - int len; - va_start(argptr, fmt); - len = Q_vsnprintf(data, sizeof( data ), fmt, argptr); - va_end(argptr); - - bool isprivate = ( flags & FTYPEDESC_PRIVATE ) ? true : false; - bool isnetworked = ( flags & FTYPEDESC_INSENDTABLE ) ? true : false; - - if ( m_FieldDescFunc ) + if ( nGroup > nMaxGroupSeen ) { - (*m_FieldDescFunc)( - m_pCurrentClassName, - m_pCurrentField->fieldName, - g_FieldTypes[ m_pCurrentField->fieldType ], - isnetworked, - data ); + nMaxGroupSeen = nGroup; } - else + + int c = dmap->dataNumFields; + for ( int i = 0; i < c; i++ ) { - char suffix[ 128 ]; + typedescription_t *pField = &dmap->dataDesc[ i ]; + if ( pField->fieldType == FIELD_VOID ) + continue; - suffix[ 0 ] = 0; - if ( isprivate ) + bool bAdd = true; + if ( pField->fieldType != FIELD_EMBEDDED ) { - Q_strncat( suffix, "private", sizeof( suffix ), COPY_ALL_CHARACTERS ); - } - if ( isnetworked ) - { - if ( suffix[ 0 ] ) + if ( pField->flags & FTYPEDESC_PRIVATE ) { - Q_strncat( suffix, " - ", sizeof( suffix ), COPY_ALL_CHARACTERS ); + if ( pField->flags & FTYPEDESC_OVERRIDE ) + { + // Find previous field targeting same offset + RemoveFieldsByName( pField->fieldName, build ); + } + continue; } - Q_strncat( suffix, "net", sizeof( suffix ), COPY_ALL_CHARACTERS ); - } - if ( suffix[ 0 ] ) - { - Msg( "%s::%s(%s) - %s", - m_pCurrentClassName, - fieldname, - suffix, - data ); + // For PC_NON_NETWORKED_ONLYs skip any fields that are present in the network send tables + if ( nPredictionCopyType == PC_NON_NETWORKED_ONLY && ( pField->flags & FTYPEDESC_INSENDTABLE ) ) + { + bAdd = false; + } + // For PC_NETWORKED_ONLYs skip any fields that are not present in the network send tables + if ( nPredictionCopyType == PC_NETWORKED_ONLY && !( pField->flags & FTYPEDESC_INSENDTABLE ) ) + { + bAdd = false; + } } else { - Msg( "%s::%s - %s", - m_pCurrentClassName, - fieldname, - data ); + bAdd = false; } - } - - m_bShouldReport = false; -} - -//----------------------------------------------------------------------------- -// Purpose: -// Input : size - -// *outdata - -// *indata - -//----------------------------------------------------------------------------- -void CPredictionDescribeData::DescribeData( int size, const char *indata ) -{ - if ( !indata ) - return; - - Describe( "binary (%i bytes)\n", size ); -} - - -void CPredictionDescribeData::DescribeShort( const short *invalue, int count ) -{ - Describe( "short (%i)\n", (int)(invalue[0]) ); -} - - -void CPredictionDescribeData::DescribeInt( const int *invalue, int count ) -{ - for ( int i = 0; i < count; ++i ) - { - Describe( "[%i] integer (%i)\n", i, invalue[i] ); - } -} - -void CPredictionDescribeData::DescribeBool( const bool *invalue, int count ) -{ - Describe( "bool (%s)\n", (invalue[0]) ? "true" : "false" ); -} - -void CPredictionDescribeData::DescribeFloat( const float *invalue, int count ) -{ - Describe( "float (%f)\n", invalue[ 0 ] ); -} -void CPredictionDescribeData::DescribeString( const char *instring ) -{ - Describe( "string (%s)\n", instring ); -} + pField->flatGroup = nGroup; + pField->flatOffset[ TD_OFFSET_NORMAL ] = nBaseOffset + pField->fieldOffset; -void CPredictionDescribeData::DescribeVector( const Vector &inValue ) -{ - Describe( "vector (%f %f %f)\n", - inValue.x, inValue.y, inValue.z ); -} + if ( bAdd ) + { + build.AddToTail( *pField ); + } + // Msg( "Visit %s offset %d\n", pField->fieldName, pField->flatOffset[ nPackType ] ); -void CPredictionDescribeData::DescribeVector( const Vector *inValue, int count ) -{ - Describe( "vector (%f %f %f)\n", - inValue[0].x, inValue[0].y, inValue[0].z ); -} + if ( pField->fieldType == FIELD_EMBEDDED ) + { + AssertFatalMsg( !(pField->flags & FTYPEDESC_PTR ), ( "Prediction copy does not support FTYPEDESC_PTR(%d)", pField->fieldName ) ); + BuildFlattenedChains_R( nPredictionCopyType, nMaxGroupSeen, nGroup, pField->td, build, pField->flatOffset[ TD_OFFSET_NORMAL ] ); + } -void CPredictionDescribeData::DescribeQuaternion( const Quaternion &inValue ) -{ - Describe( "quaternion (%f %f %f %f)\n", - inValue[0], inValue[1], inValue[2], inValue[3] ); + if ( pField->flags & FTYPEDESC_OVERRIDE ) + { + // Find previous field targeting same offset + RemoveFieldsByName( pField->fieldName, build ); + } + } } - -void CPredictionDescribeData::DescribeQuaternion( const Quaternion *inValue, int count ) +static int __cdecl CompareFlattenedOffsets( const void *pv1, const void *pv2 ) { - Describe( "quaternion (%f %f %f %f)\n", - inValue[0][0], inValue[0][1], inValue[0][2], inValue[0][3] ); -} + const typedescription_t *td1 = (const typedescription_t *)pv1; + const typedescription_t *td2 = (const typedescription_t *)pv2; + if ( td1->flatOffset[ TD_OFFSET_NORMAL ] < td2->flatOffset[ TD_OFFSET_NORMAL ] ) + return -1; + else if ( td1->flatOffset[ TD_OFFSET_NORMAL ] > td2->flatOffset[ TD_OFFSET_NORMAL ] ) + return 1; + if ( td1->flatGroup < td2->flatGroup ) + return -1; + else if ( td1->flatGroup > td2->flatGroup ) + return 1; -void CPredictionDescribeData::DescribeEHandle( EHANDLE const *invalue, int count ) -{ - Describe( "EHandle (%p)\n", invalue->Get() ); + return 0; } -void CPredictionDescribeData::DescribeFields_R( int chain_count, datamap_t *pRootMap, typedescription_t *pFields, int fieldCount ) +static int BuildPackedFlattenedOffsets( int nStartOffset, flattenedoffsets_t &flat ) { - int i; - int flags; - int fieldOffsetSrc; - int fieldSize; - - m_pCurrentMap = pRootMap; - if ( !m_pCurrentClassName ) - { - m_pCurrentClassName = pRootMap->dataClassName; - } + int current_position = nStartOffset; - for ( i = 0; i < fieldCount; i++ ) + for ( int i = 0; i < flat.m_Flattened.Count(); ++i ) { - m_pCurrentField = &pFields[ i ]; - flags = m_pCurrentField->flags; - - // Mark any subchains first - if ( m_pCurrentField->override_field != NULL ) - { - m_pCurrentField->override_field->override_count = chain_count; - } - - // Skip this field? - if ( m_pCurrentField->override_count == chain_count ) - { - continue; - } + typedescription_t *field = &flat.m_Flattened[ i ]; - void const *pInputData; - - fieldOffsetSrc = m_pCurrentField->fieldOffset[ m_nSrcOffsetIndex ]; - fieldSize = m_pCurrentField->fieldSize; - - pInputData = (void const *)((char *)m_pSrc + fieldOffsetSrc ); - - // Assume we can report - m_bShouldReport = true; - - switch( m_pCurrentField->fieldType ) + switch ( field->fieldType ) { - case FIELD_EMBEDDED: - { - typedescription_t *save = m_pCurrentField; - void const *saveSrc = m_pSrc; - const char *saveName = m_pCurrentClassName; - - m_pCurrentClassName = m_pCurrentField->td->dataClassName; - - m_pSrc = pInputData; - if ( ( flags & FTYPEDESC_PTR ) && (m_nSrcOffsetIndex == PC_DATA_NORMAL) ) - { - m_pSrc = *((void**)m_pSrc); - } - - DescribeFields_R( chain_count, pRootMap, m_pCurrentField->td->dataDesc, m_pCurrentField->td->dataNumFields ); - - m_pCurrentClassName = saveName; - m_pCurrentField = save; - m_pSrc = saveSrc; - } - break; - case FIELD_FLOAT: - DescribeFloat( (float const *)pInputData, fieldSize ); - break; - case FIELD_TIME: - case FIELD_TICK: - Assert( 0 ); - break; - case FIELD_STRING: - DescribeString( (char const*)pInputData ); - break; - + default: + case FIELD_MODELINDEX: case FIELD_MODELNAME: case FIELD_SOUNDNAME: - Assert( 0 ); - break; - - case FIELD_MODELINDEX: - Assert( 0 ); - break; - + case FIELD_TIME: + case FIELD_TICK: case FIELD_CUSTOM: - Assert( 0 ); - break; - case FIELD_CLASSPTR: case FIELD_EDICT: - break; case FIELD_POSITION_VECTOR: + case FIELD_FUNCTION: Assert( 0 ); break; - case FIELD_VECTOR: - DescribeVector( (const Vector *)pInputData, fieldSize ); + + case FIELD_EMBEDDED: + { + Error( "Not expecting FIELD_EMBEDDED in flattened list (%s)", field->fieldName ); + } break; + + case FIELD_FLOAT: + case FIELD_VECTOR: case FIELD_QUATERNION: - DescribeQuaternion( ( const Quaternion * )pInputData, fieldSize ); - break; - - case FIELD_COLOR32: - DescribeData( 4*fieldSize, (const char *)pInputData ); - break; - - case FIELD_BOOLEAN: - DescribeBool( (bool const *)pInputData, fieldSize ); - break; case FIELD_INTEGER: - DescribeInt( (int const *)pInputData, fieldSize ); + case FIELD_EHANDLE: + case FIELD_COLOR32: + case FIELD_VMATRIX: + case FIELD_VECTOR4D: + { + current_position = ALIGN_VALUE( current_position, 4 ); + field->flatOffset[ TD_OFFSET_PACKED ] = current_position; + current_position += field->fieldSizeInBytes; + } break; - case FIELD_SHORT: - DescribeShort( (short const *)pInputData, fieldSize ); + { + current_position = ALIGN_VALUE( current_position, 2 ); + field->flatOffset[ TD_OFFSET_PACKED ] = current_position; + current_position += field->fieldSizeInBytes; + } break; - + case FIELD_STRING: + case FIELD_BOOLEAN: case FIELD_CHARACTER: - DescribeData( fieldSize, (const char *)pInputData ); - break; - - case FIELD_EHANDLE: - DescribeEHandle( (EHANDLE const *)pInputData, fieldSize ); - break; - case FIELD_FUNCTION: - Assert( 0 ); + { + field->flatOffset[ TD_OFFSET_PACKED ] = current_position; + current_position += field->fieldSizeInBytes; + } break; case FIELD_VOID: - Describe( "FIELD_VOID: empty field\n" ); - break; - default: - Warning( "Bad field type\n" ); - Assert(0); + { + // Special case, just skip it + } break; } - } - - m_pCurrentClassName = NULL; -} - -void CPredictionDescribeData::DumpDescription( datamap_t *pMap ) -{ - ++g_nChainCount; - if ( !pMap->chains_validated ) - { - ValidateChains_R( pMap ); + // Msg( "%s packed to %d size %d\n", field->fieldName, field->flatOffset[ TD_OFFSET_PACKED ], field->fieldSizeInBytes ); } - while ( pMap ) - { - DescribeFields_R( g_nChainCount, pMap, pMap->dataDesc, pMap->dataNumFields ); - pMap = pMap->baseMap; - } -} + flat.m_nPackedStartOffset = nStartOffset; + flat.m_nPackedSize = current_position - nStartOffset; -#if defined( CLIENT_DLL ) -CValueChangeTracker::CValueChangeTracker() : - m_bActive( false ), - m_bTracking( false ) -{ - Q_memset( m_OrigValueBuf, 0, sizeof( m_OrigValueBuf ) ); -} + current_position = ALIGN_VALUE( current_position, 4 ); -C_BaseEntity *CValueChangeTracker::GetEntity() -{ - return m_hEntityToTrack.Get(); + return current_position; } -void CValueChangeTracker::GetValue( char *buf, size_t bufsize ) +static void BuildDataRuns( datamap_t *dmap ) { - buf[ 0 ] = 0; + for ( int pc = 0; pc < PC_COPYTYPE_COUNT; ++pc ) + { + datamapinfo_t &info = dmap->m_pOptimizedDataMap->m_Info[ pc ]; + datacopyruns_t *runs = &info.m_CopyRuns; - Assert( IsActive() ); + Assert( !info.m_CopyRuns.m_vecRuns.Count() ); - if ( !m_hEntityToTrack.Get() ) - return; + const flattenedoffsets_t &flat = info.m_Flat; - void const *pInputData = ( const void * )m_hEntityToTrack.Get(); - typedescription_t *td = NULL; - for ( int i = 0; i < m_FieldStack.Count(); ++i ) - { - td = m_FieldStack[ i ]; - Assert( ( i == ( m_FieldStack.Count() -1 ) ) || - ( td->fieldType & FIELD_EMBEDDED ) ); - int fieldOffsetSrc = td->fieldOffset[ TD_OFFSET_NORMAL ]; - const void *pSaveSrc = (const void *)( (char *)pInputData + fieldOffsetSrc ); - if ( ( td->flags & FTYPEDESC_PTR ) && - ( td->fieldType & FIELD_EMBEDDED ) ) - { - pInputData = *(const void **)pSaveSrc; - } - else + int nRunStartField = 0; + int nCurrentRunStartOffset = 0; + int nLastFieldEndOffset = 0; + + CUtlVector< datarun_t > &vecRuns = runs->m_vecRuns; + + int i; + for ( i = 0; i < flat.m_Flattened.Count(); ++i ) { - pInputData = (void const *)((char *)pSaveSrc ); - } - } + const typedescription_t *td = &flat.m_Flattened[ i ]; + int offset = td->flatOffset[ TD_OFFSET_NORMAL ]; + if ( i == 0 ) + { + nRunStartField = i; + nLastFieldEndOffset = offset; + nCurrentRunStartOffset = offset; + } - if ( !td || !pInputData ) - return; + if ( td->fieldType == FIELD_EMBEDDED ) + { + Assert( 0 ); + continue; + } - int fieldType = td->fieldType; + if ( nLastFieldEndOffset != offset ) + { + datarun_t run; + run.m_nStartFlatField = nRunStartField; + run.m_nEndFlatField = i; + Assert( nCurrentRunStartOffset == flat.m_Flattened[ nRunStartField ].flatOffset[ TD_OFFSET_NORMAL ] ); + run.m_nStartOffset[ TD_OFFSET_NORMAL ] = nCurrentRunStartOffset; + run.m_nStartOffset[ TD_OFFSET_PACKED ] = flat.m_Flattened[ nRunStartField ].flatOffset[ TD_OFFSET_PACKED ]; + run.m_nLength = nLastFieldEndOffset - nCurrentRunStartOffset; + +#ifdef _X360 + if ( vecRuns.Count() > 0 ) + { + for ( int td = 0; td < TD_OFFSET_COUNT; ++td ) + { + vecRuns[ vecRuns.Count() - 1 ].m_nPrefetchOffset[ td ] = run.m_nStartOffset[ td ]; + } + } +#endif + vecRuns.AddToTail( run ); - switch( fieldType ) - { - default: - case FIELD_EMBEDDED: - case FIELD_MODELNAME: - case FIELD_SOUNDNAME: - case FIELD_CUSTOM: - case FIELD_CLASSPTR: - case FIELD_EDICT: - case FIELD_POSITION_VECTOR: - case FIELD_VOID: - case FIELD_FUNCTION: - { - Assert( 0 ); - } - break; - case FIELD_FLOAT: - case FIELD_TIME: - Q_snprintf( buf, bufsize, "%f", *(float const *)pInputData ); - break; - case FIELD_STRING: - Q_snprintf( buf, bufsize, "%s", (char const*)pInputData ); - break; - case FIELD_VECTOR: - { - const Vector *pVec = (const Vector *)pInputData; - Q_snprintf( buf, bufsize, "%f %f %f", pVec->x, pVec->y, pVec->z ); - } - break; - case FIELD_QUATERNION: - { - const Quaternion *p = ( const Quaternion * )pInputData; - Q_snprintf( buf, bufsize, "%f %f %f %f", p->x, p->y, p->z, p->w ); + nRunStartField = i; + nCurrentRunStartOffset = offset; + } + nLastFieldEndOffset = td->flatOffset[ TD_OFFSET_NORMAL ] + td->fieldSizeInBytes; } - break; - case FIELD_COLOR32: + // Close off last run + if ( nLastFieldEndOffset != nCurrentRunStartOffset ) { - const Color *color = ( const Color * )pInputData; - Q_snprintf( buf, bufsize, "%d %d %d %d", color->r(), color->g(), color->b(), color->a() ); + datarun_t run; + run.m_nStartFlatField = nRunStartField; + run.m_nEndFlatField = i - 1; + Assert( nCurrentRunStartOffset == flat.m_Flattened[ nRunStartField ].flatOffset[ TD_OFFSET_NORMAL ] ); + run.m_nStartOffset[ TD_OFFSET_NORMAL ] = nCurrentRunStartOffset; + run.m_nStartOffset[ TD_OFFSET_PACKED ] = flat.m_Flattened[ nRunStartField ].flatOffset[ TD_OFFSET_PACKED ]; + run.m_nLength = nLastFieldEndOffset - nCurrentRunStartOffset; + +#ifdef _X360 + if ( vecRuns.Count() > 0 ) + { + for ( int td = 0; td < TD_OFFSET_COUNT; ++td ) + { + vecRuns[ vecRuns.Count() - 1 ].m_nPrefetchOffset[ td ] = run.m_nStartOffset[ td ]; + } + } +#endif + vecRuns.AddToTail( run ); } - break; - - case FIELD_BOOLEAN: - Q_snprintf( buf, bufsize, "%s", (*(const bool *)pInputData) ? "true" : "false" ); - break; - case FIELD_INTEGER: - case FIELD_TICK: - case FIELD_MODELINDEX: - Q_snprintf( buf, bufsize, "%i", *(const int*)pInputData ); - break; - - case FIELD_SHORT: - Q_snprintf( buf, bufsize, "%i", (int)*(const short*)pInputData ); - break; - - case FIELD_CHARACTER: - Q_snprintf( buf, bufsize, "%c", *(const char *)pInputData ); - break; - - case FIELD_EHANDLE: - Q_snprintf( buf, bufsize, "eh 0x%p", (void const *)((const EHANDLE *)pInputData)->Get() ); - break; } } -void CValueChangeTracker::StartTrack( char const *pchContext ) +static void BuildFlattenedChains( datamap_t *dmap ) { - if ( !IsActive() ) + if ( dmap->m_pOptimizedDataMap ) return; + dmap->m_pOptimizedDataMap = g_OptimizedDataMapPool.AllocZero(); - m_strContext = pchContext; - - // Grab current value into scratch buffer - GetValue( m_OrigValueBuf, sizeof( m_OrigValueBuf ) ); + int nMaxGroupSeen[ PC_COPYTYPE_COUNT ] = { 0 }; - m_bTracking = true; -} + for ( int nPredictionCopyType = 0; nPredictionCopyType < PC_COPYTYPE_COUNT; ++nPredictionCopyType ) + { + CUtlVector< typedescription_t > &build = dmap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat.m_Flattened; -void CValueChangeTracker::EndTrack() -{ - if ( !IsActive() ) - return; + int nGroupCount = 0; + int nBaseOffset = 0; + BuildFlattenedChains_R( + nPredictionCopyType, + nMaxGroupSeen[ nPredictionCopyType ], + nGroupCount, + dmap, + build, + nBaseOffset ); + // Msg( "%d == %d entries\n", nPredictionCopyType, build[ nPredictionCopyType ].Count() ); + } - if ( !m_bTracking ) - return; - m_bTracking = false; + for ( int nPredictionCopyType = 0; nPredictionCopyType < PC_COPYTYPE_COUNT; ++nPredictionCopyType ) + { + int nMaxGroup = nMaxGroupSeen[ nPredictionCopyType ]; - char final[ eChangeTrackerBufSize ]; - GetValue( final, sizeof( final ) ); + CUtlVector< typedescription_t > &build = dmap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat.m_Flattened; - CUtlString *history = &m_History[ m_History.AddToTail() ]; - if ( Q_stricmp( final, m_OrigValueBuf ) ) - { - history->Set( CFmtStr( "+++ %-20.20s: %s (was %s)", m_strContext.String(), final, m_OrigValueBuf ) ); + for ( int i = 0; i < build.Count(); ++i ) + { + typedescription_t *field = &build[ i ]; + field->flatGroup = nMaxGroup - field->flatGroup; + } } - else + + int nPackedDataStartOffset = 0; + for ( int nPredictionCopyType = 0; nPredictionCopyType < PC_COPYTYPE_COUNT; ++nPredictionCopyType ) { - history->Set( CFmtStr( " %-20.20s: %s", m_strContext.String(), final ) ); + flattenedoffsets_t &flat = dmap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat; + qsort( flat.m_Flattened.Base(), flat.m_Flattened.Count(), sizeof( typedescription_t ), (int (__cdecl *)(const void *, const void *))CompareFlattenedOffsets ); + + nPackedDataStartOffset = BuildPackedFlattenedOffsets( nPackedDataStartOffset, flat ); + dmap->m_nPackedSize = nPackedDataStartOffset; } - Msg( ":%s\n", history->String() ); + BuildDataRuns( dmap ); } -void CValueChangeTracker::ClearTracking() +const tokenset_t< int > s_PredCopyType[] = { - m_bActive = false; - m_bTracking = false; - m_hEntityToTrack = NULL; - m_strFieldName = ""; - m_History.RemoveAll(); - m_FieldStack.RemoveAll(); -} + { "Non-Sendtable" , PC_NON_NETWORKED_ONLY }, + { "SendTable" , PC_NETWORKED_ONLY }, + { "Everything" , PC_EVERYTHING }, + { NULL, -1 } +}; -static bool FindFieldStackByName_R( const char *fieldname, datamap_t *dmap, CUtlVector< typedescription_t * >& stack ) +const tokenset_t< int > s_PredPackType[] = { - int c = dmap->dataNumFields; - for ( int i = 0; i < c; i++ ) + { "Normal" , TD_OFFSET_NORMAL }, + { "Packed" , TD_OFFSET_PACKED }, + { NULL, -1 } +}; + +static void DescribeRuns( const datamap_t *dmap, int nPredictionCopyType, int packType ) +{ + const datacopyruns_t &runs = dmap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_CopyRuns; + const flattenedoffsets_t &flat = dmap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat; + Msg( " Runs for copy type: %s, packing: %s\n", s_PredCopyType->GetNameByToken( nPredictionCopyType ), s_PredPackType->GetNameByToken( packType ) ); + for ( int i = 0; i < runs.m_vecRuns.Count(); ++i ) { - typedescription_t *td = &dmap->dataDesc[ i ]; + const datarun_t *run = &runs.m_vecRuns[ i ]; + Msg( " %5d: %5d -> %5d (%5d bytes): %s to %s\n", + i, run->m_nStartOffset[ packType ], run->m_nStartOffset[ packType ] + run->m_nLength, run->m_nLength, + flat.m_Flattened[ run->m_nStartFlatField ].fieldName, + flat.m_Flattened[ run->m_nEndFlatField ].fieldName ); + } +} - if ( td->fieldType == FIELD_VOID ) - continue; +static void DescribeFlattenedList( const datamap_t *dmap, int nPredictionCopyType, int packType ) +{ + char const *prefix = dmap->dataClassName; - stack.AddToTail( td ); + Msg( "->Sorted %s for copy type: %s, packing: %s\n", prefix, s_PredCopyType->GetNameByToken( nPredictionCopyType ), s_PredPackType->GetNameByToken( packType ) ); + // Now dump the flattened list + int nLastFieldEnd = 0; + int nCurrentRunStartOffset = 0; - if ( td->fieldType == FIELD_EMBEDDED ) + int nRuns = 0; + int nBytesInRuns = 0; + int offset = 0; + + const flattenedoffsets_t &list = dmap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat; + for ( int i = 0; i < list.m_Flattened.Count(); ++i ) + { + const typedescription_t *td = &list.m_Flattened[ i ]; + offset = td->flatOffset[ packType ]; + if ( i == 0 ) { - // TODO: this will only find the first subclass with the variable of the specified name - // At some point we might want to support multiple levels of overriding automatically - bool ret = FindFieldStackByName_R( fieldname, td->td, stack ); - if ( ret ) - { - return ret; - } + nLastFieldEnd = offset; + nCurrentRunStartOffset = offset; } - if ( !Q_stricmp( td->fieldName, fieldname ) ) + if ( td->fieldType != FIELD_EMBEDDED ) { - return true; + if ( nLastFieldEnd != offset ) + { + Msg( " gap of %d bytes [last run %d]\n", offset - nLastFieldEnd, ( nLastFieldEnd - nCurrentRunStartOffset ) ); + ++nRuns; + nBytesInRuns += ( nLastFieldEnd - nCurrentRunStartOffset ); + + nCurrentRunStartOffset = offset; + } + nLastFieldEnd = td->flatOffset[ packType ] + td->fieldSizeInBytes; } - stack.FindAndRemove( td ); + Msg( "group %s [flat %d] [sort %d] %d bytes\n", + td->fieldName, + td->flatOffset[ packType ], + td->flatOffset[ TD_OFFSET_NORMAL ], + td->fieldSizeInBytes ); } - if ( dmap->baseMap ) + // Close off last run + if ( nLastFieldEnd != nCurrentRunStartOffset ) { - return FindFieldStackByName_R( fieldname, dmap->baseMap, stack ); + Msg( "Last run %d\n", nLastFieldEnd - nCurrentRunStartOffset ); + ++nRuns; + nBytesInRuns += ( nLastFieldEnd - nCurrentRunStartOffset ); } - return false; -} - -void CValueChangeTracker::SetupTracking( C_BaseEntity *ent, char const *pchFieldName ) -{ - ClearTracking(); - // Find the field - datamap_t *dmap = ent->GetPredDescMap(); - if ( !dmap ) + if ( nRuns > 0 ) { - Msg( "No prediction datamap_t for entity %d/%s\n", ent->index, ent->GetClassname() ); - return; - } + float flAvgBytesPerRun = (float)nBytesInRuns/(float)nRuns; - bool bFound = FindFieldStackByName_R( pchFieldName, dmap, m_FieldStack ); - if ( !bFound || !m_FieldStack.Count() ) - { - Msg( "No field '%s' in datamap_t for entity %d/%s\n", pchFieldName, ent->index, ent->GetClassname() ); - return; + Msg( "%d runs, %d bytes in runs, %f avg bytes per run\n", + nRuns, nBytesInRuns, flAvgBytesPerRun ); } + Msg( "->\n" ); - m_hEntityToTrack = ent; - m_strFieldName = pchFieldName; - m_bActive = true; + DescribeRuns( dmap, nPredictionCopyType, packType ); } -void CValueChangeTracker::Reset() +void CPredictionCopy::CopyFlatFieldsUsingRuns( const datamap_t *pCurrentMap, int nPredictionCopyType ) { - m_History.RemoveAll(); -} + int fieldOffsetSrc; + int fieldOffsetDest; + byte * RESTRICT pOutputData; + const byte * RESTRICT pInputData; -bool CValueChangeTracker::IsActive() const -{ - return m_bActive; -} + const datacopyruns_t &runs = pCurrentMap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_CopyRuns; -void CValueChangeTracker::Spew() -{ - if ( IsActive() ) + byte * RESTRICT pDest = ( byte * RESTRICT )m_pDest; + const byte * RESTRICT pSrc = (const byte * RESTRICT)m_pSrc; + + PREFETCH360( pSrc, 0 ); + PREFETCH360( pDest, 0 ); + + int c = runs.m_vecRuns.Count(); + for ( int i = 0; i < c; ++i ) { - for ( int i = 0 ; i < m_History.Count(); ++i ) - { - Msg( "%s\n", m_History[ i ].String() ); - } - } + const datarun_t * RESTRICT run = &runs.m_vecRuns[ i ]; + fieldOffsetDest = run->m_nStartOffset[ m_nDestOffsetIndex ]; + fieldOffsetSrc = run->m_nStartOffset[ m_nSrcOffsetIndex ]; + pOutputData = pDest + fieldOffsetDest; + pInputData = pSrc + fieldOffsetSrc; - Reset(); -} +#ifdef _X360 + PREFETCH360( pDest + run->m_nPrefetchOffset[ m_nDestOffsetIndex ], 0 ); + PREFETCH360( pSrc + run->m_nPrefetchOffset[ m_nSrcOffsetIndex ], 0 ); +#endif -static CValueChangeTracker g_ChangeTracker; -CValueChangeTracker *g_pChangeTracker = &g_ChangeTracker; + Q_memcpy( pOutputData, pInputData, run->m_nLength ); + } +} -CON_COMMAND_F( cl_pred_track, " : Track changes to entity index entindex, for field fieldname.", 0 ) +void CPredictionCopy::CopyFlatFields( const datamap_t *pCurrentMap, int nPredictionCopyType ) { - g_pChangeTracker->ClearTracking(); + int fieldOffsetSrc; + int fieldOffsetDest; + byte * RESTRICT pOutputData; + const byte * RESTRICT pInputData; - if ( args.ArgC() != 3 ) - { - Msg( "cl_pred_track \n" ); - return; - } + byte * RESTRICT pDest = (byte * RESTRICT)m_pDest; + const byte * RESTRICT pSrc = (const byte * RESTRICT)m_pSrc; - int iEntIndex = Q_atoi( args[1] ); + PREFETCH360( pSrc, 0 ); + PREFETCH360( pDest, 0 ); - C_BaseEntity *ent = cl_entitylist->GetBaseEntity( iEntIndex ); - if ( !ent ) - { - Msg( "cl_pred_track: Unknown ent index %d\n", iEntIndex ); - return; - } + const flattenedoffsets_t &flat = pCurrentMap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat; - g_pChangeTracker->SetupTracking( ent, args[2] ); -} + int fieldCount = flat.m_Flattened.Count(); + for ( int i = 0; i < fieldCount; ++i ) + { + const typedescription_t *pField = &flat.m_Flattened[ i ]; -#endif + fieldOffsetDest = pField->flatOffset[ m_nDestOffsetIndex ]; + fieldOffsetSrc = pField->flatOffset[ m_nSrcOffsetIndex ]; + pOutputData = pDest + fieldOffsetDest; + PREFETCH360( pOutputData, 0 ); + pInputData = pSrc + fieldOffsetSrc; + PREFETCH360( pInputData, 0 ); -#if defined( CLIENT_DLL ) && defined( COPY_CHECK_STRESSTEST ) + Q_memcpy( pOutputData, pInputData, pField->fieldSizeInBytes ); + } +} -class CPredictionCopyTester : public IGameSystem +void CPredictionCopy::ErrorCheckFlatFields_NoSpew( const datamap_t *pCurrentMap, int nPredictionCopyType ) { -public: + int i; + int flags; + int fieldOffsetSrc; + int fieldOffsetDest; + int fieldSize; - // Init, shutdown - virtual void Init() - { - RunTests(); - Remove( this ); - } + const flattenedoffsets_t &flat = pCurrentMap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat; + const typedescription_t *pBase = &flat.m_Flattened[ 0 ]; + PREFETCH360( pBase, 0 ); + int fieldCount = flat.m_Flattened.Count(); - virtual void Shutdown() {} + const byte * RESTRICT pDest = (const byte * RESTRICT)m_pDest; + const byte * RESTRICT pSrc = (const byte * RESTRICT)m_pSrc; + + const byte *pOutputData; + const byte *pInputData; - // Level init, shutdown - virtual void LevelInit() {} - // The level is shutdown in two parts - virtual void LevelShutdownPreEntity() {} - // Entities are deleted / released here... - virtual void LevelShutdownPostEntity() {} - // end of level shutdown + PREFETCH360( pSrc, 0 ); + PREFETCH360( pDest, 0 ); - // Called before rendering - virtual void PreRender ( ) {} + for ( i = 0; i < fieldCount && !m_nErrorCount; ++i ) + { + const typedescription_t * RESTRICT pField = &pBase[ i ]; - // Called after rendering - virtual void PostRender() {} + flags = pField->flags; + if ( flags & FTYPEDESC_NOERRORCHECK ) + continue; - // Gets called each frame - virtual void Update( float frametime ) {} +#if _X360 + if ( !(i & 0xF) ) + { + PREFETCH360(pField, 128); + } +#endif -private: + fieldOffsetDest = pField->flatOffset[ m_nDestOffsetIndex ]; + fieldOffsetSrc = pField->flatOffset[ m_nSrcOffsetIndex ]; - void RunTests( void ); -}; + pOutputData = pDest + fieldOffsetDest; + PREFETCH360( pOutputData, 0 ); + pInputData = pSrc + fieldOffsetSrc; + PREFETCH360( pInputData, 0 ); -IGameSystem* GetPredictionCopyTester( void ) -{ - static CPredictionCopyTester s_PredictionCopyTesterSystem; - return &s_PredictionCopyTesterSystem; + fieldSize = pField->fieldSize; + int nFieldType = pField->fieldType; + + PREDICTIONCOPY_APPLY( ProcessField_Compare_NoSpew, nFieldType, pCurrentMap, pField, pOutputData, pInputData, fieldSize ); + } } -class CCopyTesterData +void CPredictionCopy::ErrorCheckFlatFields_Spew( const datamap_t *pCurrentMap, int nPredictionCopyType ) { -public: - - CCopyTesterData() - { - m_CharValue = 'a'; - m_ShortValue = (short)100; - m_IntValue = (int)100; - m_FloatValue = 1.0f; - Q_strncpy( m_szValue, "primarydata", sizeof( m_szValue ) ); - m_Vector = Vector( 100, 100, 100 ); - m_Bool = false; - m_Clr.r = m_Clr.g = m_Clr.b = m_Clr.a = 255; + int i; + int flags; + int fieldOffsetSrc; + int fieldOffsetDest; + int fieldSize; - m_Ptr = (void *)0xfedcba98; - // m_hEHandle = NULL; - } + const flattenedoffsets_t &flat = pCurrentMap->m_pOptimizedDataMap->m_Info[ nPredictionCopyType ].m_Flat; + const typedescription_t *pBase = &flat.m_Flattened[ 0 ]; + PREFETCH360( pBase, 0 ); + int fieldCount = flat.m_Flattened.Count(); - void MakeDifferent( void ) - { - m_CharValue = 'd'; - m_ShortValue = (short)400; - m_IntValue = (int)400; - m_FloatValue = 4.0f; - Q_strncpy( m_szValue, "secondarydata", sizeof( m_szValue ) ); - m_Vector = Vector( 400, 400, 400 ); - m_Bool = true; - m_Clr.r = m_Clr.g = m_Clr.b = m_Clr.a = 1; - m_Ptr = (void *)0x00000001; - // m_hEHandle = (C_BaseEntity *)0x00000001; - } + const byte * RESTRICT pDest = m_pDest; + const byte * RESTRICT pSrc = m_pSrc; - DECLARE_PREDICTABLE(); + const byte *pOutputData; + const byte *pInputData; - char m_CharValue; - short m_ShortValue; - int m_IntValue; - float m_FloatValue; - char m_szValue[ 128 ]; - Vector m_Vector; - bool m_Bool; - color32 m_Clr; - void *m_Ptr; -// EHANDLE m_hEHandle; + PREFETCH360( pSrc, 0 ); + PREFETCH360( pDest, 0 ); -}; + for ( i = 0; i < fieldCount ; ++i ) + { + const typedescription_t * RESTRICT pField = &pBase[ i ]; -BEGIN_PREDICTION_DATA_NO_BASE( CCopyTesterData ) + flags = pField->flags; + if ( flags & FTYPEDESC_NOERRORCHECK ) + continue; - DEFINE_FIELD( CCopyTesterData, m_CharValue, FIELD_CHARACTER ), - DEFINE_FIELD( CCopyTesterData, m_ShortValue, FIELD_SHORT ), - DEFINE_FIELD( CCopyTesterData, m_IntValue, FIELD_INTEGER ), - DEFINE_FIELD( CCopyTesterData, m_FloatValue, FIELD_FLOAT ), - DEFINE_FIELD( CCopyTesterData, m_szValue, FIELD_STRING ), - DEFINE_FIELD( CCopyTesterData, m_Vector, FIELD_VECTOR ), - DEFINE_FIELD( CCopyTesterData, m_Bool, FIELD_BOOLEAN ), - DEFINE_FIELD( CCopyTesterData, m_Clr, FIELD_COLOR32 ), -// DEFINE_FIELD( CCopyTesterData, m_hEHandle, FIELD_EHANDLE ), +#if _X360 + if ( !(i & 0xF) ) + { + PREFETCH360(pField, 128); + } +#endif -END_PREDICTION_DATA() + fieldOffsetDest = pField->flatOffset[ m_nDestOffsetIndex ]; + fieldOffsetSrc = pField->flatOffset[ m_nSrcOffsetIndex ]; -class CCopyTesterData2 : public C_BaseEntity -{ - DECLARE_CLASS( CCopyTesterData2, C_BaseEntity ); + pOutputData = pDest + fieldOffsetDest; + PREFETCH360( pOutputData, 0 ); + pInputData = pSrc + fieldOffsetSrc; + PREFETCH360( pInputData, 0 ); -public: - CCopyTesterData2() - { - CONSTRUCT_PREDICTABLE( CCopyTesterData2 ); + fieldSize = pField->fieldSize; + flags = pField->flags; + int nFieldType = pField->fieldType; - m_CharValue = 'b'; - m_ShortValue = (short)200; - m_IntValue = (int)200; - m_FloatValue = 2.0f; + PREDICTIONCOPY_APPLY( ProcessField_Compare_Spew, nFieldType, pCurrentMap, pField, pOutputData, pInputData, fieldSize ); } +} - void MakeDifferent( void ) +bool CPredictionCopy::PrepareDataMap( datamap_t *dmap ) +{ + bool bPerformedPrepare = false; + if ( dmap && !dmap->m_pOptimizedDataMap ) { - m_CharValue = 'e'; - m_ShortValue = (short)500; - m_IntValue = (int)500; - m_FloatValue = 5.0f; - m_FooData.MakeDifferent(); + bPerformedPrepare = true; + BuildFlattenedChains( dmap ); + dmap = dmap->baseMap; } - DECLARE_PREDICTABLE(); - - char m_CharValue; - short m_ShortValue; - int m_IntValue; - float m_FloatValue; - - CCopyTesterData m_FooData; -}; - -BEGIN_PREDICTION_DATA_NO_BASE( CCopyTesterData2 ) - - DEFINE_FIELD( CCopyTesterData2, m_CharValue, FIELD_CHARACTER ), - DEFINE_FIELD( CCopyTesterData2, m_ShortValue, FIELD_SHORT ), - DEFINE_PRED_TYPEDESCRIPTION( CCopyTesterData2, m_FooData, CCopyTesterData ), - DEFINE_FIELD( CCopyTesterData2, m_IntValue, FIELD_INTEGER ), - DEFINE_FIELD( CCopyTesterData2, m_FloatValue, FIELD_FLOAT ), - -END_PREDICTION_DATA() + return bPerformedPrepare; +} -void CPredictionCopyTester::RunTests( void ) +CON_COMMAND( cl_predictioncopy_describe, "Describe datamap_t for entindex" ) { - CCopyTesterData2 *foo1, *foo2, *foo3; + if ( args.ArgC() <= 1 ) + { + Msg( "Usage: %s ", args[ 0 ] ); + return; + } + int entindex = Q_atoi( args[ 1 ] ); + C_BaseEntity *ent = C_BaseEntity::Instance( entindex ); + if ( !ent ) + { + Msg( "cl_predictioncopy_describe: no such entity %d\n", entindex ); + return; + } - foo1 = new CCopyTesterData2; - foo2 = new CCopyTesterData2; - foo3 = new CCopyTesterData2; + datamap_t *dmap = ent->GetPredDescMap(); + if ( !dmap ) + { + return; + } + CPredictionCopy::PrepareDataMap( dmap ); - foo2->MakeDifferent(); + for ( int nPredictionCopyType = 0; nPredictionCopyType < PC_COPYTYPE_COUNT; ++nPredictionCopyType ) + { + //for ( int i = 0; i < TD_OFFSET_COUNT; ++i ) + { + DescribeFlattenedList( dmap, nPredictionCopyType, 0 ); + } + } +} +// 0 PC_NON_NETWORKED_ONLY = (1<<0) or (1) +// 1 PC_NETWORKED_ONLY = (1<<1) or (2) +// 2 PC_EVERYTHING = ( PC_NON_NETWORKED_ONLY | PC_NETWORKED_ONLY ) or 3 +// So for these three options, we just take the type and add one!!! +FORCEINLINE int ComputeTypeMask( int nType ) +{ + return nType + 1; +} +#if 0 // Enable this for perf testing +static ConVar cl_predictioncopy_runs( "cl_predictioncopy_runs", "1" ); +static ConVar cl_predictioncopy_repeats( "cl_predictioncopy_repeats", "1" ); +void CPredictionCopy::TransferDataCopyOnly( datamap_t *dmap ) +{ + int repeat = cl_predictioncopy_repeats.GetInt(); + for ( int k = 0; k < repeat; ++k ) { - Msg( "Comparing and copying == objects, should have zero diffcount\n" ); - - CPredictionCopy tester( PC_NON_NETWORKED_ONLY, foo1, false, foo3, false, true ); - int diff_count = 0; - diff_count = tester.TransferData( foo3->GetPredDescMap(), foo1->GetPredDescMap()->dataDesc, foo1->GetPredDescMap()->dataNumFields ); - - Msg( "diff_count == %i\n", diff_count ); - Assert( !diff_count ); + int types = ComputeTypeMask( m_nType ); + for ( int i = 0; i < PC_COPYTYPE_COUNT; ++i ) + { + if ( types & (1<GetPredDescMap(), foo1->GetPredDescMap()->dataDesc, foo1->GetPredDescMap()->dataNumFields ); - - Msg( "diff_count == %i (should be 12)\n", diff_count ); - Assert( diff_count == 12 ); + if ( types & (1<GetPredDescMap(), foo1->GetPredDescMap()->dataDesc, foo1->GetPredDescMap()->dataNumFields ); - - Msg( "diff_count == %i (should be 12)\n", diff_count ); - Assert( diff_count == 12 ); +void CPredictionCopy::TransferDataErrorCheckSpew( char const *pchOperation, const datamap_t *dmap ) +{ + int types = ComputeTypeMask( m_nType ); + for ( int i = 0; i < PC_COPYTYPE_COUNT; ++i ) + { + if ( types & (1< vecGroups; + int nGroup = 0; + BuildGroupList_R( i, nGroup, dmap, vecGroups ); + DescribeFields( vecGroups, dmap, i ); + } + } +} + +int CPredictionCopy::TransferData( const char *operation, int entindex, datamap_t *dmap ) +{ + m_nEntIndex = entindex; - CPredictionCopy tester( PC_NON_NETWORKED_ONLY, foo1, false, foo2, false, true ); - int diff_count = 0; - diff_count = tester.TransferData( foo2->GetPredDescMap(), foo1->GetPredDescMap()->dataDesc, foo1->GetPredDescMap()->dataNumFields ); + PrepareDataMap( dmap ); - Msg( "diff_count == %i\n", diff_count ); - Assert( !diff_count ); + switch ( m_OpType ) + { + default: + Assert( 0 ); + case TRANSFERDATA_COPYONLY: // Data copying only (uses runs) + { + // Watch is based on "destination" of any write operation + DetermineWatchField( operation, entindex, dmap ); + TransferDataCopyOnly( dmap ); + } + break; + case TRANSFERDATA_ERRORCHECK_NOSPEW: // Checks for errors, returns after first error found + { + TransferDataErrorCheckNoSpew( operation, dmap ); + } + break; + case TRANSFERDATA_ERRORCHECK_SPEW: // checks for errors, reports all errors to console + { + TransferDataErrorCheckSpew( operation, dmap ); + } + break; + case TRANSFERDATA_ERRORCHECK_DESCRIBE: + { + TransferDataDescribe( operation, dmap ); + } + break; } + if ( m_pWatchField ) { - CPredictionDescribeData describe( foo1, false ); - describe.DumpDescription( foo1->GetPredDescMap(), foo1->GetPredDescMap()->dataDesc, foo1->GetPredDescMap()->dataNumFields ); + // Watch is based on "destination" of any write operation + DumpWatchField( m_pWatchField, m_pDest + m_pWatchField->flatOffset[ m_nDestOffsetIndex ], m_pWatchField->fieldSize ); } - - delete foo3; - delete foo2; - delete foo1; + return m_nErrorCount; } -#endif // CLIENT_DLL -#endif // !NO_ENTITY_PREDICTION ) +#endif + + + diff --git a/game/shared/predictioncopy.h b/game/shared/predictioncopy.h index 47b0ac728..91014f927 100644 --- a/game/shared/predictioncopy.h +++ b/game/shared/predictioncopy.h @@ -15,13 +15,15 @@ #include "datamap.h" #include "ehandle.h" #include "tier1/utlstring.h" +#include "tier1/utlrbtree.h" +#include "tier1/utlstack.h" #if defined( CLIENT_DLL ) class C_BaseEntity; typedef CHandle EHANDLE; -#if defined( _DEBUG ) // #define COPY_CHECK_STRESSTEST +#if defined( COPY_CHECK_STRESSTEST ) class IGameSystem; IGameSystem* GetPredictionCopyTester( void ); #endif @@ -31,18 +33,69 @@ class CBaseEntity; typedef CHandle EHANDLE; #endif -enum +typedef void ( *FN_FIELD_COMPARE )( const char *classname, const char *fieldname, const char *fieldtype, + bool networked, bool noterrorchecked, bool differs, bool withintolerance, const char *value ); + +// Each datamap_t is broken down into two flattened arrays of fields, +// one for PC_NETWORKED_DATA and one for PC_NON_NETWORKED_ONLY (optimized_datamap_t::datamapinfo_t::flattenedoffsets_t) +// Each flattened array is sorted by offset for better cache performance +// Finally, contiguous "runs" off offsets are precomputed (optimized_datamap_t::datamapinfo_t::datacopyruns_t) for fast copy operations + +// A data run is a set of DEFINE_PRED_FIELD fields in a c++ object which are contiguous and can be processing +// using a single memcpy operation +struct datarun_t { - PC_EVERYTHING = 0, - PC_NON_NETWORKED_ONLY, - PC_NETWORKED_ONLY, + datarun_t() : m_nStartFlatField( 0 ), m_nEndFlatField( 0 ), m_nLength( 0 ) + { + for ( int i = 0 ; i < TD_OFFSET_COUNT; ++i ) + { + m_nStartOffset[ i ] = 0; +#ifdef _X360 + // These are the offsets of the next run, for priming the L1 cache + m_nPrefetchOffset[ i ] = 0; +#endif + } + } + + // Indices of start/end fields in the flattened typedescription_t list + int m_nStartFlatField; + int m_nEndFlatField; + + // Offsets for run in the packed/unpacked data (I think the run starts need to be properly aligned) + int m_nStartOffset[ TD_OFFSET_COUNT ]; +#ifdef _X360 + // These are the offsets of the next run, for priming the L1 cache + int m_nPrefetchOffset[ TD_OFFSET_COUNT ]; +#endif + int m_nLength; }; -#define PC_DATA_PACKED true -#define PC_DATA_NORMAL false +struct datacopyruns_t +{ +public: + CUtlVector< datarun_t > m_vecRuns; +}; -typedef void ( *FN_FIELD_COMPARE )( const char *classname, const char *fieldname, const char *fieldtype, - bool networked, bool noterrorchecked, bool differs, bool withintolerance, const char *value ); +struct flattenedoffsets_t +{ + CUtlVector< typedescription_t > m_Flattened; + int m_nPackedSize; // Contiguous memory to pack all of these together for TD_OFFSET_PACKED + int m_nPackedStartOffset; +}; + +struct datamapinfo_t +{ + // Flattened list, with FIELD_EMBEDDED, FTYPEDESC_PRIVATE, + // and FTYPEDESC_OVERRIDE (overridden) fields removed + flattenedoffsets_t m_Flat; + datacopyruns_t m_CopyRuns; +}; + +struct optimized_datamap_t +{ + // Optimized info for PC_NON_NETWORKED and PC_NETWORKED data + datamapinfo_t m_Info[ PC_COPYTYPE_COUNT ]; +}; class CPredictionCopy { @@ -54,152 +107,164 @@ class CPredictionCopy WITHINTOLERANCE, } difftype_t; - CPredictionCopy( int type, void *dest, bool dest_packed, void const *src, bool src_packed, - bool counterrors = false, bool reporterrors = false, bool performcopy = true, - bool describefields = false, FN_FIELD_COMPARE func = NULL ); - - void CopyShort( difftype_t dt, short *outvalue, const short *invalue, int count ); - void CopyInt( difftype_t dt, int *outvalue, const int *invalue, int count ); // Copy an int - void CopyBool( difftype_t dt, bool *outvalue, const bool *invalue, int count ); // Copy a bool - void CopyFloat( difftype_t dt, float *outvalue, const float *invalue, int count ); // Copy a float - void CopyString( difftype_t dt, char *outstring, const char *instring ); // Copy a null-terminated string - void CopyVector( difftype_t dt, Vector& outValue, const Vector &inValue ); // Copy a vector - void CopyVector( difftype_t dt, Vector* outValue, const Vector *inValue, int count ); // Copy a vector array - void CopyQuaternion( difftype_t dt, Quaternion& outValue, const Quaternion &inValue ); // Copy a quaternion - void CopyQuaternion( difftype_t dt, Quaternion* outValue, const Quaternion *inValue, int count ); // Copy a quaternion array - void CopyEHandle( difftype_t dt, EHANDLE *outvalue, EHANDLE const *invalue, int count ); - - void FORCEINLINE CopyData( difftype_t dt, int size, char *outdata, const char *indata ) // Copy a binary data block + typedef enum { - if ( !m_bPerformCopy ) - return; - - if ( dt == IDENTICAL ) - return; - - memcpy( outdata, indata, size ); - } - + TRANSFERDATA_COPYONLY = 0, // Data copying only (uses runs) + TRANSFERDATA_ERRORCHECK_NOSPEW, // Checks for errors, returns after first error found + TRANSFERDATA_ERRORCHECK_SPEW, // checks for errors, reports all errors to console + TRANSFERDATA_ERRORCHECK_DESCRIBE, // used by hud_pdump, dumps values, etc, for all fields + } optype_t; + + CPredictionCopy( int type, byte *dest, bool dest_packed, const byte *src, bool src_packed, + optype_t opType, FN_FIELD_COMPARE func = NULL ); + int TransferData( const char *operation, int entindex, datamap_t *dmap ); + static bool PrepareDataMap( datamap_t *dmap ); + static const typedescription_t *FindFlatFieldByName( const char *fieldname, const datamap_t *dmap ); private: - void TransferData_R( int chaincount, datamap_t *dmap ); - - void DetermineWatchField( const char *operation, int entindex, datamap_t *dmap ); - void DumpWatchField( typedescription_t *field ); - void WatchMsg( const char *fmt, ... ); - - difftype_t CompareShort( short *outvalue, const short *invalue, int count ); - difftype_t CompareInt( int *outvalue, const int *invalue, int count ); // Compare an int - difftype_t CompareBool( bool *outvalue, const bool *invalue, int count ); // Compare a bool - difftype_t CompareFloat( float *outvalue, const float *invalue, int count ); // Compare a float - difftype_t CompareData( int size, char *outdata, const char *indata ); // Compare a binary data block - difftype_t CompareString( char *outstring, const char *instring ); // Compare a null-terminated string - difftype_t CompareVector( Vector& outValue, const Vector &inValue ); // Compare a vector - difftype_t CompareVector( Vector* outValue, const Vector *inValue, int count ); // Compare a vector array - difftype_t CompareQuaternion( Quaternion& outValue, const Quaternion &inValue ); // Compare a Quaternion - difftype_t CompareQuaternion( Quaternion* outValue, const Quaternion *inValue, int count ); // Compare a Quaternion array - difftype_t CompareEHandle( EHANDLE *outvalue, EHANDLE const *invalue, int count ); - - void DescribeShort( difftype_t dt, short *outvalue, const short *invalue, int count ); - void DescribeInt( difftype_t dt, int *outvalue, const int *invalue, int count ); // Compare an int - void DescribeBool( difftype_t dt, bool *outvalue, const bool *invalue, int count ); // Compare a bool - void DescribeFloat( difftype_t dt, float *outvalue, const float *invalue, int count ); // Compare a float - void DescribeData( difftype_t dt, int size, char *outdata, const char *indata ); // Compare a binary data block - void DescribeString( difftype_t dt, char *outstring, const char *instring ); // Compare a null-terminated string - void DescribeVector( difftype_t dt, Vector& outValue, const Vector &inValue ); // Compare a vector - void DescribeVector( difftype_t dt, Vector* outValue, const Vector *inValue, int count ); // Compare a vector array - void DescribeQuaternion( difftype_t dt, Quaternion& outValue, const Quaternion &inValue ); // Compare a Quaternion - void DescribeQuaternion( difftype_t dt, Quaternion* outValue, const Quaternion *inValue, int count ); // Compare a Quaternion array - void DescribeEHandle( difftype_t dt, EHANDLE *outvalue, EHANDLE const *invalue, int count ); - - void WatchShort( difftype_t dt, short *outvalue, const short *invalue, int count ); - void WatchInt( difftype_t dt, int *outvalue, const int *invalue, int count ); // Compare an int - void WatchBool( difftype_t dt, bool *outvalue, const bool *invalue, int count ); // Compare a bool - void WatchFloat( difftype_t dt, float *outvalue, const float *invalue, int count ); // Compare a float - void WatchData( difftype_t dt, int size, char *outdata, const char *indata ); // Compare a binary data block - void WatchString( difftype_t dt, char *outstring, const char *instring ); // Compare a null-terminated string - void WatchVector( difftype_t dt, Vector& outValue, const Vector &inValue ); // Compare a vector - void WatchVector( difftype_t dt, Vector* outValue, const Vector *inValue, int count ); // Compare a vector array - void WatchQuaternion( difftype_t dt, Quaternion& outValue, const Quaternion &inValue ); // Compare a Quaternion - void WatchQuaternion( difftype_t dt, Quaternion* outValue, const Quaternion *inValue, int count ); // Compare a Quaternion array - void WatchEHandle( difftype_t dt, EHANDLE *outvalue, EHANDLE const *invalue, int count ); + + // Operations: + void TransferDataCopyOnly( const datamap_t *dmap ); + void TransferDataErrorCheckNoSpew( char const *pchOperation, const datamap_t *dmap ); + void TransferDataErrorCheckSpew( char const *pchOperation, const datamap_t *dmap ); + void TransferDataDescribe( char const *pchOperation, const datamap_t *dmap ); + // Report function - void ReportFieldsDiffer( const char *fmt, ... ); - void DescribeFields( difftype_t dt, const char *fmt, ... ); + void ReportFieldsDiffer( const datamap_t *pCurrentMap, const typedescription_t *pField, const char *fmt, ... ); + void OutputFieldDescription( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t dt, const char *fmt, ... ); - bool CanCheck( void ); - - void CopyFields( int chaincount, datamap_t *pMap, typedescription_t *pFields, int fieldCount ); + // Helper for TransferDataCopyOnly + void CopyFlatFieldsUsingRuns( const datamap_t *pCurrentMap, int nPredictionCopyType ); + void CopyFlatFields( const datamap_t *pCurrentMap, int nPredictionCopyType ); + template< class T > + FORCEINLINE void CopyField( difftype_t difftype, T *outvalue, const T *invalue, int count ); + + // Helper for TransferDataErrorCheckNoSpew + void ErrorCheckFlatFields_NoSpew( const datamap_t *pCurrentMap, int nPredictionCopyType ); + template< class T > + FORCEINLINE void ProcessField_Compare_NoSpew( const datamap_t *pCurrentMap, const typedescription_t *pField, const T *pOutputData, const T *pInputData, int fieldSize ); + + // Helper for TransferDataErrorCheckSpew + void ErrorCheckFlatFields_Spew( const datamap_t *pCurrentMap, int nPredictionCopyType ); + template< class T > + FORCEINLINE void ProcessField_Compare_Spew( const datamap_t *pCurrentMap, const typedescription_t *pField, const T *pOutputData, const T *pInputData, int fieldSize ); + + // Helper for TransferDataDescribe + void DescribeFields( const CUtlVector< const datamap_t * > &vecGroups, const datamap_t *pCurrentMap, int nPredictionCopyType ); + // Main entry point + template< class T > + FORCEINLINE void ProcessField_Describe( const datamap_t *pCurrentMap, const typedescription_t *pField, const T *pOutputData, const T *pInputData, int fieldSize ); + + // Helpers for entity field watcher + void DetermineWatchField( const char *operation, int entindex, const datamap_t *dmap ); + void WatchMsg( const typedescription_t *pField, const char *fmt, ... ); + void DumpWatchField( const typedescription_t *pField, const byte *outvalue, int count ); + template< class T > + FORCEINLINE void WatchField( const typedescription_t *pField, const T *outvalue, int count ); + + // Helper for ErrorCheck ops + template< class T > + FORCEINLINE difftype_t CompareField( const typedescription_t *pField, const T *outvalue, const T *invalue, int count ); + // Used by TRANSFERDATA_ERRORCHECK_SPEW and by TRANSFERDATA_ERRORCHECK_DESCRIBE + template< class T > + FORCEINLINE void DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const T *outvalue, const T *invalue, int count ); private: + optype_t m_OpType; int m_nType; - void *m_pDest; - void const *m_pSrc; + byte *m_pDest; + const byte *m_pSrc; int m_nDestOffsetIndex; int m_nSrcOffsetIndex; - - - bool m_bErrorCheck; - bool m_bReportErrors; - bool m_bDescribeFields; - typedescription_t *m_pCurrentField; - char const *m_pCurrentClassName; - datamap_t *m_pCurrentMap; - bool m_bShouldReport; - bool m_bShouldDescribe; int m_nErrorCount; - bool m_bPerformCopy; + int m_nEntIndex; FN_FIELD_COMPARE m_FieldCompareFunc; - typedescription_t *m_pWatchField; + const typedescription_t *m_pWatchField; char const *m_pOperation; + + CUtlStack< const typedescription_t * > m_FieldStack; }; typedef void (*FN_FIELD_DESCRIPTION)( const char *classname, const char *fieldname, const char *fieldtype, bool networked, const char *value ); -//----------------------------------------------------------------------------- -// Purpose: Simply dumps all data fields in object -//----------------------------------------------------------------------------- -class CPredictionDescribeData -{ -public: - CPredictionDescribeData( void const *src, bool src_packed, FN_FIELD_DESCRIPTION func = 0 ); - - void DescribeShort( const short *invalue, int count ); - void DescribeInt( const int *invalue, int count ); - void DescribeBool( const bool *invalue, int count ); - void DescribeFloat( const float *invalue, int count ); - void DescribeData( int size, const char *indata ); - void DescribeString( const char *instring ); - void DescribeVector( const Vector &inValue ); - void DescribeVector( const Vector *inValue, int count ); - void DescribeQuaternion( const Quaternion &inValue ); - void DescribeQuaternion( const Quaternion *inValue, int count ); - void DescribeEHandle( EHANDLE const *invalue, int count ); - - void DumpDescription( datamap_t *pMap ); +// +// Compare methods +// +// Specializations +template<> FORCEINLINE CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const float *outvalue, const float *invalue, int count ); +template<> FORCEINLINE CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const Vector *outvalue, const Vector *invalue, int count ); +template<> FORCEINLINE CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const Quaternion *outvalue, const Quaternion *invalue, int count ); +template<> FORCEINLINE CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const char *outvalue, const char *invalue, int count ); +template<> FORCEINLINE CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const EHANDLE *outvalue, const EHANDLE *invalue, int count ); +template<> FORCEINLINE CPredictionCopy::difftype_t CPredictionCopy::CompareField( const typedescription_t *pField, const color32 *outvalue, const color32 *invalue, int count ); -private: - void DescribeFields_R( int chain_count, datamap_t *pMap, typedescription_t *pFields, int fieldCount ); +// +// Describe Methods +// - void const *m_pSrc; - int m_nSrcOffsetIndex; +// Specializations +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const short *outvalue, const short *invalue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const int *outvalue, const int *invalue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const bool *outvalue, const bool *invalue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const float *outvalue, const float *invalue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const char *outvalue, const char *invalue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const Vector* outValue, const Vector *inValue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const Quaternion* outValue, const Quaternion *inValue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const EHANDLE *outvalue, const EHANDLE *invalue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const color32 *outvalue, const color32 *invalue, int count ); +template<> FORCEINLINE void CPredictionCopy::DescribeField( const datamap_t *pCurrentMap, const typedescription_t *pField, difftype_t difftype, const uint8 *outvalue, const uint8 *invalue, int count ); + + +// +// Watch Methods +// +// Specializations +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const short *outvalue,int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const int *outvalue, int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const bool *outvalue, int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const float *outvalue, int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const Vector *outvalue, int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const Quaternion *outvalue, int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const EHANDLE *outvalue, int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const char *outvalue, int count ); +template<> FORCEINLINE void CPredictionCopy::WatchField( const typedescription_t *pField, const color32 *outvalue, int count ); +// +// Copy Methods +// +// specializations +template<> FORCEINLINE void CPredictionCopy::CopyField( difftype_t difftype, char *outvalue, const char *invalue, int count ); - void Describe( const char *fmt, ... ); +template< class T > +FORCEINLINE void CPredictionCopy::ProcessField_Compare_NoSpew( const datamap_t *pCurrentMap, const typedescription_t *pField, const T *pOutputData, const T *pInputData, int fieldSize ) +{ + difftype_t difftype = CompareField( pField, pOutputData, pInputData, fieldSize ); + if ( difftype == DIFFERS ) + { + ++m_nErrorCount; + } +} - typedescription_t *m_pCurrentField; - char const *m_pCurrentClassName; - datamap_t *m_pCurrentMap; - bool m_bShouldReport; +template< class T > +FORCEINLINE void CPredictionCopy::ProcessField_Compare_Spew( const datamap_t *pCurrentMap, const typedescription_t *pField, const T *pOutputData, const T *pInputData, int fieldSize ) +{ + difftype_t difftype = CompareField( pField, pOutputData, pInputData, fieldSize ); + DescribeField( pCurrentMap, pField, difftype, pOutputData, pInputData, fieldSize ); +} - FN_FIELD_DESCRIPTION m_FieldDescFunc; -}; + +template< class T > +FORCEINLINE void CPredictionCopy::ProcessField_Describe( const datamap_t *pCurrentMap, const typedescription_t *pField, const T *pOutputData, const T *pInputData, int fieldSize ) +{ + difftype_t difftype = CompareField( pField, pOutputData, pInputData, fieldSize ); + DescribeField( pCurrentMap, pField, difftype, pOutputData, pInputData, fieldSize ); +} #if defined( CLIENT_DLL ) class CValueChangeTracker @@ -234,7 +299,7 @@ class CValueChangeTracker bool m_bActive : 1; bool m_bTracking : 1; EHANDLE m_hEntityToTrack; - CUtlVector< typedescription_t * > m_FieldStack; + const typedescription_t *m_pTrackField; CUtlString m_strFieldName; CUtlString m_strContext; // First 128 bytes of data is all we will consider diff --git a/game/shared/shareddefs.h b/game/shared/shareddefs.h index 704d110c2..22c21e82d 100644 --- a/game/shared/shareddefs.h +++ b/game/shared/shareddefs.h @@ -1,17 +1,17 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//======= Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ====== // // Purpose: Definitions that are shared by the game DLL and the client DLL. // -// $NoKeywords: $ -//=============================================================================// +//=============================================================================== + #ifndef SHAREDDEFS_H #define SHAREDDEFS_H #ifdef _WIN32 #pragma once #endif -#include "mathlib/vector.h" -#include "utlvector.h" + +#include "bittools.h" #define TICK_INTERVAL (gpGlobals->interval_per_tick) @@ -21,13 +21,17 @@ #define ROUND_TO_TICKS( t ) ( TICK_INTERVAL * TIME_TO_TICKS( t ) ) #define TICK_NEVER_THINK (-1) -#if defined( TF_DLL ) -#define ANIMATION_CYCLE_BITS 10 -#else + #define ANIMATION_CYCLE_BITS 15 -#endif + #define ANIMATION_CYCLE_MINFRAC (1.0f / (1< 1 ) ? true : false; +} + +//----------------------------------------------------------------------------- +// For invalidate physics recursive +//----------------------------------------------------------------------------- +enum InvalidatePhysicsBits_t +{ + POSITION_CHANGED = 0x1, + ANGLES_CHANGED = 0x2, + VELOCITY_CHANGED = 0x4, + ANIMATION_CHANGED = 0x8, // Means cycle has changed, or any other event which would cause render-to-texture shadows to need to be rerendeded + BOUNDS_CHANGED = 0x10, // Means render bounds have changed, so shadow decal projection is required, etc. + SEQUENCE_CHANGED = 0x20, // Means sequence has changed, only interesting when surrounding bounds depends on sequence +}; + +enum Class_T +{ + CLASS_NONE = 0, + CLASS_PLAYER, + CLASS_PLAYER_ALLY, + CLASS_PLAYER_ALLY_VITAL, + CLASS_ANTLION, + CLASS_BARNACLE, + CLASS_BLOB, + CLASS_BULLSEYE, + //CLASS_BULLSQUID, + CLASS_CITIZEN_PASSIVE, + CLASS_CITIZEN_REBEL, + CLASS_COMBINE, + CLASS_COMBINE_GUNSHIP, + CLASS_CONSCRIPT, + CLASS_HEADCRAB, + //CLASS_HOUNDEYE, + CLASS_MANHACK, + CLASS_METROPOLICE, + CLASS_MILITARY, + CLASS_SCANNER, + CLASS_STALKER, + CLASS_VORTIGAUNT, + CLASS_ZOMBIE, + CLASS_PROTOSNIPER, + CLASS_MISSILE, + CLASS_FLARE, + CLASS_EARTH_FAUNA, + CLASS_HACKED_ROLLERMINE, + CLASS_COMBINE_HUNTER, + + LAST_SHARED_ENTITY_CLASS, +}; + +// Factions +#define FACTION_NONE 0 // Not assigned a faction. Entities not assigned a faction will not do faction tests. +#define LAST_SHARED_FACTION (FACTION_NONE) +#define NUM_SHARED_FACTIONS (FACTION_NONE + 1) + #endif // SHAREDDEFS_H diff --git a/game/shared/takedamageinfo.h b/game/shared/takedamageinfo.h index c7678aecf..031e2a769 100644 --- a/game/shared/takedamageinfo.h +++ b/game/shared/takedamageinfo.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright ? 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -80,6 +80,9 @@ class CTakeDamageInfo void SetAmmoType( int iAmmoType ); const char * GetAmmoName() const; + float GetRadius() const; + void SetRadius( float fRadius ); + void Set( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, int iKillType = 0 ); void Set( CBaseEntity *pInflictor, CBaseEntity *pAttacker, CBaseEntity *pWeapon, float flDamage, int bitsDamageType, int iKillType = 0 ); void Set( CBaseEntity *pInflictor, CBaseEntity *pAttacker, const Vector &damageForce, const Vector &damagePosition, float flDamage, int bitsDamageType, int iKillType = 0, Vector *reportedPosition = NULL ); @@ -113,6 +116,7 @@ class CTakeDamageInfo int m_iDamageCustom; int m_iDamageStats; int m_iAmmoType; // AmmoType of the weapon used to cause this damage, if any + float m_flRadius; DECLARE_SIMPLE_DATADESC(); }; @@ -331,6 +335,16 @@ inline void CTakeDamageInfo::CopyDamageToBaseDamage() m_flBaseDamage = m_flDamage; } +inline float CTakeDamageInfo::GetRadius() const +{ + return m_flRadius; +} + +inline void CTakeDamageInfo::SetRadius( float flRadius ) +{ + m_flRadius = flRadius; +} + // -------------------------------------------------------------------------------------------------- // // Inlines. diff --git a/game/shared/util_shared.cpp b/game/shared/util_shared.cpp index 068e956e2..485ce1b62 100644 --- a/game/shared/util_shared.cpp +++ b/game/shared/util_shared.cpp @@ -1,1072 +1,2019 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -//=============================================================================// - -#include "cbase.h" -#include "mathlib/mathlib.h" -#include "util_shared.h" -#include "model_types.h" -#include "convar.h" -#include "IEffects.h" -#include "vphysics/object_hash.h" -#include "mathlib/IceKey.H" -#include "checksum_crc.h" -#include "particle_parse.h" -#include "KeyValues.h" - -#ifdef CLIENT_DLL - #include "c_te_effect_dispatch.h" -#else - #include "te_effect_dispatch.h" - -bool NPC_CheckBrushExclude( CBaseEntity *pEntity, CBaseEntity *pBrush ); -#endif - - -// memdbgon must be the last include file in a .cpp file!!! -#include "tier0/memdbgon.h" - -ConVar r_visualizetraces( "r_visualizetraces", "0", FCVAR_CHEAT ); -ConVar developer("developer", "0", 0, "Set developer message level" ); // developer mode - -float UTIL_VecToYaw( const Vector &vec ) -{ - if (vec.y == 0 && vec.x == 0) - return 0; - - float yaw = atan2( vec.y, vec.x ); - - yaw = RAD2DEG(yaw); - - if (yaw < 0) - yaw += 360; - - return yaw; -} - - -float UTIL_VecToPitch( const Vector &vec ) -{ - if (vec.y == 0 && vec.x == 0) - { - if (vec.z < 0) - return 180.0; - else - return -180.0; - } - - float dist = vec.Length2D(); - float pitch = atan2( -vec.z, dist ); - - pitch = RAD2DEG(pitch); - - return pitch; -} - -float UTIL_VecToYaw( const matrix3x4_t &matrix, const Vector &vec ) -{ - Vector tmp = vec; - VectorNormalize( tmp ); - - float x = matrix[0][0] * tmp.x + matrix[1][0] * tmp.y + matrix[2][0] * tmp.z; - float y = matrix[0][1] * tmp.x + matrix[1][1] * tmp.y + matrix[2][1] * tmp.z; - - if (x == 0.0f && y == 0.0f) - return 0.0f; - - float yaw = atan2( -y, x ); - - yaw = RAD2DEG(yaw); - - if (yaw < 0) - yaw += 360; - - return yaw; -} - - -float UTIL_VecToPitch( const matrix3x4_t &matrix, const Vector &vec ) -{ - Vector tmp = vec; - VectorNormalize( tmp ); - - float x = matrix[0][0] * tmp.x + matrix[1][0] * tmp.y + matrix[2][0] * tmp.z; - float z = matrix[0][2] * tmp.x + matrix[1][2] * tmp.y + matrix[2][2] * tmp.z; - - if (x == 0.0f && z == 0.0f) - return 0.0f; - - float pitch = atan2( z, x ); - - pitch = RAD2DEG(pitch); - - if (pitch < 0) - pitch += 360; - - return pitch; -} - -Vector UTIL_YawToVector( float yaw ) -{ - Vector ret; - - ret.z = 0; - float angle = DEG2RAD( yaw ); - SinCos( angle, &ret.y, &ret.x ); - - return ret; -} - -//----------------------------------------------------------------------------- -// Purpose: Helper function get get determinisitc random values for shared/prediction code -// Input : seedvalue - -// *module - -// line - -// Output : static int -//----------------------------------------------------------------------------- -static int SeedFileLineHash( int seedvalue, const char *sharedname, int additionalSeed ) -{ - CRC32_t retval; - - CRC32_Init( &retval ); - - CRC32_ProcessBuffer( &retval, (void *)&seedvalue, sizeof( int ) ); - CRC32_ProcessBuffer( &retval, (void *)&additionalSeed, sizeof( int ) ); - CRC32_ProcessBuffer( &retval, (void *)sharedname, Q_strlen( sharedname ) ); - - CRC32_Final( &retval ); - - return (int)( retval ); -} - -float SharedRandomFloat( const char *sharedname, float flMinVal, float flMaxVal, int additionalSeed /*=0*/ ) -{ - Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); - - int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); - RandomSeed( seed ); - return RandomFloat( flMinVal, flMaxVal ); -} - -int SharedRandomInt( const char *sharedname, int iMinVal, int iMaxVal, int additionalSeed /*=0*/ ) -{ - Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); - - int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); - RandomSeed( seed ); - return RandomInt( iMinVal, iMaxVal ); -} - -Vector SharedRandomVector( const char *sharedname, float minVal, float maxVal, int additionalSeed /*=0*/ ) -{ - Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); - - int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); - RandomSeed( seed ); - // HACK: Can't call RandomVector/Angle because it uses rand() not vstlib Random*() functions! - // Get a random vector. - Vector random; - random.x = RandomFloat( minVal, maxVal ); - random.y = RandomFloat( minVal, maxVal ); - random.z = RandomFloat( minVal, maxVal ); - return random; -} - -QAngle SharedRandomAngle( const char *sharedname, float minVal, float maxVal, int additionalSeed /*=0*/ ) -{ - Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); - - int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); - RandomSeed( seed ); - - // HACK: Can't call RandomVector/Angle because it uses rand() not vstlib Random*() functions! - // Get a random vector. - Vector random; - random.x = RandomFloat( minVal, maxVal ); - random.y = RandomFloat( minVal, maxVal ); - random.z = RandomFloat( minVal, maxVal ); - return QAngle( random.x, random.y, random.z ); -} - - -//----------------------------------------------------------------------------- -// -// Shared client/server trace filter code -// -//----------------------------------------------------------------------------- -bool PassServerEntityFilter( const IHandleEntity *pTouch, const IHandleEntity *pPass ) -{ - if ( !pPass ) - return true; - - if ( pTouch == pPass ) - return false; - - const CBaseEntity *pEntTouch = EntityFromEntityHandle( pTouch ); - const CBaseEntity *pEntPass = EntityFromEntityHandle( pPass ); - if ( !pEntTouch || !pEntPass ) - return true; - - // don't clip against own missiles - if ( pEntTouch->GetOwnerEntity() == pEntPass ) - return false; - - // don't clip against owner - if ( pEntPass->GetOwnerEntity() == pEntTouch ) - return false; - - - return true; -} - - -//----------------------------------------------------------------------------- -// A standard filter to be applied to just about everything. -//----------------------------------------------------------------------------- -bool StandardFilterRules( IHandleEntity *pHandleEntity, int fContentsMask ) -{ - CBaseEntity *pCollide = EntityFromEntityHandle( pHandleEntity ); - - // Static prop case... - if ( !pCollide ) - return true; - - SolidType_t solid = pCollide->GetSolid(); - const model_t *pModel = pCollide->GetModel(); - - if ( ( modelinfo->GetModelType( pModel ) != mod_brush ) || (solid != SOLID_BSP && solid != SOLID_VPHYSICS) ) - { - if ( (fContentsMask & CONTENTS_MONSTER) == 0 ) - return false; - } - - // This code is used to cull out tests against see-thru entities - if ( !(fContentsMask & CONTENTS_WINDOW) && pCollide->IsTransparent() ) - return false; - - // FIXME: this is to skip BSP models that are entities that can be - // potentially moved/deleted, similar to a monster but doors don't seem to - // be flagged as monsters - // FIXME: the FL_WORLDBRUSH looked promising, but it needs to be set on - // everything that's actually a worldbrush and it currently isn't - if ( !(fContentsMask & CONTENTS_MOVEABLE) && (pCollide->GetMoveType() == MOVETYPE_PUSH))// !(touch->flags & FL_WORLDBRUSH) ) - return false; - - return true; -} - - - -//----------------------------------------------------------------------------- -// Simple trace filter -//----------------------------------------------------------------------------- -CTraceFilterSimple::CTraceFilterSimple( const IHandleEntity *passedict, int collisionGroup ) -{ - m_pPassEnt = passedict; - m_collisionGroup = collisionGroup; -} - - -//----------------------------------------------------------------------------- -// The trace filter! -//----------------------------------------------------------------------------- -bool CTraceFilterSimple::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - if ( !StandardFilterRules( pHandleEntity, contentsMask ) ) - return false; - - if ( m_pPassEnt ) - { - if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt ) ) - { - return false; - } - } - - // Don't test if the game code tells us we should ignore this collision... - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( !pEntity ) - return false; - if ( !pEntity->ShouldCollide( m_collisionGroup, contentsMask ) ) - return false; - if ( pEntity && !g_pGameRules->ShouldCollide( m_collisionGroup, pEntity->GetCollisionGroup() ) ) - return false; - - return true; -} - -//----------------------------------------------------------------------------- -// Purpose: Trace filter that only hits NPCs and the player -//----------------------------------------------------------------------------- -bool CTraceFilterOnlyNPCsAndPlayer::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - if ( CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ) ) - { - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( !pEntity ) - return false; - -#ifdef CSTRIKE_DLL -#ifndef CLIENT_DLL - if ( pEntity->Classify() == CLASS_PLAYER_ALLY ) - return true; // CS hostages are CLASS_PLAYER_ALLY but not IsNPC() -#endif // !CLIENT_DLL -#endif // CSTRIKE_DLL - return (pEntity->IsNPC() || pEntity->IsPlayer()); - } - return false; -} - -//----------------------------------------------------------------------------- -// Purpose: Trace filter that only hits anything but NPCs and the player -//----------------------------------------------------------------------------- -bool CTraceFilterNoNPCsOrPlayer::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - if ( CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ) ) - { - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( !pEntity ) - return false; -#ifndef CLIENT_DLL - if ( pEntity->Classify() == CLASS_PLAYER_ALLY ) - return false; // CS hostages are CLASS_PLAYER_ALLY but not IsNPC() -#endif - return (!pEntity->IsNPC() && !pEntity->IsPlayer()); - } - return false; -} - -//----------------------------------------------------------------------------- -// Trace filter that skips two entities -//----------------------------------------------------------------------------- -CTraceFilterSkipTwoEntities::CTraceFilterSkipTwoEntities( const IHandleEntity *passentity, const IHandleEntity *passentity2, int collisionGroup ) : - BaseClass( passentity, collisionGroup ), m_pPassEnt2(passentity2) -{ -} - -bool CTraceFilterSkipTwoEntities::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - Assert( pHandleEntity ); - if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt2 ) ) - return false; - - return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); -} - - -//----------------------------------------------------------------------------- -// Trace filter that can take a list of entities to ignore -//----------------------------------------------------------------------------- -CTraceFilterSimpleList::CTraceFilterSimpleList( int collisionGroup ) : - CTraceFilterSimple( NULL, collisionGroup ) -{ -} - - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -bool CTraceFilterSimpleList::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - if ( m_PassEntities.Find(pHandleEntity) != m_PassEntities.InvalidIndex() ) - return false; - - return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); -} - - -//----------------------------------------------------------------------------- -// Purpose: Add an entity to my list of entities to ignore in the trace -//----------------------------------------------------------------------------- -void CTraceFilterSimpleList::AddEntityToIgnore( IHandleEntity *pEntity ) -{ - m_PassEntities.AddToTail( pEntity ); -} - - -//----------------------------------------------------------------------------- -// Purpose: Custom trace filter used for NPC LOS traces -//----------------------------------------------------------------------------- -CTraceFilterLOS::CTraceFilterLOS( IHandleEntity *pHandleEntity, int collisionGroup, IHandleEntity *pHandleEntity2 ) : - CTraceFilterSkipTwoEntities( pHandleEntity, pHandleEntity2, collisionGroup ) -{ -} - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -bool CTraceFilterLOS::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - - if ( !pEntity->BlocksLOS() ) - return false; - - return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); -} - -//----------------------------------------------------------------------------- -// Trace filter that can take a classname to ignore -//----------------------------------------------------------------------------- -CTraceFilterSkipClassname::CTraceFilterSkipClassname( const IHandleEntity *passentity, const char *pchClassname, int collisionGroup ) : -CTraceFilterSimple( passentity, collisionGroup ), m_pchClassname( pchClassname ) -{ -} - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -bool CTraceFilterSkipClassname::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( !pEntity || FClassnameIs( pEntity, m_pchClassname ) ) - return false; - - return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); -} - -//----------------------------------------------------------------------------- -// Trace filter that skips two classnames -//----------------------------------------------------------------------------- -CTraceFilterSkipTwoClassnames::CTraceFilterSkipTwoClassnames( const IHandleEntity *passentity, const char *pchClassname, const char *pchClassname2, int collisionGroup ) : -BaseClass( passentity, pchClassname, collisionGroup ), m_pchClassname2(pchClassname2) -{ -} - -bool CTraceFilterSkipTwoClassnames::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( !pEntity || FClassnameIs( pEntity, m_pchClassname2 ) ) - return false; - - return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); -} - -//----------------------------------------------------------------------------- -// Trace filter that can take a list of entities to ignore -//----------------------------------------------------------------------------- -CTraceFilterSimpleClassnameList::CTraceFilterSimpleClassnameList( const IHandleEntity *passentity, int collisionGroup ) : -CTraceFilterSimple( passentity, collisionGroup ) -{ -} - - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -bool CTraceFilterSimpleClassnameList::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( !pEntity ) - return false; - - for ( int i = 0; i < m_PassClassnames.Count(); ++i ) - { - if ( FClassnameIs( pEntity, m_PassClassnames[ i ] ) ) - return false; - } - - return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); -} - - -//----------------------------------------------------------------------------- -// Purpose: Add an entity to my list of entities to ignore in the trace -//----------------------------------------------------------------------------- -void CTraceFilterSimpleClassnameList::AddClassnameToIgnore( const char *pchClassname ) -{ - m_PassClassnames.AddToTail( pchClassname ); -} - -CTraceFilterChain::CTraceFilterChain( ITraceFilter *pTraceFilter1, ITraceFilter *pTraceFilter2 ) -{ - m_pTraceFilter1 = pTraceFilter1; - m_pTraceFilter2 = pTraceFilter2; -} - -bool CTraceFilterChain::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) -{ - bool bResult1 = true; - bool bResult2 = true; - - if ( m_pTraceFilter1 ) - bResult1 = m_pTraceFilter1->ShouldHitEntity( pHandleEntity, contentsMask ); - - - if ( m_pTraceFilter2 ) - bResult2 = m_pTraceFilter2->ShouldHitEntity( pHandleEntity, contentsMask ); - - return ( bResult1 && bResult2 ); -} - -//----------------------------------------------------------------------------- -// Sweeps against a particular model, using collision rules -//----------------------------------------------------------------------------- -void UTIL_TraceModel( const Vector &vecStart, const Vector &vecEnd, const Vector &hullMin, - const Vector &hullMax, CBaseEntity *pentModel, int collisionGroup, trace_t *ptr ) -{ - // Cull it.... - if ( pentModel && pentModel->ShouldCollide( collisionGroup, MASK_ALL ) ) - { - Ray_t ray; - ray.Init( vecStart, vecEnd, hullMin, hullMax ); - enginetrace->ClipRayToEntity( ray, MASK_ALL, pentModel, ptr ); - } - else - { - memset( ptr, 0, sizeof(trace_t) ); - ptr->fraction = 1.0f; - } -} - -bool UTIL_EntityHasMatchingRootParent( CBaseEntity *pRootParent, CBaseEntity *pEntity ) -{ - if ( pRootParent ) - { - // NOTE: Don't let siblings/parents collide. - if ( pRootParent == pEntity->GetRootMoveParent() ) - return true; - if ( pEntity->GetOwnerEntity() && pRootParent == pEntity->GetOwnerEntity()->GetRootMoveParent() ) - return true; - } - return false; -} - -//----------------------------------------------------------------------------- -// Sweep an entity from the starting to the ending position -//----------------------------------------------------------------------------- -class CTraceFilterEntity : public CTraceFilterSimple -{ - DECLARE_CLASS( CTraceFilterEntity, CTraceFilterSimple ); - -public: - CTraceFilterEntity( CBaseEntity *pEntity, int nCollisionGroup ) - : CTraceFilterSimple( pEntity, nCollisionGroup ) - { - m_pRootParent = pEntity->GetRootMoveParent(); - m_pEntity = pEntity; - m_checkHash = g_EntityCollisionHash->IsObjectInHash(pEntity); - } - - bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) - { - CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( !pEntity ) - return false; - - // Check parents against each other - // NOTE: Don't let siblings/parents collide. - if ( UTIL_EntityHasMatchingRootParent( m_pRootParent, pEntity ) ) - return false; - - if ( m_checkHash ) - { - if ( g_EntityCollisionHash->IsObjectPairInHash( m_pEntity, pEntity ) ) - return false; - } - -#ifndef CLIENT_DLL - if ( m_pEntity->IsNPC() ) - { - if ( NPC_CheckBrushExclude( m_pEntity, pEntity ) ) - return false; - - } -#endif - - return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); - } - -private: - - CBaseEntity *m_pRootParent; - CBaseEntity *m_pEntity; - bool m_checkHash; -}; - -class CTraceFilterEntityIgnoreOther : public CTraceFilterEntity -{ - DECLARE_CLASS( CTraceFilterEntityIgnoreOther, CTraceFilterEntity ); -public: - CTraceFilterEntityIgnoreOther( CBaseEntity *pEntity, const IHandleEntity *pIgnore, int nCollisionGroup ) : - CTraceFilterEntity( pEntity, nCollisionGroup ), m_pIgnoreOther( pIgnore ) - { - } - - bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) - { - if ( pHandleEntity == m_pIgnoreOther ) - return false; - - return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); - } - -private: - const IHandleEntity *m_pIgnoreOther; -}; - -//----------------------------------------------------------------------------- -// Sweeps a particular entity through the world -//----------------------------------------------------------------------------- -void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, unsigned int mask, trace_t *ptr ) -{ - ICollideable *pCollision = pEntity->GetCollideable(); - - // Adding this assertion here so game code catches it, but really the assertion belongs in the engine - // because one day, rotated collideables will work! - Assert( pCollision->GetCollisionAngles() == vec3_angle ); - - CTraceFilterEntity traceFilter( pEntity, pCollision->GetCollisionGroup() ); - -#ifdef PORTAL - UTIL_Portal_TraceEntity( pEntity, vecAbsStart, vecAbsEnd, mask, &traceFilter, ptr ); -#else - enginetrace->SweepCollideable( pCollision, vecAbsStart, vecAbsEnd, pCollision->GetCollisionAngles(), mask, &traceFilter, ptr ); -#endif -} - -void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, - unsigned int mask, const IHandleEntity *pIgnore, int nCollisionGroup, trace_t *ptr ) -{ - ICollideable *pCollision; - pCollision = pEntity->GetCollideable(); - - // Adding this assertion here so game code catches it, but really the assertion belongs in the engine - // because one day, rotated collideables will work! - Assert( pCollision->GetCollisionAngles() == vec3_angle ); - - CTraceFilterEntityIgnoreOther traceFilter( pEntity, pIgnore, nCollisionGroup ); - -#ifdef PORTAL - UTIL_Portal_TraceEntity( pEntity, vecAbsStart, vecAbsEnd, mask, &traceFilter, ptr ); -#else - enginetrace->SweepCollideable( pCollision, vecAbsStart, vecAbsEnd, pCollision->GetCollisionAngles(), mask, &traceFilter, ptr ); -#endif -} - -void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, - unsigned int mask, ITraceFilter *pFilter, trace_t *ptr ) -{ - ICollideable *pCollision; - pCollision = pEntity->GetCollideable(); - - // Adding this assertion here so game code catches it, but really the assertion belongs in the engine - // because one day, rotated collideables will work! - Assert( pCollision->GetCollisionAngles() == vec3_angle ); - -#ifdef PORTAL - UTIL_Portal_TraceEntity( pEntity, vecAbsStart, vecAbsEnd, mask, pFilter, ptr ); -#else - enginetrace->SweepCollideable( pCollision, vecAbsStart, vecAbsEnd, pCollision->GetCollisionAngles(), mask, pFilter, ptr ); -#endif -} - -// ---- -// This is basically a regular TraceLine that uses the FilterEntity filter. -void UTIL_TraceLineFilterEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, - unsigned int mask, int nCollisionGroup, trace_t *ptr ) -{ - CTraceFilterEntity traceFilter( pEntity, nCollisionGroup ); - UTIL_TraceLine( vecAbsStart, vecAbsEnd, mask, &traceFilter, ptr ); -} - -void UTIL_ClipTraceToPlayers( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, ITraceFilter *filter, trace_t *tr ) -{ - trace_t playerTrace; - Ray_t ray; - float smallestFraction = tr->fraction; - const float maxRange = 60.0f; - - ray.Init( vecAbsStart, vecAbsEnd ); - - for ( int k = 1; k <= gpGlobals->maxClients; ++k ) - { - CBasePlayer *player = UTIL_PlayerByIndex( k ); - - if ( !player || !player->IsAlive() ) - continue; - -#ifdef CLIENT_DLL - if ( player->IsDormant() ) - continue; -#endif // CLIENT_DLL - - if ( filter && filter->ShouldHitEntity( player, mask ) == false ) - continue; - - float range = DistanceToRay( player->WorldSpaceCenter(), vecAbsStart, vecAbsEnd ); - if ( range < 0.0f || range > maxRange ) - continue; - - enginetrace->ClipRayToEntity( ray, mask|CONTENTS_HITBOX, player, &playerTrace ); - if ( playerTrace.fraction < smallestFraction ) - { - // we shortened the ray - save off the trace - *tr = playerTrace; - smallestFraction = playerTrace.fraction; - } - } -} - -//----------------------------------------------------------------------------- -// Purpose: Make a tracer using a particle effect -//----------------------------------------------------------------------------- -void UTIL_ParticleTracer( const char *pszTracerEffectName, const Vector &vecStart, const Vector &vecEnd, - int iEntIndex, int iAttachment, bool bWhiz ) -{ - int iParticleIndex = GetParticleSystemIndex( pszTracerEffectName ); - UTIL_Tracer( vecStart, vecEnd, iEntIndex, iAttachment, 0, bWhiz, "ParticleTracer", iParticleIndex ); -} - -//----------------------------------------------------------------------------- -// Purpose: Make a tracer effect using the old, non-particle system, tracer effects. -//----------------------------------------------------------------------------- -void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex, - int iAttachment, float flVelocity, bool bWhiz, const char *pCustomTracerName, int iParticleID ) -{ - CEffectData data; - data.m_vStart = vecStart; - data.m_vOrigin = vecEnd; -#ifdef CLIENT_DLL - data.m_hEntity = ClientEntityList().EntIndexToHandle( iEntIndex ); -#else - data.m_nEntIndex = iEntIndex; -#endif - data.m_flScale = flVelocity; - data.m_nHitBox = iParticleID; - - // Flags - if ( bWhiz ) - { - data.m_fFlags |= TRACER_FLAG_WHIZ; - } - - if ( iAttachment != TRACER_DONT_USE_ATTACHMENT ) - { - data.m_fFlags |= TRACER_FLAG_USEATTACHMENT; - data.m_nAttachmentIndex = iAttachment; - } - - // Fire it off - if ( pCustomTracerName ) - { - DispatchEffect( pCustomTracerName, data ); - } - else - { - DispatchEffect( "Tracer", data ); - } -} - - -void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) -{ - if ( !UTIL_ShouldShowBlood( color ) ) - return; - - if ( color == DONT_BLEED || amount == 0 ) - return; - - if ( g_Language.GetInt() == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED ) - color = 0; - - if ( g_pGameRules->IsMultiplayer() ) - { - // scale up blood effect in multiplayer for better visibility - amount *= 5; - } - - if ( amount > 255 ) - amount = 255; - - if (color == BLOOD_COLOR_MECH) - { - g_pEffects->Sparks(origin); - if (random->RandomFloat(0, 2) >= 1) - { - UTIL_Smoke(origin, random->RandomInt(10, 15), 10); - } - } - else - { - // Normal blood impact - UTIL_BloodImpact( origin, direction, color, amount ); - } -} - -//----------------------------------------------------------------------------- -// Purpose: Returns low violence settings -//----------------------------------------------------------------------------- -static ConVar violence_hblood( "violence_hblood","1", 0, "Draw human blood" ); -static ConVar violence_hgibs( "violence_hgibs","1", 0, "Show human gib entities" ); -static ConVar violence_ablood( "violence_ablood","1", 0, "Draw alien blood" ); -static ConVar violence_agibs( "violence_agibs","1", 0, "Show alien gib entities" ); - -bool UTIL_IsLowViolence( void ) -{ - // These convars are no longer necessary -- the engine is the final arbiter of - // violence settings -- but they're here for legacy support and for testing low - // violence when the engine is in normal violence mode. - if ( !violence_hblood.GetBool() || !violence_ablood.GetBool() || !violence_hgibs.GetBool() || !violence_agibs.GetBool() ) - return true; - - return engine->IsLowViolence(); -} - -bool UTIL_ShouldShowBlood( int color ) -{ - if ( color != DONT_BLEED ) - { - if ( color == BLOOD_COLOR_RED ) - { - return violence_hblood.GetBool(); - } - else - { - return violence_ablood.GetBool(); - } - } - return false; -} - - -//------------------------------------------------------------------------------ -// Purpose : Use trace to pass a specific decal type to the entity being decaled -// Input : -// Output : -//------------------------------------------------------------------------------ -void UTIL_DecalTrace( trace_t *pTrace, char const *decalName ) -{ - if (pTrace->fraction == 1.0) - return; - - CBaseEntity *pEntity = pTrace->m_pEnt; - pEntity->DecalTrace( pTrace, decalName ); -} - - -void UTIL_BloodDecalTrace( trace_t *pTrace, int bloodColor ) -{ - if ( UTIL_ShouldShowBlood( bloodColor ) ) - { - if ( bloodColor == BLOOD_COLOR_RED ) - { - UTIL_DecalTrace( pTrace, "Blood" ); - } - else - { - UTIL_DecalTrace( pTrace, "YellowBlood" ); - } - } -} - -//----------------------------------------------------------------------------- -// Purpose: -// Input : &pos - -// &dir - -// color - -// amount - -//----------------------------------------------------------------------------- -void UTIL_BloodImpact( const Vector &pos, const Vector &dir, int color, int amount ) -{ - CEffectData data; - - data.m_vOrigin = pos; - data.m_vNormal = dir; - data.m_flScale = (float)amount; - data.m_nColor = (unsigned char)color; - - DispatchEffect( "bloodimpact", data ); -} - -bool UTIL_IsSpaceEmpty( CBaseEntity *pMainEnt, const Vector &vMin, const Vector &vMax ) -{ - Vector vHalfDims = ( vMax - vMin ) * 0.5f; - Vector vCenter = vMin + vHalfDims; - - trace_t trace; - - UTIL_TraceHull( vCenter, vCenter, -vHalfDims, vHalfDims, MASK_SOLID, pMainEnt, COLLISION_GROUP_NONE, &trace ); - - bool bClear = ( trace.fraction == 1 && trace.allsolid != 1 && (trace.startsolid != 1) ); - return bClear; -} - -void UTIL_StringToFloatArray( float *pVector, int count, const char *pString ) -{ - char *pstr, *pfront, tempString[128]; - int j; - - Q_strncpy( tempString, pString, sizeof(tempString) ); - pstr = pfront = tempString; - - for ( j = 0; j < count; j++ ) // lifted from pr_edict.c - { - pVector[j] = atof( pfront ); - - // skip any leading whitespace - while ( *pstr && *pstr <= ' ' ) - pstr++; - - // skip to next whitespace - while ( *pstr && *pstr > ' ' ) - pstr++; - - if (!*pstr) - break; - - pstr++; - pfront = pstr; - } - for ( j++; j < count; j++ ) - { - pVector[j] = 0; - } -} - -void UTIL_StringToVector( float *pVector, const char *pString ) -{ - UTIL_StringToFloatArray( pVector, 3, pString ); -} - -void UTIL_StringToIntArray( int *pVector, int count, const char *pString ) -{ - char *pstr, *pfront, tempString[128]; - int j; - - Q_strncpy( tempString, pString, sizeof(tempString) ); - pstr = pfront = tempString; - - for ( j = 0; j < count; j++ ) // lifted from pr_edict.c - { - pVector[j] = atoi( pfront ); - - while ( *pstr && *pstr != ' ' ) - pstr++; - if (!*pstr) - break; - pstr++; - pfront = pstr; - } - - for ( j++; j < count; j++ ) - { - pVector[j] = 0; - } -} - -void UTIL_StringToColor32( color32 *color, const char *pString ) -{ - int tmp[4]; - UTIL_StringToIntArray( tmp, 4, pString ); - color->r = tmp[0]; - color->g = tmp[1]; - color->b = tmp[2]; - color->a = tmp[3]; -} - -#ifndef _XBOX -void UTIL_DecodeICE( unsigned char * buffer, int size, const unsigned char *key) -{ - if ( !key ) - return; - - IceKey ice( 0 ); // level 0 = 64bit key - ice.set( key ); // set key - - int blockSize = ice.blockSize(); - - unsigned char *temp = (unsigned char *)_alloca( PAD_NUMBER( size, blockSize ) ); - unsigned char *p1 = buffer; - unsigned char *p2 = temp; - - // encrypt data in 8 byte blocks - int bytesLeft = size; - while ( bytesLeft >= blockSize ) - { - ice.decrypt( p1, p2 ); - bytesLeft -= blockSize; - p1+=blockSize; - p2+=blockSize; - } - - // copy encrypted data back to original buffer - Q_memcpy( buffer, temp, size-bytesLeft ); -} -#endif - -// work-around since client header doesn't like inlined gpGlobals->curtime -float IntervalTimer::Now( void ) const -{ - return gpGlobals->curtime; -} - -// work-around since client header doesn't like inlined gpGlobals->curtime -float CountdownTimer::Now( void ) const -{ - return gpGlobals->curtime; -} - - -#ifdef CLIENT_DLL - CBasePlayer *UTIL_PlayerByIndex( int entindex ) - { - return ToBasePlayer( ClientEntityList().GetEnt( entindex ) ); - } -#endif - - -unsigned short UTIL_GetAchievementEventMask( void ) -{ - CRC32_t mapCRC; - CRC32_Init( &mapCRC ); - - char lowercase[ 256 ]; -#ifdef CLIENT_DLL - Q_FileBase( engine->GetLevelName(), lowercase, sizeof( lowercase ) ); -#else - Q_strncpy( lowercase, STRING( gpGlobals->mapname ), sizeof( lowercase ) ); -#endif - Q_strlower( lowercase ); - - CRC32_ProcessBuffer( &mapCRC, lowercase, Q_strlen( lowercase ) ); - CRC32_Final( &mapCRC ); - - return ( mapCRC & 0xFFFF ); -} - -const char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename ) -{ - const char *pValue = pSub->GetString( pName, NULL ); - if ( !pValue ) - { - if ( pFilename ) - { - DevWarning( "Can't get key value '%s' from file '%s'.\n", pName, pFilename ); - } - return ""; - } - - int len = Q_strlen( pValue ) + 1; - char *pAlloced = new char[ len ]; - Assert( pAlloced ); - Q_strncpy( pAlloced, pValue, len ); - return pAlloced; -} - -int UTIL_StringFieldToInt( const char *szValue, const char **pValueStrings, int iNumStrings ) -{ - if ( !szValue || !szValue[0] ) - return -1; - - for ( int i = 0; i < iNumStrings; i++ ) - { - if ( FStrEq(szValue, pValueStrings[i]) ) - return i; - } - - Assert(0); - return -1; -} +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +//===========================================================================// + +#include "cbase.h" +#include "mathlib/mathlib.h" +#include "util_shared.h" +#include "model_types.h" +#include "convar.h" +#include "IEffects.h" +#include "vphysics/object_hash.h" +#include "mathlib/IceKey.H" +#include "checksum_crc.h" +#include "particle_parse.h" +#include "KeyValues.h" +#include "icommandline.h" + +#ifdef CLIENT_DLL + #include "clientleafsystem.h" + #include "c_te_effect_dispatch.h" +#else + #include "te_effect_dispatch.h" + +bool NPC_CheckBrushExclude( CBaseEntity *pEntity, CBaseEntity *pBrush ); +#endif + + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +ConVar r_visualizetraces( "r_visualizetraces", "0", FCVAR_CHEAT ); +ConVar developer("developer", "0", FCVAR_RELEASE, "Set developer message level" ); // developer mode + +#ifdef DETECT_TRACE_SPIKES +float g_TraceSpikeTolerance = 0.25; +ConVar trace_spike_tolerance( "trace_spike_tolerance", "0.25" ); + +void DoReportExpensiveTrace( bool repeat, float time ) +{ + if ( g_TraceSpikeTolerance > 0.0f ) + { + Msg( "%s%f!\n", ( repeat ) ? " R: " : "", time ); + } + g_TraceSpikeTolerance = trace_spike_tolerance.GetFloat(); +} +#endif + +float UTIL_VecToYaw( const Vector &vec ) +{ + if (vec.y == 0 && vec.x == 0) + return 0; + + float yaw = atan2( vec.y, vec.x ); + + yaw = RAD2DEG(yaw); + + if (yaw < 0) + yaw += 360; + + return yaw; +} + +float UTIL_VecToPitch( const Vector &vec ) +{ + float pitch = 0; + Vector tmp = vec; + if ( VectorNormalize( tmp ) > 0 ) + { + pitch = RAD2DEG( asin( -tmp.z ) ); + } + return pitch; +} + +float UTIL_VecToYaw( const matrix3x4_t &matrix, const Vector &vec ) +{ + Vector tmp = vec; + VectorNormalize( tmp ); + + float x = matrix[0][0] * tmp.x + matrix[1][0] * tmp.y + matrix[2][0] * tmp.z; + float y = matrix[0][1] * tmp.x + matrix[1][1] * tmp.y + matrix[2][1] * tmp.z; + + if (x == 0.0f && y == 0.0f) + return 0.0f; + + float yaw = atan2( -y, x ); + + yaw = RAD2DEG(yaw); + + if (yaw < 0) + yaw += 360; + + return yaw; +} + +float UTIL_VecToPitch( const matrix3x4_t &matrix, const Vector &vec ) +{ + float pitch = 0; + Vector tmp = vec; + if ( VectorNormalize( tmp ) > 0 ) + { + float z = matrix[0][2] * tmp.x + matrix[1][2] * tmp.y + matrix[2][2] * tmp.z; + pitch = RAD2DEG( asin( -z ) ); + if (pitch < 0) + pitch += 360; + } + return pitch; +} + +Vector UTIL_YawToVector( float yaw ) +{ + Vector ret; + + ret.z = 0; + float angle = DEG2RAD( yaw ); + SinCos( angle, &ret.y, &ret.x ); + + return ret; +} + +//----------------------------------------------------------------------------- +// Purpose: Helper function get get determinisitc random values for shared/prediction code +// Input : seedvalue - +// *module - +// line - +// Output : static int +//----------------------------------------------------------------------------- +static int SeedFileLineHash( int seedvalue, const char *sharedname, int additionalSeed ) +{ + CRC32_t retval; + + CRC32_Init( &retval ); + + CRC32_ProcessBuffer( &retval, (void *)&seedvalue, sizeof( int ) ); + CRC32_ProcessBuffer( &retval, (void *)&additionalSeed, sizeof( int ) ); + CRC32_ProcessBuffer( &retval, (void *)sharedname, Q_strlen( sharedname ) ); + + CRC32_Final( &retval ); + + return (int)( retval ); +} + +float SharedRandomFloat( const char *sharedname, float flMinVal, float flMaxVal, int additionalSeed /*=0*/ ) +{ + Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); + + int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); + RandomSeed( seed ); + return RandomFloat( flMinVal, flMaxVal ); +} + +int SharedRandomInt( const char *sharedname, int iMinVal, int iMaxVal, int additionalSeed /*=0*/ ) +{ + Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); + + int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); + RandomSeed( seed ); + return RandomInt( iMinVal, iMaxVal ); +} + +Vector SharedRandomVector( const char *sharedname, float minVal, float maxVal, int additionalSeed /*=0*/ ) +{ + Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); + + int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); + RandomSeed( seed ); + // HACK: Can't call RandomVector/Angle because it uses rand() not vstlib Random*() functions! + // Get a random vector. + Vector random; + random.x = RandomFloat( minVal, maxVal ); + random.y = RandomFloat( minVal, maxVal ); + random.z = RandomFloat( minVal, maxVal ); + return random; +} + +QAngle SharedRandomAngle( const char *sharedname, float minVal, float maxVal, int additionalSeed /*=0*/ ) +{ + Assert( CBaseEntity::GetPredictionRandomSeed() != -1 ); + + int seed = SeedFileLineHash( CBaseEntity::GetPredictionRandomSeed(), sharedname, additionalSeed ); + RandomSeed( seed ); + + // HACK: Can't call RandomVector/Angle because it uses rand() not vstlib Random*() functions! + // Get a random vector. + Vector random; + random.x = RandomFloat( minVal, maxVal ); + random.y = RandomFloat( minVal, maxVal ); + random.z = RandomFloat( minVal, maxVal ); + return QAngle( random.x, random.y, random.z ); +} + + +//----------------------------------------------------------------------------- +// +// Shared client/server trace filter code +// +//----------------------------------------------------------------------------- +bool PassServerEntityFilter( const IHandleEntity *pTouch, const IHandleEntity *pPass ) +{ + if ( !pPass ) + return true; + + if ( pTouch == pPass ) + return false; + + const CBaseEntity *pEntTouch = EntityFromEntityHandle( pTouch ); + const CBaseEntity *pEntPass = EntityFromEntityHandle( pPass ); + if ( !pEntTouch || !pEntPass ) + return true; + + // don't clip against own missiles + if ( pEntTouch->GetOwnerEntity() == pEntPass ) + return false; + + // don't clip against owner + if ( pEntPass->GetOwnerEntity() == pEntTouch ) + return false; + + + return true; +} + + +//----------------------------------------------------------------------------- +// A standard filter to be applied to just about everything. +//----------------------------------------------------------------------------- +bool StandardFilterRules( IHandleEntity *pHandleEntity, int fContentsMask ) +{ + CBaseEntity *pCollide = EntityFromEntityHandle( pHandleEntity ); + + // Static prop case... + if ( !pCollide ) + return true; + + SolidType_t solid = pCollide->GetSolid(); + const model_t *pModel = pCollide->GetModel(); + + if ( ( modelinfo->GetModelType( pModel ) != mod_brush ) || (solid != SOLID_BSP && solid != SOLID_VPHYSICS) ) + { + if ( (fContentsMask & CONTENTS_MONSTER) == 0 ) + return false; + } + + // This code is used to cull out tests against see-thru entities + if ( !(fContentsMask & CONTENTS_WINDOW) ) + { +#ifdef CLIENT_DLL + if ( g_pClientLeafSystem->GetTranslucencyType( pCollide->RenderHandle() ) == RENDERABLE_IS_TRANSLUCENT ) + return false; +#else + bool bIsTranslucent = modelinfo->IsTranslucent( pModel ); + bool bIsTwoPass = modelinfo->IsTranslucentTwoPass( pModel ); + if ( bIsTranslucent && !bIsTwoPass ) + return false; +#endif + } + + // FIXME: this is to skip BSP models that are entities that can be + // potentially moved/deleted, similar to a monster but doors don't seem to + // be flagged as monsters + // FIXME: the FL_WORLDBRUSH looked promising, but it needs to be set on + // everything that's actually a worldbrush and it currently isn't + if ( !(fContentsMask & CONTENTS_MOVEABLE) && (pCollide->GetMoveType() == MOVETYPE_PUSH))// !(touch->flags & FL_WORLDBRUSH) ) + return false; + + return true; +} + + + +//----------------------------------------------------------------------------- +// Simple trace filter +//----------------------------------------------------------------------------- +CTraceFilterSimple::CTraceFilterSimple( const IHandleEntity *passedict, int collisionGroup, + ShouldHitFunc_t pExtraShouldHitFunc ) +{ + m_pPassEnt = passedict; + m_collisionGroup = collisionGroup; + m_pExtraShouldHitCheckFunction = pExtraShouldHitFunc; +} + + +//----------------------------------------------------------------------------- +// The trace filter! +//----------------------------------------------------------------------------- +bool CTraceFilterSimple::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + if ( !StandardFilterRules( pHandleEntity, contentsMask ) ) + return false; + + if ( m_pPassEnt ) + { + if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt ) ) + { + return false; + } + } + + // Don't test if the game code tells us we should ignore this collision... + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( !pEntity ) + return false; + if ( !pEntity->ShouldCollide( m_collisionGroup, contentsMask ) ) + return false; + if ( pEntity && !g_pGameRules->ShouldCollide( m_collisionGroup, pEntity->GetCollisionGroup() ) ) + return false; + if ( m_pExtraShouldHitCheckFunction && + (! ( m_pExtraShouldHitCheckFunction( pHandleEntity, contentsMask ) ) ) ) + return false; + return true; +} + +//----------------------------------------------------------------------------- +// Purpose: Trace filter that only hits NPCs and the player +//----------------------------------------------------------------------------- +bool CTraceFilterOnlyNPCsAndPlayer::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + if ( CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ) ) + { + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( !pEntity ) + return false; + + + return (pEntity->IsNPC() || pEntity->IsPlayer()); + } + return false; +} + +//----------------------------------------------------------------------------- +// Purpose: Trace filter that only hits anything but NPCs and the player +//----------------------------------------------------------------------------- +bool CTraceFilterNoNPCsOrPlayer::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + if ( CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ) ) + { + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( !pEntity ) + return NULL; +#ifndef CLIENT_DLL + if ( pEntity->Classify() == CLASS_PLAYER_ALLY ) + return false; // CS hostages are CLASS_PLAYER_ALLY but not IsNPC() +#endif + return (!pEntity->IsNPC() && !pEntity->IsPlayer()); + } + return false; +} + +//----------------------------------------------------------------------------- +// Trace filter that skips two entities +//----------------------------------------------------------------------------- +CTraceFilterSkipTwoEntities::CTraceFilterSkipTwoEntities( const IHandleEntity *passentity, const IHandleEntity *passentity2, int collisionGroup ) : + BaseClass( passentity, collisionGroup ), m_pPassEnt2(passentity2) +{ +} + +bool CTraceFilterSkipTwoEntities::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + Assert( pHandleEntity ); + if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt2 ) ) + return false; + + return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); +} + + +//----------------------------------------------------------------------------- +// Trace filter that can take a list of entities to ignore +//----------------------------------------------------------------------------- +CTraceFilterSimpleList::CTraceFilterSimpleList( int collisionGroup ) : + CTraceFilterSimple( NULL, collisionGroup ) +{ +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTraceFilterSimpleList::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + if ( m_PassEntities.Find(pHandleEntity) != m_PassEntities.InvalidIndex() ) + return false; + + return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Add an entity to my list of entities to ignore in the trace +//----------------------------------------------------------------------------- +void CTraceFilterSimpleList::AddEntityToIgnore( IHandleEntity *pEntity ) +{ + m_PassEntities.AddToTail( pEntity ); +} + +void CTraceFilterSimpleList::AddEntitiesToIgnore( int nCount, IHandleEntity **ppEntities ) +{ + int nIndex = m_PassEntities.AddMultipleToTail( nCount ); + memcpy( &m_PassEntities[nIndex], ppEntities, nCount * sizeof( IHandleEntity* ) ); +} + +//----------------------------------------------------------------------------- +// Trace filter that hits only the pass entity +//----------------------------------------------------------------------------- +CTraceFilterOnlyHitThis::CTraceFilterOnlyHitThis( const IHandleEntity *hitentity ) +{ + m_pHitEnt = hitentity; +} + +bool CTraceFilterOnlyHitThis::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + return m_pHitEnt == pHandleEntity; +} + + +//----------------------------------------------------------------------------- +// Purpose: Custom trace filter used for NPC LOS traces +//----------------------------------------------------------------------------- +CTraceFilterLOS::CTraceFilterLOS( IHandleEntity *pHandleEntity, int collisionGroup, IHandleEntity *pHandleEntity2 ) : + CTraceFilterSkipTwoEntities( pHandleEntity, pHandleEntity2, collisionGroup ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTraceFilterLOS::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + + if ( !pEntity->BlocksLOS() ) + return false; + + return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); +} + +//----------------------------------------------------------------------------- +// Trace filter that can take a classname to ignore +//----------------------------------------------------------------------------- +CTraceFilterSkipClassname::CTraceFilterSkipClassname( const IHandleEntity *passentity, const char *pchClassname, int collisionGroup ) : +CTraceFilterSimple( passentity, collisionGroup ), m_pchClassname( pchClassname ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTraceFilterSkipClassname::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( !pEntity || FClassnameIs( pEntity, m_pchClassname ) ) + return false; + + return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); +} + +//----------------------------------------------------------------------------- +// Trace filter that skips two classnames +//----------------------------------------------------------------------------- +CTraceFilterSkipTwoClassnames::CTraceFilterSkipTwoClassnames( const IHandleEntity *passentity, const char *pchClassname, const char *pchClassname2, int collisionGroup ) : +BaseClass( passentity, pchClassname, collisionGroup ), m_pchClassname2(pchClassname2) +{ +} + +bool CTraceFilterSkipTwoClassnames::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( !pEntity || FClassnameIs( pEntity, m_pchClassname2 ) ) + return false; + + return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); +} + +//----------------------------------------------------------------------------- +// Trace filter that can take a list of entities to ignore +//----------------------------------------------------------------------------- +CTraceFilterSimpleClassnameList::CTraceFilterSimpleClassnameList( const IHandleEntity *passentity, int collisionGroup ) : +CTraceFilterSimple( passentity, collisionGroup ) +{ +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTraceFilterSimpleClassnameList::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( !pEntity ) + return false; + + for ( int i = 0; i < m_PassClassnames.Count(); ++i ) + { + if ( FClassnameIs( pEntity, m_PassClassnames[ i ] ) ) + return false; + } + + return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Add an entity to my list of entities to ignore in the trace +//----------------------------------------------------------------------------- +void CTraceFilterSimpleClassnameList::AddClassnameToIgnore( const char *pchClassname ) +{ + m_PassClassnames.AddToTail( pchClassname ); +} + +CTraceFilterChain::CTraceFilterChain( ITraceFilter *pTraceFilter1, ITraceFilter *pTraceFilter2 ) +{ + m_pTraceFilter1 = pTraceFilter1; + m_pTraceFilter2 = pTraceFilter2; +} + +bool CTraceFilterChain::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) +{ + bool bResult1 = true; + bool bResult2 = true; + + if ( m_pTraceFilter1 ) + bResult1 = m_pTraceFilter1->ShouldHitEntity( pHandleEntity, contentsMask ); + + if ( m_pTraceFilter2 ) + bResult2 = m_pTraceFilter2->ShouldHitEntity( pHandleEntity, contentsMask ); + + return ( bResult1 && bResult2 ); +} + +//----------------------------------------------------------------------------- +// Sweeps against a particular model, using collision rules +//----------------------------------------------------------------------------- +void UTIL_TraceModel( const Vector &vecStart, const Vector &vecEnd, const Vector &hullMin, + const Vector &hullMax, CBaseEntity *pentModel, int collisionGroup, trace_t *ptr ) +{ + // Cull it.... + if ( pentModel && pentModel->ShouldCollide( collisionGroup, MASK_ALL ) ) + { + Ray_t ray; + ray.Init( vecStart, vecEnd, hullMin, hullMax ); + enginetrace->ClipRayToEntity( ray, MASK_ALL, pentModel, ptr ); + } + else + { + memset( ptr, 0, sizeof(trace_t) ); + ptr->fraction = 1.0f; + } +} + +bool UTIL_EntityHasMatchingRootParent( CBaseEntity *pRootParent, CBaseEntity *pEntity ) +{ + if ( pRootParent ) + { + // NOTE: Don't let siblings/parents collide. + if ( pRootParent == pEntity->GetRootMoveParent() ) + return true; + if ( pEntity->GetOwnerEntity() && pRootParent == pEntity->GetOwnerEntity()->GetRootMoveParent() ) + return true; + } + return false; +} + +//----------------------------------------------------------------------------- +// Sweep an entity from the starting to the ending position +//----------------------------------------------------------------------------- +class CTraceFilterEntity : public CTraceFilterSimple +{ + DECLARE_CLASS( CTraceFilterEntity, CTraceFilterSimple ); + +public: + CTraceFilterEntity( CBaseEntity *pEntity, int nCollisionGroup ) + : CTraceFilterSimple( pEntity, nCollisionGroup ) + { + m_pRootParent = pEntity->GetRootMoveParent(); + m_pEntity = pEntity; + m_checkHash = g_EntityCollisionHash->IsObjectInHash(pEntity); + } + + bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) + { + CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( !pEntity ) + return false; + + // Check parents against each other + // NOTE: Don't let siblings/parents collide. + if ( UTIL_EntityHasMatchingRootParent( m_pRootParent, pEntity ) ) + return false; + + if ( m_checkHash ) + { + if ( g_EntityCollisionHash->IsObjectPairInHash( m_pEntity, pEntity ) ) + return false; + } + +#ifndef CLIENT_DLL + if ( m_pEntity->IsNPC() ) + { + if ( NPC_CheckBrushExclude( m_pEntity, pEntity ) ) + return false; + + } +#endif + + return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); + } + +private: + + CBaseEntity *m_pRootParent; + CBaseEntity *m_pEntity; + bool m_checkHash; +}; + +class CTraceFilterEntityIgnoreOther : public CTraceFilterEntity +{ + DECLARE_CLASS( CTraceFilterEntityIgnoreOther, CTraceFilterEntity ); +public: + CTraceFilterEntityIgnoreOther( CBaseEntity *pEntity, const IHandleEntity *pIgnore, int nCollisionGroup ) : + CTraceFilterEntity( pEntity, nCollisionGroup ), m_pIgnoreOther( pIgnore ) + { + } + + bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) + { + if ( pHandleEntity == m_pIgnoreOther ) + return false; + + return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask ); + } + +private: + const IHandleEntity *m_pIgnoreOther; +}; + +//----------------------------------------------------------------------------- +// Sweeps a particular entity through the world +//----------------------------------------------------------------------------- +void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, unsigned int mask, trace_t *ptr ) +{ + ICollideable *pCollision = pEntity->GetCollideable(); + + // Adding this assertion here so game code catches it, but really the assertion belongs in the engine + // because one day, rotated collideables will work! + Assert( pCollision->GetCollisionAngles() == vec3_angle ); + + CTraceFilterEntity traceFilter( pEntity, pCollision->GetCollisionGroup() ); + + + enginetrace->SweepCollideable( pCollision, vecAbsStart, vecAbsEnd, pCollision->GetCollisionAngles(), mask, &traceFilter, ptr ); + +} + +void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, + unsigned int mask, const IHandleEntity *pIgnore, int nCollisionGroup, trace_t *ptr ) +{ + ICollideable *pCollision; + pCollision = pEntity->GetCollideable(); + + // Adding this assertion here so game code catches it, but really the assertion belongs in the engine + // because one day, rotated collideables will work! + Assert( pCollision->GetCollisionAngles() == vec3_angle ); + + CTraceFilterEntityIgnoreOther traceFilter( pEntity, pIgnore, nCollisionGroup ); + + + enginetrace->SweepCollideable( pCollision, vecAbsStart, vecAbsEnd, pCollision->GetCollisionAngles(), mask, &traceFilter, ptr ); + +} + +void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, + unsigned int mask, ITraceFilter *pFilter, trace_t *ptr ) +{ + ICollideable *pCollision; + pCollision = pEntity->GetCollideable(); + + // Adding this assertion here so game code catches it, but really the assertion belongs in the engine + // because one day, rotated collideables will work! + Assert( pCollision->GetCollisionAngles() == vec3_angle ); + + + enginetrace->SweepCollideable( pCollision, vecAbsStart, vecAbsEnd, pCollision->GetCollisionAngles(), mask, pFilter, ptr ); + +} + +// ---- +// This is basically a regular TraceLine that uses the FilterEntity filter. +void UTIL_TraceLineFilterEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, + unsigned int mask, int nCollisionGroup, trace_t *ptr ) +{ + CTraceFilterEntity traceFilter( pEntity, nCollisionGroup ); + UTIL_TraceLine( vecAbsStart, vecAbsEnd, mask, &traceFilter, ptr ); +} + +void UTIL_ClipTraceToPlayers( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, ITraceFilter *filter, trace_t *tr ) +{ + trace_t playerTrace; + Ray_t ray; + float smallestFraction = tr->fraction; + const float maxRange = 60.0f; + + ray.Init( vecAbsStart, vecAbsEnd ); + + for ( int k = 1; k <= gpGlobals->maxClients; ++k ) + { + CBasePlayer *player = UTIL_PlayerByIndex( k ); + + if ( !player || !player->IsAlive() ) + continue; + +#ifdef CLIENT_DLL + if ( player->IsDormant() ) + continue; +#endif // CLIENT_DLL + + if ( filter && filter->ShouldHitEntity( player, mask ) == false ) + continue; + + float range = DistanceToRay( player->WorldSpaceCenter(), vecAbsStart, vecAbsEnd ); + if ( range < 0.0f || range > maxRange ) + continue; + + enginetrace->ClipRayToEntity( ray, mask|CONTENTS_HITBOX, player, &playerTrace ); + if ( playerTrace.fraction < smallestFraction ) + { + // we shortened the ray - save off the trace + *tr = playerTrace; + smallestFraction = playerTrace.fraction; + } + } +} + +//----------------------------------------------------------------------------- +// Purpose: Make a tracer using a particle effect +//----------------------------------------------------------------------------- +void UTIL_ParticleTracer( const char *pszTracerEffectName, const Vector &vecStart, const Vector &vecEnd, + int iEntIndex, int iAttachment, bool bWhiz ) +{ + int iParticleIndex = GetParticleSystemIndex( pszTracerEffectName ); + UTIL_Tracer( vecStart, vecEnd, iEntIndex, iAttachment, 0, bWhiz, "ParticleTracer", iParticleIndex ); +} + +//----------------------------------------------------------------------------- +// Purpose: Make a tracer effect using the old, non-particle system, tracer effects. +//----------------------------------------------------------------------------- +void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex, + int iAttachment, float flVelocity, bool bWhiz, const char *pCustomTracerName, int iParticleID ) +{ + CEffectData data; + data.m_vStart = vecStart; + data.m_vOrigin = vecEnd; +#ifdef CLIENT_DLL + data.m_hEntity = ClientEntityList().EntIndexToHandle( iEntIndex ); +#else + data.m_nEntIndex = iEntIndex; +#endif + data.m_flScale = flVelocity; + data.m_nHitBox = iParticleID; + + // Flags + if ( bWhiz ) + { + data.m_fFlags |= TRACER_FLAG_WHIZ; + } + + if ( iAttachment != TRACER_DONT_USE_ATTACHMENT ) + { + data.m_fFlags |= TRACER_FLAG_USEATTACHMENT; + // Stomp the start, since it's not going to be used anyway + data.m_nAttachmentIndex = iAttachment; + } + + // Fire it off + if ( pCustomTracerName ) + { + DispatchEffect( pCustomTracerName, data ); + } + else + { + DispatchEffect( "Tracer", data ); + } +} + + +void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) +{ + if ( !UTIL_ShouldShowBlood( color ) ) + return; + + if ( color == DONT_BLEED || amount == 0 ) + return; + + if ( g_Language.GetInt() == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED ) + color = 0; + + if ( g_pGameRules->IsMultiplayer() ) + { + // scale up blood effect in multiplayer for better visibility + amount *= 5; + } + + if ( amount > 255 ) + amount = 255; + + if (color == BLOOD_COLOR_MECH) + { + g_pEffects->Sparks(origin); + if (random->RandomFloat(0, 2) >= 1) + { + UTIL_Smoke(origin, random->RandomInt(10, 15), 10); + } + } + else + { + // Normal blood impact + UTIL_BloodImpact( origin, direction, color, amount ); + } +} + +//----------------------------------------------------------------------------- +// Purpose: Returns low violence settings +//----------------------------------------------------------------------------- +static ConVar violence_hblood( "violence_hblood","1", 0, "Draw human blood" ); +static ConVar violence_hgibs( "violence_hgibs","1", 0, "Show human gib entities" ); +static ConVar violence_ablood( "violence_ablood","1", 0, "Draw alien blood" ); +static ConVar violence_agibs( "violence_agibs","1", 0, "Show alien gib entities" ); + +bool UTIL_IsLowViolence( void ) +{ + // These convars are no longer necessary -- the engine is the final arbiter of + // violence settings -- but they're here for legacy support and for testing low + // violence when the engine is in normal violence mode. + if ( !violence_hblood.GetBool() || !violence_ablood.GetBool() || !violence_hgibs.GetBool() || !violence_agibs.GetBool() ) + return true; + + return engine->IsLowViolence(); +} + +bool UTIL_ShouldShowBlood( int color ) +{ + if ( color != DONT_BLEED ) + { + if ( color == BLOOD_COLOR_RED ) + { + return violence_hblood.GetBool(); + } + else + { + return violence_ablood.GetBool(); + } + } + return false; +} + + +//------------------------------------------------------------------------------ +// Purpose : Use trace to pass a specific decal type to the entity being decaled +// Input : +// Output : +//------------------------------------------------------------------------------ +void UTIL_DecalTrace( trace_t *pTrace, char const *decalName ) +{ + if (pTrace->fraction == 1.0) + return; + + CBaseEntity *pEntity = pTrace->m_pEnt; + if ( !pEntity ) + return; + pEntity->DecalTrace( pTrace, decalName ); +} + + +void UTIL_BloodDecalTrace( trace_t *pTrace, int bloodColor ) +{ + if ( UTIL_ShouldShowBlood( bloodColor ) ) + { + if ( bloodColor == BLOOD_COLOR_RED ) + { + UTIL_DecalTrace( pTrace, "Blood" ); + } +#if defined( HL2_EPISODIC ) + else if ( bloodColor == BLOOD_COLOR_BLOB ) + { + UTIL_DecalTrace( pTrace, "BlobBlood" ); + } + //don't draw a any decals if the blob is frozen + else if ( bloodColor == BLOOD_COLOR_BLOB_FROZEN ) + { + return; + } +#endif + else if (bloodColor == BLOOD_COLOR_BRIGHTGREEN) + { + UTIL_DecalTrace( pTrace, "GreenBlood" ); + } + else + { + UTIL_DecalTrace( pTrace, "YellowBlood" ); + } + } +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : &pos - +// &dir - +// color - +// amount - +//----------------------------------------------------------------------------- +void UTIL_BloodImpact( const Vector &pos, const Vector &dir, int color, int amount ) +{ + CEffectData data; + + data.m_vOrigin = pos; + data.m_vNormal = dir; + data.m_flScale = (float)amount; + data.m_nColor = (unsigned char)color; + + DispatchEffect( "bloodimpact", data ); +} + +bool UTIL_IsSpaceEmpty( CBaseEntity *pMainEnt, const Vector &vMin, const Vector &vMax ) +{ + Vector vHalfDims = ( vMax - vMin ) * 0.5f; + Vector vCenter = vMin + vHalfDims; + + trace_t trace; + int mask = (pMainEnt) ? pMainEnt->PhysicsSolidMaskForEntity() : MASK_SOLID; + UTIL_TraceHull( vCenter, vCenter, -vHalfDims, vHalfDims, mask, pMainEnt, COLLISION_GROUP_NONE, &trace ); + + bool bClear = ( trace.fraction == 1 && trace.allsolid != 1 && (trace.startsolid != 1) ); + return bClear; +} + +bool UTIL_IsSpaceEmpty( CBaseEntity *pMainEnt, const Vector &vMin, const Vector &vMax, unsigned int mask, ITraceFilter *pFilter ) +{ + Vector vHalfDims = ( vMax - vMin ) * 0.5f; + Vector vCenter = vMin + vHalfDims; + + trace_t trace; + UTIL_TraceHull( vCenter, vCenter, -vHalfDims, vHalfDims, mask, pFilter, &trace ); + + bool bClear = ( trace.fraction == 1 && trace.allsolid != 1 && (trace.startsolid != 1) ); + return bClear; +} + +void UTIL_StringToFloatArray( float *pVector, int count, const char *pString ) +{ + char *pstr, *pfront, tempString[128]; + int j; + + Q_strncpy( tempString, pString, sizeof(tempString) ); + pstr = pfront = tempString; + + for ( j = 0; j < count; j++ ) // lifted from pr_edict.c + { + pVector[j] = atof( pfront ); + + // skip any leading whitespace + while ( *pstr && *pstr <= ' ' ) + pstr++; + + // skip to next whitespace + while ( *pstr && *pstr > ' ' ) + pstr++; + + if (!*pstr) + break; + + pstr++; + pfront = pstr; + } + for ( j++; j < count; j++ ) + { + pVector[j] = 0; + } +} + +void UTIL_StringToVector( float *pVector, const char *pString ) +{ + UTIL_StringToFloatArray( pVector, 3, pString ); +} + +#ifndef _XBOX +void UTIL_DecodeICE( unsigned char * buffer, int size, const unsigned char *key ) +{ + if ( !key ) + return; + + IceKey ice( 0 ); // level 0 = 64bit key + ice.set( key ); // set key + + int blockSize = ice.blockSize(); + + unsigned char *temp = (unsigned char *) stackalloc( PAD_NUMBER( size, blockSize ) ); + unsigned char *p1 = buffer; + unsigned char *p2 = temp; + + // encrypt data in 8 byte blocks + int bytesLeft = size; + while ( bytesLeft >= blockSize ) + { + ice.decrypt( p1, p2 ); + bytesLeft -= blockSize; + p1+=blockSize; + p2+=blockSize; + } + + // copy encrypted data back to original buffer + Q_memcpy( buffer, temp, size-bytesLeft ); +} + +void UTIL_EncodeICE( unsigned char * buffer, unsigned int size, const unsigned char *key ) +{ + if ( !key ) + return; + + IceKey ice( 0 ); // level 0 = 64bit key + ice.set( key ); // set key + + unsigned char *cipherText = buffer; + unsigned char *plainText = buffer; + uint bytesEncrypted = 0; + + while (bytesEncrypted < size) + { + ice.encrypt( plainText, cipherText ); + bytesEncrypted += 8; + cipherText += 8; + plainText += 8; + } +} +#endif + +// work-around since client header doesn't like inlined gpGlobals->curtime +float IntervalTimer::Now( void ) const +{ + return gpGlobals->curtime; +} + +// work-around since client header doesn't like inlined gpGlobals->curtime +float CountdownTimer::Now( void ) const +{ + return gpGlobals->curtime; +} + + +BEGIN_DATADESC_NO_BASE( IntervalTimer ) +END_DATADESC() + +BEGIN_NETWORK_TABLE_NOBASE( IntervalTimer, DT_IntervalTimer ) +#ifdef CLIENT_DLL + RecvPropFloat(RECVINFO(m_timestamp)), +#else + SendPropFloat (SENDINFO(m_timestamp), 0, SPROP_NOSCALE ), +#endif +END_NETWORK_TABLE() + +#ifdef CLIENT_DLL +BEGIN_PREDICTION_DATA_NO_BASE( IntervalTimer ) + DEFINE_PRED_FIELD( m_timestamp, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ), +END_PREDICTION_DATA() +#endif + + +#ifdef CLIENT_DLL +BEGIN_RECV_TABLE_NOBASE( CountdownTimer, DT_CountdownTimer ) + RecvPropFloat(RECVINFO(m_duration)), + RecvPropFloat(RECVINFO(m_timestamp)), +END_RECV_TABLE() +BEGIN_PREDICTION_DATA_NO_BASE( CountdownTimer ) + DEFINE_PRED_FIELD( m_duration, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ), + DEFINE_PRED_FIELD( m_timestamp, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ), +END_PREDICTION_DATA() +#else +BEGIN_SEND_TABLE_NOBASE( CountdownTimer, DT_CountdownTimer ) + SendPropFloat (SENDINFO(m_duration), 0, SPROP_NOSCALE ), + SendPropFloat (SENDINFO(m_timestamp), 0, SPROP_NOSCALE ), +END_SEND_TABLE() +#endif + + +BEGIN_DATADESC( CTimeline ) + DEFINE_ARRAY( m_flValues, FIELD_FLOAT, TIMELINE_ARRAY_SIZE ), + DEFINE_ARRAY( m_nValueCounts, FIELD_FLOAT, TIMELINE_ARRAY_SIZE ), + DEFINE_FIELD( m_nBucketCount, FIELD_INTEGER ), + DEFINE_FIELD( m_flInterval, FIELD_FLOAT ), + DEFINE_FIELD( m_flFinalValue, FIELD_FLOAT ), + DEFINE_FIELD( m_nCompressionType, FIELD_INTEGER ), + DEFINE_FIELD( m_bStopped, FIELD_BOOLEAN ), +END_DATADESC() + +BEGIN_NETWORK_TABLE_NOBASE( CTimeline, DT_Timeline ) +#ifdef CLIENT_DLL + RecvPropArray3( RECVINFO_ARRAY( m_flValues ), RecvPropFloat( RECVINFO( m_flValues[0] ) ) ), + RecvPropArray3( RECVINFO_ARRAY( m_nValueCounts ), RecvPropFloat( RECVINFO( m_nValueCounts[0] ) ) ), + RecvPropInt( RECVINFO( m_nBucketCount ) ), + RecvPropFloat( RECVINFO( m_flInterval ) ), + RecvPropFloat( RECVINFO( m_flFinalValue ) ), + RecvPropInt( RECVINFO( m_nCompressionType ) ), + RecvPropBool( RECVINFO( m_bStopped ) ), +#else + SendPropArray3( SENDINFO_ARRAY3( m_flValues ), SendPropFloat( SENDINFO_ARRAY( m_flValues ), 0, SPROP_NOSCALE ) ), + SendPropArray3( SENDINFO_ARRAY3( m_nValueCounts ), SendPropFloat( SENDINFO_ARRAY( m_nValueCounts ), 0, SPROP_NOSCALE ) ), + SendPropInt( SENDINFO( m_nBucketCount ), NumBitsForCount( TIMELINE_ARRAY_SIZE ), SPROP_UNSIGNED ), + SendPropFloat( SENDINFO( m_flInterval ), 0, SPROP_NOSCALE ), + SendPropFloat( SENDINFO( m_flFinalValue ), 0, SPROP_NOSCALE ), + SendPropInt( SENDINFO( m_nCompressionType ), -1, SPROP_UNSIGNED ), + SendPropBool( SENDINFO( m_bStopped ) ), +#endif +END_NETWORK_TABLE() + +void CTimeline::ClearValues( void ) +{ + Invalidate(); + + memset( m_flValues.m_Value, 0, sizeof( m_flValues.m_Value ) ); + memset( m_nValueCounts.m_Value, 0, sizeof( m_nValueCounts.m_Value ) ); + m_nBucketCount = 0; + m_flInterval = TIMELINE_INTERVAL_START; + m_flFinalValue = 0.0f; + m_bStopped = false; +} + +void CTimeline::RecordValue( float flValue ) +{ + if ( !HasStarted() || m_bStopped ) + return; + + int iBucket = GetCurrentBucket(); + + Assert( iBucket >= 0 ); + + while ( iBucket >= TIMELINE_ARRAY_SIZE ) + { + Compress(); + iBucket = GetCurrentBucket(); + } + + if ( iBucket >= m_nBucketCount ) + { + m_nBucketCount = iBucket + 1; + } + + m_flValues.GetForModify( iBucket ) += flValue; + m_nValueCounts.GetForModify( iBucket )++; + + if ( m_nCompressionType == TIMELINE_COMPRESSION_SUM || + m_nCompressionType == TIMELINE_COMPRESSION_AVERAGE || + m_nCompressionType == TIMELINE_COMPRESSION_AVERAGE_BLEND ) + { + // Fill in blank preceding entries + float flCurrentValue = m_flValues[ iBucket ] / m_nValueCounts[ iBucket ]; + + int iPrecedingBucket = iBucket - 1; + + while ( iPrecedingBucket >= 0 && m_nValueCounts[ iPrecedingBucket ] <= 0 ) + { + iPrecedingBucket--; + } + + // Get the last logged value (or the current if this is the first) + float flPrecedingValue = flCurrentValue; + + if ( iPrecedingBucket >= 0 ) + { + // Last logged value + if ( m_nCompressionType == TIMELINE_COMPRESSION_SUM ) + { + flPrecedingValue = m_flValues[ iPrecedingBucket ]; + + if ( m_nValueCounts[ iBucket ] == 1 ) + { + // Sum in the previous bucket if this is the first value in this bucket + m_flValues.GetForModify( iBucket ) += flPrecedingValue; + } + } + else + { + flPrecedingValue = m_flFinalValue; + } + } + + // Number of buckets for blending from old to new value + float flNumBuckets = ( iBucket - iPrecedingBucket ) + 1; + + if ( flNumBuckets >= 3.0f ) + { + if ( m_nCompressionType == TIMELINE_COMPRESSION_AVERAGE_BLEND ) + { + // Blend empty values between preceding and current + float flInterpBucket = 1.0f; + + for ( int i = iPrecedingBucket + 1; i < iBucket; ++i, flInterpBucket += 1.0f ) + { + float flInterp = flInterpBucket / flNumBuckets; + m_flValues.Set( i, flPrecedingValue * ( 1.0f - flInterp ) + flCurrentValue * flInterp ); + m_nValueCounts.Set( i, 1 ); + } + } + else + { + // Set empty values to preceding value + for ( int i = iPrecedingBucket + 1; i < iBucket; ++i ) + { + m_flValues.Set( i, flPrecedingValue ); + m_nValueCounts.Set( i, 1 ); + } + } + } + } + + m_flFinalValue = flValue; +} + +float CTimeline::GetValue( int i ) const +{ + Assert( i >= 0 && i < m_nBucketCount ); + + if ( i < 0 || i >= m_nBucketCount ) + { + return 0.0f; + } + + if ( m_nValueCounts[ i ] <= 0 ) + { + return 0.0f; + } + else if ( i == 0 && m_nCompressionType == TIMELINE_COMPRESSION_SUM && m_nBucketCount > 1 ) + { + // Aways start at 0 for sums! + return 0.0; + } + else + { + switch ( m_nCompressionType ) + { + case TIMELINE_COMPRESSION_AVERAGE: + case TIMELINE_COMPRESSION_AVERAGE_BLEND: + return m_flValues[ i ] / m_nValueCounts[ i ]; + + case TIMELINE_COMPRESSION_SUM: + case TIMELINE_COMPRESSION_COUNT_PER_INTERVAL: + default: + return m_flValues[ i ]; + } + } +} + +float CTimeline::GetValueAtInterp( float fInterp ) const +{ + if ( fInterp <= 0.0f ) + { + return GetValue( 0 ); + } + + if ( fInterp >= 1.0f ) + { + if ( m_nCompressionType == TIMELINE_COMPRESSION_SUM || + m_nCompressionType == TIMELINE_COMPRESSION_COUNT_PER_INTERVAL ) + { + return GetValue( Count() - 1 ); + } + else + { + return m_flFinalValue; + } + } + + float fBucket = fInterp * ( Count() - 1 ); + int nBucket = fBucket; + fBucket -= nBucket; + + float fValue = GetValue( nBucket ); + float fNextValue = GetValue( nBucket + 1 ); + + return fValue * ( 1.0f - fBucket ) + fNextValue * fBucket; +} + +void CTimeline::Compress( void ) +{ + int i, j; + + switch ( m_nCompressionType ) + { + case TIMELINE_COMPRESSION_SUM: + for ( i = 0, j = 0; i < TIMELINE_ARRAY_SIZE; i += 2, ++j ) + { + m_flValues.GetForModify( j ) = MAX( m_flValues[ i ], m_flValues[ i + 1 ] ); + m_nValueCounts.GetForModify( j ) = m_nValueCounts[ i ] + m_nValueCounts[ i + 1 ]; + } + break; + + default: + for ( i = 0, j = 0; i < TIMELINE_ARRAY_SIZE; i += 2, ++j ) + { + m_flValues.GetForModify( j ) = m_flValues[ i ] + m_flValues[ i + 1 ]; + m_nValueCounts.GetForModify( j ) = m_nValueCounts[ i ] + m_nValueCounts[ i + 1 ]; + } + break; + } + + int nRemainingBytes = ( TIMELINE_ARRAY_SIZE - j ) * sizeof( m_flValues[0] ); + + memset( &( m_flValues.GetForModify( j ) ), 0, nRemainingBytes ); + memset( &( m_nValueCounts.GetForModify( j ) ), 0, nRemainingBytes ); + + m_flInterval *= 2.0f; + + m_nBucketCount = j; +} + + +#ifdef CLIENT_DLL + CBasePlayer *UTIL_PlayerByIndex( int entindex ) + { + // Sanity check the index being passed in + if ( entindex < 1 || entindex > gpGlobals->maxClients ) + return NULL; + + return ToBasePlayer( ClientEntityList().GetEnt( entindex ) ); + } +#endif + +unsigned short UTIL_GetAchievementEventMask( void ) +{ + CRC32_t mapCRC; + CRC32_Init( &mapCRC ); + + char lowercase[ 256 ]; +#ifdef CLIENT_DLL + Q_FileBase( engine->GetLevelName(), lowercase, sizeof( lowercase ) ); +#else + Q_strncpy( lowercase, STRING( gpGlobals->mapname ), sizeof( lowercase ) ); +#endif + Q_strlower( lowercase ); + + CRC32_ProcessBuffer( &mapCRC, lowercase, Q_strlen( lowercase ) ); + CRC32_Final( &mapCRC ); + + return ( mapCRC & 0xFFFF ); +} + +char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename ) +{ + const char *pValue = pSub->GetString( pName, NULL ); + if ( !pValue ) + { + if ( pFilename ) + { + DevWarning( "Can't get key value '%s' from file '%s'.\n", pName, pFilename ); + } + return ""; + } + + int len = Q_strlen( pValue ) + 1; + char *pAlloced = new char[ len ]; + Assert( pAlloced ); + Q_strncpy( pAlloced, pValue, len ); + return pAlloced; +} + +int UTIL_StringFieldToInt( const char *szValue, const char **pValueStrings, int iNumStrings ) +{ + if ( !szValue || !szValue[0] ) + return -1; + + for ( int i = 0; i < iNumStrings; i++ ) + { + if ( FStrEq(szValue, pValueStrings[i]) ) + return i; + } + + Assert(0); + return -1; +} + +static char s_NumBitsInNibble[ 16 ] = +{ + 0, // 0000 = 0 + 1, // 0001 = 1 + 1, // 0010 = 2 + 2, // 0011 = 3 + 1, // 0100 = 4 + 2, // 0101 = 5 + 2, // 0110 = 6 + 3, // 0111 = 7 + 1, // 1000 = 8 + 2, // 1001 = 9 + 2, // 1010 = 10 + 3, // 1011 = 11 + 2, // 1100 = 12 + 3, // 1101 = 13 + 3, // 1110 = 14 + 4, // 1111 = 15 +}; + +int UTIL_CountNumBitsSet( unsigned int nVar ) +{ + int nNumBits = 0; + + while ( nVar > 0 ) + { + // Look up and add in bits in the bottom nibble + nNumBits += s_NumBitsInNibble[ nVar & 0x0f ]; + + // Shift one nibble to the right + nVar >>= 4; + } + + return nNumBits; +} + +int UTIL_CountNumBitsSet( uint64 nVar ) +{ + int nNumBits = 0; + + while ( nVar > 0 ) + { + // Look up and add in bits in the bottom nibble + nNumBits += s_NumBitsInNibble[ nVar & 0x0f ]; + + // Shift one nibble to the right + nVar >>= 4; + } + + return nNumBits; +} + +bool UTIL_FindClosestPassableSpace( const Vector &vOriginalCenter, const Vector &vExtents, const Vector &vIndecisivePush, ITraceFilter *pTraceFilter, unsigned int fMask, unsigned int iIterations, Vector &vCenterOut, int nAxisRestrictionFlags ) +{ + Assert( vExtents != vec3_origin ); + + trace_t traces[2]; + Ray_t entRay; + entRay.m_Extents = vExtents; + entRay.m_IsRay = false; + entRay.m_IsSwept = true; + entRay.m_StartOffset = vec3_origin; + + Vector vOriginalExtents = vExtents; + Vector vCenter = vOriginalCenter; + Vector vGrowSize = vExtents * (1.0f / (float)(iIterations + 1)); + Vector vCurrentExtents = vExtents - vGrowSize; + + int iLargestExtent = 0; + { + float fLargestExtent = vOriginalExtents[0]; + for( int i = 1; i != 3; ++i ) + { + if( vOriginalExtents[i] > fLargestExtent ) + { + iLargestExtent = i; + fLargestExtent = vOriginalExtents[i]; + } + } + } + + + Ray_t testRay; + testRay.m_Extents = vGrowSize; + testRay.m_IsRay = false; + testRay.m_IsSwept = true; + testRay.m_StartOffset = vec3_origin; + + float fOriginalExtentDists[8]; //distance between extents + //generate distance lookup. We reference this by XOR'ing the indices of two extents to find the axis of difference + { + //Since the ratios of lengths never change, we're going to normalize these distances to a value so we can simply scale on each iteration + //We've picked the largest extent as the basis simply because it's nonzero + float fNormalizer = 1.0f / vOriginalExtents[iLargestExtent]; + + float fXDiff = vOriginalExtents.x * 2.0f * fNormalizer; + float fXSqr = fXDiff * fXDiff; + + float fYDiff = vOriginalExtents.y * 2.0f * fNormalizer; + float fYSqr = fYDiff * fYDiff; + + float fZDiff = vOriginalExtents.z * 2.0f * fNormalizer; + float fZSqr = fZDiff * fZDiff; + + fOriginalExtentDists[0] = 0.0f; //should never get hit + fOriginalExtentDists[1] = fXDiff; //line along x axis + fOriginalExtentDists[2] = fYDiff; //line along y axis + fOriginalExtentDists[3] = sqrt( fXSqr + fYSqr ); //diagonal perpendicular to z-axis + fOriginalExtentDists[4] = fZDiff; //line along z axis + fOriginalExtentDists[5] = sqrt( fXSqr + fZSqr ); //diagonal perpendicular to y-axis + fOriginalExtentDists[6] = sqrt( fYSqr + fZSqr ); //diagonal perpendicular to x-axis + fOriginalExtentDists[7] = sqrt( fXSqr + fYSqr + fZSqr ); //diagonal on all axes + } + + Vector ptExtents[8]; //ordering is going to be like 3 bits, where 0 is a min on the related axis, and 1 is a max on the same axis, axis order x y z + float fExtentsValidation[8]; //some points are more valid than others, and this is our measure + + vCenter.z += 0.001f; //to satisfy m_IsSwept on first pass + + unsigned int iFailCount; + for( iFailCount = 0; iFailCount != iIterations; ++iFailCount ) + { + //float fXDistribution[2] = { -vCurrentExtents.x, vCurrentExtents.x }; + //float fYDistribution[3] = { -vCurrentExtents.y, 0.0f, vCurrentExtents.y }; + //float fZDistribution[5] = { -vCurrentExtents.z, 0.0f, 0.0f, 0.0f, vCurrentExtents.z }; + + //hey look, they can overlap + float fExtentDistribution[6]; + fExtentDistribution[ 0 ] = vCenter.z + ( ( ( nAxisRestrictionFlags & FL_AXIS_DIRECTION_NZ ) == 0 ) ? ( -vCurrentExtents.z ) : ( 0.0f ) ); // Z- + fExtentDistribution[ 1 ] = vCenter.x + ( ( ( nAxisRestrictionFlags & FL_AXIS_DIRECTION_NX ) == 0 ) ? ( -vCurrentExtents.x ) : ( 0.0f ) ); // X- + fExtentDistribution[ 2 ] = vCenter.x + ( ( ( nAxisRestrictionFlags & FL_AXIS_DIRECTION_X ) == 0 ) ? ( vCurrentExtents.x ) : ( 0.0f ) ); // X+ + fExtentDistribution[ 3 ] = vCenter.y + ( ( ( nAxisRestrictionFlags & FL_AXIS_DIRECTION_NY ) == 0 ) ? ( -vCurrentExtents.y ) : ( 0.0f ) ); // Y- + fExtentDistribution[ 4 ] = vCenter.z + ( ( ( nAxisRestrictionFlags & FL_AXIS_DIRECTION_Z ) == 0 ) ? ( vCurrentExtents.z ) : ( 0.0f ) ); // Z+ + fExtentDistribution[ 5 ] = vCenter.y + ( ( ( nAxisRestrictionFlags & FL_AXIS_DIRECTION_Y ) == 0 ) ? ( vCurrentExtents.y ) : ( 0.0f ) ); // Y+ + + float *pXDistribution = &fExtentDistribution[1]; + float *pYDistribution = &fExtentDistribution[3]; + + bool bExtentInvalid[8]; + float fExtentDists[8]; + bool bAnyInvalid = false; + for( int i = 0; i != 8; ++i ) + { + ptExtents[i].x = pXDistribution[i & (1<<0)]; //fExtentDistribution[(0 or 1) + 1] + ptExtents[i].y = pYDistribution[i & (1<<1)]; //fExtentDistribution[(0 or 2) + 3] + ptExtents[i].z = fExtentDistribution[i & (1<<2)]; //fExtentDistribution[(0 or 4)] + + fExtentsValidation[i] = 0.0f; + bExtentInvalid[i] = enginetrace->PointOutsideWorld( ptExtents[i] ); + bAnyInvalid |= bExtentInvalid[i]; + fExtentDists[i] = fOriginalExtentDists[i] * vExtents[iLargestExtent]; + } + + //trace from all extents to all other extents and rate the validity + { + unsigned int counters[2]; //I know it's weird, get over it + for( counters[0] = 0; counters[0] != 7; ++counters[0] ) + { + for( counters[1] = counters[0] + 1; counters[1] != 8; ++counters[1] ) + { + for( int i = 0; i != 2; ++i ) + { + if( bExtentInvalid[counters[i]] ) + { + traces[i].startsolid = true; + traces[i].fraction = 0.0f; + } + else + { + testRay.m_Start = ptExtents[counters[i]]; + testRay.m_Delta = ptExtents[counters[1-i]] - ptExtents[counters[i]]; + enginetrace->TraceRay( testRay, fMask, pTraceFilter, &traces[i] ); + } + } + + float fDistance = fExtentDists[counters[0] ^ counters[1]]; + + for( int i = 0; i != 2; ++i ) + { + if( (traces[i].fraction == 1.0f) && (traces[1-i].fraction != 1.0f) ) + { + //One sided collision >_< + traces[i].startsolid = true; + traces[i].fraction = 0.0f; + break; + } + } + + for( int i = 0; i != 2; ++i ) + { + if( traces[i].startsolid ) + { + bExtentInvalid[counters[i]] = true; + bAnyInvalid = true; + } + else + { + fExtentsValidation[counters[i]] += traces[i].fraction * fDistance; + } + } + } + } + } + + //optimally we should do this check before tracing extents. But one sided collision is a bitch + if( !bAnyInvalid ) + { + //try to trace back to the starting position (if we start in valid, the endpoint will be closer to the original center) + entRay.m_Start = vCenter; + entRay.m_Delta = vOriginalCenter - vCenter; + + enginetrace->TraceRay( entRay, fMask, pTraceFilter, &traces[0] ); + if( traces[0].startsolid == false ) + { + //damned one sided collision + vCenterOut = traces[0].endpos; + return true; //current placement worked + } + } + + //find the direction to move based on the extent validity + { + Vector vNewOriginDirection( 0.0f, 0.0f, 0.0f ); + float fTotalValidation = 0.0f; + for( int i = 0; i != 8; ++i ) + { + if( !bExtentInvalid[i] ) + { + vNewOriginDirection += (ptExtents[i] - vCenter) * fExtentsValidation[i]; + fTotalValidation += fExtentsValidation[i]; + } + } + + if( fTotalValidation != 0.0f ) + { + vCenter += (vNewOriginDirection / fTotalValidation); + + //increase sizing + testRay.m_Extents += vGrowSize; //increase the ray size + vCurrentExtents -= vGrowSize; //while reducing the overall test region size (so outermost ray extents are the same) + } + else + { + //no point was valid, apply the indecisive vector + vCenter += vIndecisivePush; + + //reset sizing + testRay.m_Extents = vGrowSize; + vCurrentExtents = vOriginalExtents - vGrowSize; + } + } + } + + //Warning( "FindClosestPassableSpace() failure.\n" ); + + // X360TBD: Hits in portal devtest + //AssertMsg( IsX360() || iFailCount != iIterations, "FindClosestPassableSpace() failure." ); + vCenterOut = vOriginalCenter; + return false; +} + +bool UTIL_FindClosestPassableSpace( CBaseEntity *pEntity, const Vector &vIndecisivePush, unsigned int fMask, unsigned int iIterations, Vector &vOriginOut, Vector *pStartingPosition, int nAxisRestrictionFlags ) //assumes the object is already in a mostly passable space +{ + // Don't ever do this to entities with a move parent + if ( pEntity->GetMoveParent() ) + { + vOriginOut = pEntity->GetAbsOrigin(); + return false; + } + + Vector vEntityMaxs; + Vector vEntityMins; + pEntity->CollisionProp()->WorldSpaceAABB( &vEntityMins, &vEntityMaxs ); + + Vector ptEntityCenter = ((vEntityMins + vEntityMaxs) / 2.0f); + //vEntityMins -= ptEntityCenter; + vEntityMaxs -= ptEntityCenter; + + Vector vCenterToOrigin = pEntity->GetAbsOrigin() - ptEntityCenter; + if( pStartingPosition != NULL ) + { + Vector vOriginOffset = (*pStartingPosition) - pEntity->GetAbsOrigin(); + ptEntityCenter += vOriginOffset; + } + + CTraceFilterSimple traceFilter( pEntity, pEntity->GetCollisionGroup() ); + + Vector vResult; + bool bSuccess = UTIL_FindClosestPassableSpace( ptEntityCenter, vEntityMaxs, vIndecisivePush, &traceFilter, fMask, iIterations, vResult, nAxisRestrictionFlags ); + vOriginOut = vResult + vCenterToOrigin; + return bSuccess; +} + + +bool UTIL_FindClosestPassableSpace( CBaseEntity *pEntity, const Vector &vIndecisivePush, unsigned int fMask, Vector *pStartingPosition, int nAxisRestrictionFlags ) +{ + Vector vNewPos; + bool bWorked = UTIL_FindClosestPassableSpace( pEntity, vIndecisivePush, fMask, 100, vNewPos, pStartingPosition, nAxisRestrictionFlags ); + if( bWorked ) + { +#ifdef CLIENT_DLL + pEntity->SetAbsOrigin( vNewPos ); +#else + pEntity->Teleport( &vNewPos, NULL, NULL ); +#endif + } + return bWorked; +} + +//----------------------------------------------------------------------------- +// Purpose: Retrieves the MOD directory for the active game (ie. "hl2") +//----------------------------------------------------------------------------- + +bool UTIL_GetModDir( char *lpszTextOut, unsigned int nSize ) +{ + // Must pass in a buffer at least large enough to hold the desired string + const char *pGameDir = CommandLine()->ParmValue( "-game", "hl2" ); + Assert( strlen(pGameDir) <= nSize ); + if ( strlen(pGameDir) > nSize ) + return false; + + Q_strncpy( lpszTextOut, pGameDir, nSize ); + if ( Q_strnchr( lpszTextOut, '/', nSize ) || Q_strnchr( lpszTextOut, '\\', nSize ) ) + { + // Strip the last directory off (which will be our game dir) + Q_StripLastDir( lpszTextOut, nSize ); + + // Find the difference in string lengths and take that difference from the original string as the mod dir + int dirlen = Q_strlen( lpszTextOut ); + Q_strncpy( lpszTextOut, pGameDir + dirlen, Q_strlen( pGameDir ) - dirlen + 1 ); + } + + return true; +} + +//#define FRUSTUM_DEBUGGING //for dumping some clipping information in UTIL_CalcFrustumThroughConvexPolygon + +int UTIL_CalcFrustumThroughConvexPolygon( const Vector *pPolyVertices, int iPolyVertCount, const Vector &vFrustumOrigin, const VPlane *pInputFrustumPlanes, int iInputFrustumPlanes, VPlane *pOutputFrustumPlanes, int iMaxOutputPlanes, int iPreserveCount ) +{ + Assert( iPreserveCount <= iMaxOutputPlanes ); + Assert( iPreserveCount <= iInputFrustumPlanes ); + if( iPolyVertCount < 3 ) + return 0; + +#if defined( FRUSTUM_DEBUGGING ) + //put case-specific debug logic here and it will propogate + const bool bDebugThisCall = (iInputFrustumPlanes > 0); + const float fDisplayTime = 0.0f; +#endif + + int iMaxComplexity = iMaxOutputPlanes - iPreserveCount; + + Vector *pClippedVerts; + int iClippedVertCount; + if( iInputFrustumPlanes > 0 ) + { + //clip the polygon by the input frustum + int iAllocSize = iPolyVertCount + iInputFrustumPlanes; + + Vector *pWorkVerts[2]; + pWorkVerts[0] = (Vector *)stackalloc( sizeof( Vector ) * iAllocSize * 2 ); //possible to add 1 point per cut, iPolyVertCount starting points, iInputFrustumPlaneCount cuts + pWorkVerts[1] = pWorkVerts[0] + iAllocSize; + + //clip by first plane and put output into pInVerts + iClippedVertCount = ClipPolyToPlane( (Vector *)pPolyVertices, iPolyVertCount, pWorkVerts[0], pInputFrustumPlanes[0].m_Normal, pInputFrustumPlanes[0].m_Dist, 0.01f ); + + //clip by other planes and flipflop in and out pointers + for( int i = 1; i != iInputFrustumPlanes; ++i ) + { + if( iClippedVertCount < 3 ) + return 0; //nothing left in the frustum + + iClippedVertCount = ClipPolyToPlane( pWorkVerts[(i & 1) ^ 1], iClippedVertCount, pWorkVerts[i & 1], pInputFrustumPlanes[i].m_Normal, pInputFrustumPlanes[i].m_Dist, 0.01f ); + } + + if( iClippedVertCount < 3 ) + return false; //nothing left in the frustum + + pClippedVerts = pWorkVerts[(iInputFrustumPlanes & 1) ^ 1]; + } + else + { + //no input frustum + if( iPolyVertCount > iMaxComplexity ) + { + //we'll need to reduce our output frustum, copy the input polygon + pClippedVerts = (Vector *)stackalloc( sizeof( Vector ) * iPolyVertCount ); + memcpy( pClippedVerts, pPolyVertices, sizeof( Vector ) * iPolyVertCount ); + } + else + { + //we won't need to simplify the polygon to reduce output planes, just point at the input polygon + pClippedVerts = (Vector *)pPolyVertices; + } + iClippedVertCount = iPolyVertCount; + } + +#if defined( FRUSTUM_DEBUGGING ) //for visibility culling debugging + if( bDebugThisCall ) + { + NDebugOverlay::Line( pClippedVerts[iClippedVertCount - 1], pClippedVerts[0], 255, 0, 0, true, fDisplayTime ); + for( int j = 0; j != iClippedVertCount - 1; ++j ) + { + NDebugOverlay::Line( pClippedVerts[j], pClippedVerts[j+1], 255, 0, 0, true, fDisplayTime ); + } + } +#endif + + Assert( iClippedVertCount <= (iPolyVertCount + iInputFrustumPlanes) ); + + if( iClippedVertCount > iMaxComplexity ) + { +#if defined( FRUSTUM_DEBUGGING ) + if( bDebugThisCall ) + { + NDebugOverlay::Line( pClippedVerts[iClippedVertCount - 1], pClippedVerts[0], 0, 255, 0, false, fDisplayTime ); + for( int j = 0; j != iClippedVertCount - 1; ++j ) + { + NDebugOverlay::Line( pClippedVerts[j], pClippedVerts[j+1], 0, 255, 0, true, fDisplayTime ); + } + } +#endif + float *fLineLengthSqr = (float *)stackalloc( sizeof( float ) * iClippedVertCount ); + + for( int i = 0; i != (iClippedVertCount - 1); ++i ) + { + fLineLengthSqr[i] = (pClippedVerts[i + 1] - pClippedVerts[i]).LengthSqr(); + } + fLineLengthSqr[(iClippedVertCount - 1)] = (pClippedVerts[0] - pClippedVerts[(iClippedVertCount - 1)]).LengthSqr(); //wrap around + + +#if defined( FRUSTUM_DEBUGGING ) //for visibility culling debugging + Vector vDebugBoxExtent; + vDebugBoxExtent.Init( 1.0f, 1.0f, 1.0f ); +#endif + while( iClippedVertCount > iMaxComplexity ) //vert count == number of planes we need to bound the polygon + { + //we have too many verts to represent this accurately in the output frustum plane count + //so, we're going to eliminate the smallest sides one at a time and bridge the surrounding sides until we're down to iMaxComplexity + float fMinSide = fLineLengthSqr[0]; + int iMinSideFirstPoint = 0; + int iOldVertCount = iClippedVertCount; + --iClippedVertCount; //we're going to decrement this sometime in this block, it makes math easier to do it now + + for( int i = 1; i != iOldVertCount; ++i ) + { + if( fLineLengthSqr[i] < fMinSide ) + { + fMinSide = fLineLengthSqr[i]; + iMinSideFirstPoint = i; + } + } + + int i1, i2, i3, i4; + i1 = (iMinSideFirstPoint + iClippedVertCount)%(iOldVertCount); //-1 with a wrap + i2 = iMinSideFirstPoint; + i3 = (iMinSideFirstPoint + 1)%(iOldVertCount); + i4 = (iMinSideFirstPoint + 2)%(iOldVertCount); + + Vector *p1, *p2, *p3, *p4; + p1 = &pClippedVerts[i1]; + p2 = &pClippedVerts[i2]; + p3 = &pClippedVerts[i3]; //this is the one we'll actually be dropping in the merge + p4 = &pClippedVerts[i4]; + + + //now we know the two points that we have to merge to one, project and make a merged point from the surrounding lines + //if( fMinSide >= 0.1f ) //only worth doing the math if it's actually going to be accurate and make a difference + { + //http://mathworld.wolfram.com/Line-LineIntersection.html (20) + Vector vA = *p2 - *p1; + Vector vB = *p4 - *p3; + Vector vC = *p3 - *p1; + Vector vCxB = vC.Cross( vB ); + Vector vAxB = vA.Cross( vB ); + float fS = vCxB.Dot(vAxB)/vAxB.LengthSqr(); + + *p2 = *p1 + (vA * fS); + + fLineLengthSqr[i1] = (*p2 - *p1).LengthSqr(); + } + + fLineLengthSqr[i2] = (*p4 - *p2).LengthSqr(); //must do this BEFORE possibly shifting points p4+ left + + if( i3 < i4 ) //not the last point in the array + { + int iElementShift = (iOldVertCount - i4); + + //eliminate p3, we merged p2+p3 and already stored the result in p2 + memmove( p3, p4, sizeof( Vector ) * iElementShift ); + memmove( &fLineLengthSqr[i3], &fLineLengthSqr[i4], sizeof( float ) * iElementShift ); + } + } + +#if defined(FRUSTUM_DEBUGGING) //for visibility culling debugging + if( bDebugThisCall ) + { + NDebugOverlay::Line( pClippedVerts[iClippedVertCount - 1], pClippedVerts[0], 0, 0, 255, false, fDisplayTime ); + for( int j = 0; j != iClippedVertCount - 1; ++j ) + { + NDebugOverlay::Line( pClippedVerts[j], pClippedVerts[j+1], 0, 0, 255, true, fDisplayTime ); + } + } +#endif + } + + //generate planes defined by each line around the convex and the frustum origin + { + int iFlipNormalsXOR = 0; //this algorithm was written assuming polygon vertices would be in a clockwise order from the perspective of vFrustumOrigin, some logic needs to flip if the inverse is true + { + Vector vLine1 = pPolyVertices[1] - pPolyVertices[0]; + Vector vLine2 = pPolyVertices[2] - pPolyVertices[1]; + Vector vFrontFace = vLine2.Cross( vLine1 ); + + iFlipNormalsXOR = (vFrontFace.Dot( vFrustumOrigin - pPolyVertices[0] ) < 0.0f) ? 1 : 0; //this will assist in reversing the normal by flipping the cross product + } + + Vector vTemp[2]; + vTemp[0] = pClippedVerts[iClippedVertCount - 1] - vFrustumOrigin; + for( int i = 0; i != iClippedVertCount; ++i ) + { + int iIndexing = i & 1; //we can carry over the line computation from one iteration to the next, flip which order we look at the temps with + vTemp[iIndexing ^ 1] = pClippedVerts[i] - vFrustumOrigin; + + Vector vNormal = vTemp[iIndexing ^ iFlipNormalsXOR].Cross( vTemp[(iIndexing ^ iFlipNormalsXOR) ^ 1] ); //vLine1.Cross( vLine2 ); + vNormal.NormalizeInPlace(); + + pOutputFrustumPlanes[i].Init( vNormal, vNormal.Dot( vFrustumOrigin ) ); + } + } + + //preserve input planes on request + if( iPreserveCount > 0 ) + { + memcpy( &pOutputFrustumPlanes[iClippedVertCount], &pInputFrustumPlanes[iInputFrustumPlanes - iPreserveCount], sizeof( VPlane ) * iPreserveCount ); + } + + return (iClippedVertCount + iPreserveCount); +} + + + +//----------------------------------------------------------------------------- +// class CFlaggedEntitiesEnum +//----------------------------------------------------------------------------- + +CFlaggedEntitiesEnum::CFlaggedEntitiesEnum( CBaseEntity **pList, int listMax, int flagMask ) +{ + m_pList = pList; + m_listMax = listMax; + m_flagMask = flagMask; + m_count = 0; +} + +bool CFlaggedEntitiesEnum::AddToList( CBaseEntity *pEntity ) +{ + if ( m_count >= m_listMax ) + { + AssertMsgOnce( 0, "reached enumerated list limit. Increase limit, decrease radius, or make it so entity flags will work for you" ); + return false; + } + m_pList[m_count] = pEntity; + m_count++; + return true; +} + +IterationRetval_t CFlaggedEntitiesEnum::EnumElement( IHandleEntity *pHandleEntity ) +{ +#if defined( CLIENT_DLL ) + IClientEntity *pClientEntity = cl_entitylist->GetClientEntityFromHandle( pHandleEntity->GetRefEHandle() ); + C_BaseEntity *pEntity = pClientEntity ? pClientEntity->GetBaseEntity() : NULL; +#else + CBaseEntity *pEntity = gEntList.GetBaseEntity( pHandleEntity->GetRefEHandle() ); +#endif + if ( pEntity ) + { + if ( m_flagMask && !(pEntity->GetFlags() & m_flagMask) ) // Does it meet the criteria? + return ITERATION_CONTINUE; + + if ( !AddToList( pEntity ) ) + return ITERATION_STOP; + } + + return ITERATION_CONTINUE; +} + + +//----------------------------------------------------------------------------- +// class CHurtableEntitiesEnum +//----------------------------------------------------------------------------- + +CHurtableEntitiesEnum::CHurtableEntitiesEnum( CBaseEntity **pList, int listMax ) +{ + m_pList = pList; + m_listMax = listMax; + m_count = 0; +} + +bool CHurtableEntitiesEnum::AddToList( CBaseEntity *pEntity ) +{ + if ( m_count >= m_listMax ) + { + AssertMsgOnce( 0, "reached enumerated list limit. Increase limit, decrease radius, or make it so entity flags will work for you" ); + return false; + } + m_pList[m_count] = pEntity; + m_count++; + return true; +} + +IterationRetval_t CHurtableEntitiesEnum::EnumElement( IHandleEntity *pHandleEntity ) +{ +#if defined( CLIENT_DLL ) + IClientEntity *pClientEntity = cl_entitylist->GetClientEntityFromHandle( pHandleEntity->GetRefEHandle() ); + C_BaseEntity *pEntity = pClientEntity ? pClientEntity->GetBaseEntity() : NULL; +#else + CBaseEntity *pEntity = gEntList.GetBaseEntity( pHandleEntity->GetRefEHandle() ); +#endif + if ( pEntity ) + { + if ( ( pEntity->m_takedamage == DAMAGE_NO || pEntity->GetHealth() <= 0 ) && pEntity->GetMoveType() != MOVETYPE_VPHYSICS ) // Does it meet the criteria? + return ITERATION_CONTINUE; + + if ( !AddToList( pEntity ) ) + return ITERATION_STOP; + } + + return ITERATION_CONTINUE; +} + + + +int UTIL_EntitiesAlongRay( const Ray_t &ray, CFlaggedEntitiesEnum *pEnum ) +{ +#if defined( CLIENT_DLL ) + partition->EnumerateElementsAlongRay( PARTITION_CLIENT_NON_STATIC_EDICTS, ray, false, pEnum ); +#else + partition->EnumerateElementsAlongRay( PARTITION_ENGINE_NON_STATIC_EDICTS, ray, false, pEnum ); +#endif + return pEnum->GetCount(); +} diff --git a/game/shared/util_shared.h b/game/shared/util_shared.h index 8a8781fdb..72a7bea2d 100644 --- a/game/shared/util_shared.h +++ b/game/shared/util_shared.h @@ -1,540 +1,931 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// -// -// Purpose: Shared util code between client and server. -// -//=============================================================================// - -#ifndef UTIL_SHARED_H -#define UTIL_SHARED_H -#ifdef _WIN32 -#pragma once -#endif - -#include "mathlib/vector.h" -#include "cmodel.h" -#include "utlvector.h" -#include "networkvar.h" -#include "engine/IEngineTrace.h" -#include "engine/IStaticPropMgr.h" -#include "shared_classnames.h" - -#ifdef CLIENT_DLL -#include "cdll_client_int.h" -#endif - -#ifdef PORTAL -#include "portal_util_shared.h" -#endif - -//----------------------------------------------------------------------------- -// Forward declarations -//----------------------------------------------------------------------------- -class CGameTrace; -class CBasePlayer; -typedef CGameTrace trace_t; - -extern ConVar developer; // developer mode - - -//----------------------------------------------------------------------------- -// Language IDs. -//----------------------------------------------------------------------------- -#define LANGUAGE_ENGLISH 0 -#define LANGUAGE_GERMAN 1 -#define LANGUAGE_FRENCH 2 -#define LANGUAGE_BRITISH 3 - - -//----------------------------------------------------------------------------- -// Pitch + yaw -//----------------------------------------------------------------------------- -float UTIL_VecToYaw (const Vector &vec); -float UTIL_VecToPitch (const Vector &vec); -float UTIL_VecToYaw (const matrix3x4_t& matrix, const Vector &vec); -float UTIL_VecToPitch (const matrix3x4_t& matrix, const Vector &vec); -Vector UTIL_YawToVector ( float yaw ); - -//----------------------------------------------------------------------------- -// Shared random number generators for shared/predicted code: -// whenever generating random numbers in shared/predicted code, these functions -// have to be used. Each call should specify a unique "sharedname" string that -// seeds the random number generator. In loops make sure the "additionalSeed" -// is increased with the loop counter, otherwise it will always return the -// same random number -//----------------------------------------------------------------------------- -float SharedRandomFloat( const char *sharedname, float flMinVal, float flMaxVal, int additionalSeed = 0 ); -int SharedRandomInt( const char *sharedname, int iMinVal, int iMaxVal, int additionalSeed = 0 ); -Vector SharedRandomVector( const char *sharedname, float minVal, float maxVal, int additionalSeed = 0 ); -QAngle SharedRandomAngle( const char *sharedname, float minVal, float maxVal, int additionalSeed = 0 ); - -//----------------------------------------------------------------------------- -// Standard collision filters... -//----------------------------------------------------------------------------- -bool PassServerEntityFilter( const IHandleEntity *pTouch, const IHandleEntity *pPass ); -bool StandardFilterRules( IHandleEntity *pHandleEntity, int fContentsMask ); - - -//----------------------------------------------------------------------------- -// Converts an IHandleEntity to an CBaseEntity -//----------------------------------------------------------------------------- -inline const CBaseEntity *EntityFromEntityHandle( const IHandleEntity *pConstHandleEntity ) -{ - IHandleEntity *pHandleEntity = const_cast(pConstHandleEntity); - -#ifdef CLIENT_DLL - IClientUnknown *pUnk = (IClientUnknown*)pHandleEntity; - return pUnk->GetBaseEntity(); -#else - if ( staticpropmgr->IsStaticProp( pHandleEntity ) ) - return NULL; - - IServerUnknown *pUnk = (IServerUnknown*)pHandleEntity; - return pUnk->GetBaseEntity(); -#endif -} - -inline CBaseEntity *EntityFromEntityHandle( IHandleEntity *pHandleEntity ) -{ -#ifdef CLIENT_DLL - IClientUnknown *pUnk = (IClientUnknown*)pHandleEntity; - return pUnk->GetBaseEntity(); -#else - if ( staticpropmgr->IsStaticProp( pHandleEntity ) ) - return NULL; - - IServerUnknown *pUnk = (IServerUnknown*)pHandleEntity; - return pUnk->GetBaseEntity(); -#endif -} - - -//----------------------------------------------------------------------------- -// traceline methods -//----------------------------------------------------------------------------- -class CTraceFilterSimple : public CTraceFilter -{ -public: - // It does have a base, but we'll never network anything below here.. - DECLARE_CLASS_NOBASE( CTraceFilterSimple ); - - CTraceFilterSimple( const IHandleEntity *passentity, int collisionGroup ); - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); - virtual void SetPassEntity( const IHandleEntity *pPassEntity ) { m_pPassEnt = pPassEntity; } - virtual void SetCollisionGroup( int iCollisionGroup ) { m_collisionGroup = iCollisionGroup; } - - const IHandleEntity *GetPassEntity( void ){ return m_pPassEnt;} - -private: - const IHandleEntity *m_pPassEnt; - int m_collisionGroup; -}; - -class CTraceFilterSkipTwoEntities : public CTraceFilterSimple -{ -public: - // It does have a base, but we'll never network anything below here.. - DECLARE_CLASS( CTraceFilterSkipTwoEntities, CTraceFilterSimple ); - - CTraceFilterSkipTwoEntities( const IHandleEntity *passentity, const IHandleEntity *passentity2, int collisionGroup ); - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); - virtual void SetPassEntity2( const IHandleEntity *pPassEntity2 ) { m_pPassEnt2 = pPassEntity2; } - -private: - const IHandleEntity *m_pPassEnt2; -}; - -class CTraceFilterSimpleList : public CTraceFilterSimple -{ -public: - CTraceFilterSimpleList( int collisionGroup ); - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); - - void AddEntityToIgnore( IHandleEntity *pEntity ); -protected: - CUtlVector m_PassEntities; -}; - -class CTraceFilterOnlyNPCsAndPlayer : public CTraceFilterSimple -{ -public: - CTraceFilterOnlyNPCsAndPlayer( const IHandleEntity *passentity, int collisionGroup ) - : CTraceFilterSimple( passentity, collisionGroup ) - { - } - - virtual TraceType_t GetTraceType() const - { - return TRACE_ENTITIES_ONLY; - } - - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); -}; - -class CTraceFilterNoNPCsOrPlayer : public CTraceFilterSimple -{ -public: - CTraceFilterNoNPCsOrPlayer( const IHandleEntity *passentity, int collisionGroup ) - : CTraceFilterSimple( passentity, collisionGroup ) - { - } - - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); -}; - -//----------------------------------------------------------------------------- -// Purpose: Custom trace filter used for NPC LOS traces -//----------------------------------------------------------------------------- -class CTraceFilterLOS : public CTraceFilterSkipTwoEntities -{ -public: - CTraceFilterLOS( IHandleEntity *pHandleEntity, int collisionGroup, IHandleEntity *pHandleEntity2 = NULL ); - bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); -}; - -class CTraceFilterSkipClassname : public CTraceFilterSimple -{ -public: - CTraceFilterSkipClassname( const IHandleEntity *passentity, const char *pchClassname, int collisionGroup ); - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); - -private: - - const char *m_pchClassname; -}; - -class CTraceFilterSkipTwoClassnames : public CTraceFilterSkipClassname -{ -public: - // It does have a base, but we'll never network anything below here.. - DECLARE_CLASS( CTraceFilterSkipTwoClassnames, CTraceFilterSkipClassname ); - - CTraceFilterSkipTwoClassnames( const IHandleEntity *passentity, const char *pchClassname, const char *pchClassname2, int collisionGroup ); - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); - -private: - const char *m_pchClassname2; -}; - -class CTraceFilterSimpleClassnameList : public CTraceFilterSimple -{ -public: - CTraceFilterSimpleClassnameList( const IHandleEntity *passentity, int collisionGroup ); - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); - - void AddClassnameToIgnore( const char *pchClassname ); -private: - CUtlVector m_PassClassnames; -}; - -class CTraceFilterChain : public CTraceFilter -{ -public: - CTraceFilterChain( ITraceFilter *pTraceFilter1, ITraceFilter *pTraceFilter2 ); - virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); - -private: - ITraceFilter *m_pTraceFilter1; - ITraceFilter *m_pTraceFilter2; -}; - -// helper -void DebugDrawLine( const Vector& vecAbsStart, const Vector& vecAbsEnd, int r, int g, int b, bool test, float duration ); - -extern ConVar r_visualizetraces; - -inline void UTIL_TraceLine( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, - const IHandleEntity *ignore, int collisionGroup, trace_t *ptr ) -{ - Ray_t ray; - ray.Init( vecAbsStart, vecAbsEnd ); - CTraceFilterSimple traceFilter( ignore, collisionGroup ); - - enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); - - if( r_visualizetraces.GetBool() ) - { - DebugDrawLine( ptr->startpos, ptr->endpos, 255, 0, 0, true, -1.0f ); - } -} - -inline void UTIL_TraceLine( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, - ITraceFilter *pFilter, trace_t *ptr ) -{ - Ray_t ray; - ray.Init( vecAbsStart, vecAbsEnd ); - - enginetrace->TraceRay( ray, mask, pFilter, ptr ); - - if( r_visualizetraces.GetBool() ) - { - DebugDrawLine( ptr->startpos, ptr->endpos, 255, 0, 0, true, -1.0f ); - } -} - -inline void UTIL_TraceHull( const Vector &vecAbsStart, const Vector &vecAbsEnd, const Vector &hullMin, - const Vector &hullMax, unsigned int mask, const IHandleEntity *ignore, - int collisionGroup, trace_t *ptr ) -{ - Ray_t ray; - ray.Init( vecAbsStart, vecAbsEnd, hullMin, hullMax ); - CTraceFilterSimple traceFilter( ignore, collisionGroup ); - - enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); - - if( r_visualizetraces.GetBool() ) - { - DebugDrawLine( ptr->startpos, ptr->endpos, 255, 255, 0, true, -1.0f ); - } -} - -inline void UTIL_TraceHull( const Vector &vecAbsStart, const Vector &vecAbsEnd, const Vector &hullMin, - const Vector &hullMax, unsigned int mask, ITraceFilter *pFilter, trace_t *ptr ) -{ - Ray_t ray; - ray.Init( vecAbsStart, vecAbsEnd, hullMin, hullMax ); - - enginetrace->TraceRay( ray, mask, pFilter, ptr ); - - if( r_visualizetraces.GetBool() ) - { - DebugDrawLine( ptr->startpos, ptr->endpos, 255, 255, 0, true, -1.0f ); - } -} - -inline void UTIL_TraceRay( const Ray_t &ray, unsigned int mask, - const IHandleEntity *ignore, int collisionGroup, trace_t *ptr ) -{ - CTraceFilterSimple traceFilter( ignore, collisionGroup ); - - enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); - - if( r_visualizetraces.GetBool() ) - { - DebugDrawLine( ptr->startpos, ptr->endpos, 255, 0, 0, true, -1.0f ); - } -} - -// Sweeps a particular entity through the world -void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, unsigned int mask, trace_t *ptr ); -void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, - unsigned int mask, ITraceFilter *pFilter, trace_t *ptr ); -void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, - unsigned int mask, const IHandleEntity *ignore, int collisionGroup, trace_t *ptr ); - -bool UTIL_EntityHasMatchingRootParent( CBaseEntity *pRootParent, CBaseEntity *pEntity ); - -inline int UTIL_PointContents( const Vector &vec ) -{ - return enginetrace->GetPointContents( vec ); -} - -// Sweeps against a particular model, using collision rules -void UTIL_TraceModel( const Vector &vecStart, const Vector &vecEnd, const Vector &hullMin, - const Vector &hullMax, CBaseEntity *pentModel, int collisionGroup, trace_t *ptr ); - -void UTIL_ClipTraceToPlayers( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, ITraceFilter *filter, trace_t *tr ); - -// Particle effect tracer -void UTIL_ParticleTracer( const char *pszTracerEffectName, const Vector &vecStart, const Vector &vecEnd, int iEntIndex = 0, int iAttachment = 0, bool bWhiz = false ); - -// Old style, non-particle system, tracers -void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex = 0, int iAttachment = TRACER_DONT_USE_ATTACHMENT, float flVelocity = 0, bool bWhiz = false, const char *pCustomTracerName = NULL, int iParticleID = 0 ); - -bool UTIL_IsLowViolence( void ); -bool UTIL_ShouldShowBlood( int bloodColor ); -void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ); - -void UTIL_BloodImpact( const Vector &pos, const Vector &dir, int color, int amount ); -void UTIL_BloodDecalTrace( trace_t *pTrace, int bloodColor ); -void UTIL_DecalTrace( trace_t *pTrace, char const *decalName ); -bool UTIL_IsSpaceEmpty( CBaseEntity *pMainEnt, const Vector &vMin, const Vector &vMax ); - -void UTIL_StringToVector( float *pVector, const char *pString ); -void UTIL_StringToIntArray( int *pVector, int count, const char *pString ); -void UTIL_StringToFloatArray( float *pVector, int count, const char *pString ); -void UTIL_StringToColor32( color32 *color, const char *pString ); - -CBasePlayer *UTIL_PlayerByIndex( int entindex ); - -// decodes a buffer using a 64bit ICE key (inplace) -void UTIL_DecodeICE( unsigned char * buffer, int size, const unsigned char *key); - -unsigned short UTIL_GetAchievementEventMask( void ); - - -//-------------------------------------------------------------------------------------------------------------- -/** - * Given a position and a ray, return the shortest distance between the two. - * If 'pos' is beyond either end of the ray, the returned distance is negated. - */ -inline float DistanceToRay( const Vector &pos, const Vector &rayStart, const Vector &rayEnd, float *along = NULL, Vector *pointOnRay = NULL ) -{ - Vector to = pos - rayStart; - Vector dir = rayEnd - rayStart; - float length = dir.NormalizeInPlace(); - - float rangeAlong = DotProduct( dir, to ); - if (along) - { - *along = rangeAlong; - } - - float range; - - if (rangeAlong < 0.0f) - { - // off start point - range = -(pos - rayStart).Length(); - - if (pointOnRay) - { - *pointOnRay = rayStart; - } - } - else if (rangeAlong > length) - { - // off end point - range = -(pos - rayEnd).Length(); - - if (pointOnRay) - { - *pointOnRay = rayEnd; - } - } - else // within ray bounds - { - Vector onRay = rayStart + rangeAlong * dir; - range = (pos - onRay).Length(); - - if (pointOnRay) - { - *pointOnRay = onRay; - } - } - - return range; -} - - -//-------------------------------------------------------------------------------------------------------------- -/** - * Simple class for tracking intervals of game time. - * Upon creation, the timer is invalidated. To measure time intervals, start the timer via Start(). - */ -class IntervalTimer -{ -public: - IntervalTimer( void ) - { - m_timestamp = -1.0f; - } - - void Reset( void ) - { - m_timestamp = Now(); - } - - void Start( void ) - { - m_timestamp = Now(); - } - - void Invalidate( void ) - { - m_timestamp = -1.0f; - } - - bool HasStarted( void ) const - { - return (m_timestamp > 0.0f); - } - - /// if not started, elapsed time is very large - float GetElapsedTime( void ) const - { - return (HasStarted()) ? (Now() - m_timestamp) : 99999.9f; - } - - bool IsLessThen( float duration ) const - { - return (Now() - m_timestamp < duration) ? true : false; - } - - bool IsGreaterThen( float duration ) const - { - return (Now() - m_timestamp > duration) ? true : false; - } - -private: - float m_timestamp; - float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime -}; - - -//-------------------------------------------------------------------------------------------------------------- -/** - * Simple class for counting down a short interval of time. - * Upon creation, the timer is invalidated. Invalidated countdown timers are considered to have elapsed. - */ -class CountdownTimer -{ -public: - CountdownTimer( void ) - { - m_timestamp = -1.0f; - m_duration = 0.0f; - } - - void Reset( void ) - { - m_timestamp = Now() + m_duration; - } - - void Start( float duration ) - { - m_timestamp = Now() + duration; - m_duration = duration; - } - - void Invalidate( void ) - { - m_timestamp = -1.0f; - } - - bool HasStarted( void ) const - { - return (m_timestamp > 0.0f); - } - - bool IsElapsed( void ) const - { - return (Now() > m_timestamp); - } - - float GetElapsedTime( void ) const - { - return Now() - m_timestamp + m_duration; - } - - float GetRemainingTime( void ) const - { - return (m_timestamp - Now()); - } - - /// return original countdown time - float GetCountdownDuration( void ) const - { - return (m_timestamp > 0.0f) ? m_duration : 0.0f; - } - -private: - float m_duration; - float m_timestamp; - float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime -}; - -const char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename = NULL ); - -int UTIL_StringFieldToInt( const char *szValue, const char **pValueStrings, int iNumStrings ); - -#endif // UTIL_SHARED_H +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +// +// Purpose: Shared util code between client and server. +// +//=============================================================================// + +#ifndef UTIL_SHARED_H +#define UTIL_SHARED_H +#ifdef _WIN32 +#pragma once +#endif + +#include "mathlib/vector.h" +#include "cmodel.h" +#include "utlvector.h" +#include "networkvar.h" +#include "engine/IEngineTrace.h" +#include "engine/IStaticPropMgr.h" +#include "shared_classnames.h" + +#ifdef CLIENT_DLL +#include "cdll_client_int.h" +#endif + +#ifdef PORTAL +#include "portal_util_shared.h" +#endif + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class CGameTrace; +class CBasePlayer; +typedef CGameTrace trace_t; + + + + +//----------------------------------------------------------------------------- +// Language IDs. +//----------------------------------------------------------------------------- +#define LANGUAGE_ENGLISH 0 +#define LANGUAGE_GERMAN 1 +#define LANGUAGE_FRENCH 2 +#define LANGUAGE_BRITISH 3 + + +//----------------------------------------------------------------------------- +// Pitch + yaw +//----------------------------------------------------------------------------- +float UTIL_VecToYaw (const Vector &vec); +float UTIL_VecToPitch (const Vector &vec); +float UTIL_VecToYaw (const matrix3x4_t& matrix, const Vector &vec); +float UTIL_VecToPitch (const matrix3x4_t& matrix, const Vector &vec); +Vector UTIL_YawToVector ( float yaw ); + +//----------------------------------------------------------------------------- +// Shared random number generators for shared/predicted code: +// whenever generating random numbers in shared/predicted code, these functions +// have to be used. Each call should specify a unique "sharedname" string that +// seeds the random number generator. In loops make sure the "additionalSeed" +// is increased with the loop counter, otherwise it will always return the +// same random number +//----------------------------------------------------------------------------- +float SharedRandomFloat( const char *sharedname, float flMinVal, float flMaxVal, int additionalSeed = 0 ); +int SharedRandomInt( const char *sharedname, int iMinVal, int iMaxVal, int additionalSeed = 0 ); +Vector SharedRandomVector( const char *sharedname, float minVal, float maxVal, int additionalSeed = 0 ); +QAngle SharedRandomAngle( const char *sharedname, float minVal, float maxVal, int additionalSeed = 0 ); + +//----------------------------------------------------------------------------- +// Standard collision filters... +//----------------------------------------------------------------------------- +bool PassServerEntityFilter( const IHandleEntity *pTouch, const IHandleEntity *pPass ); +bool StandardFilterRules( IHandleEntity *pHandleEntity, int fContentsMask ); + + +//----------------------------------------------------------------------------- +// Converts an IHandleEntity to an CBaseEntity +//----------------------------------------------------------------------------- +inline const CBaseEntity *EntityFromEntityHandle( const IHandleEntity *pConstHandleEntity ) +{ + IHandleEntity *pHandleEntity = const_cast(pConstHandleEntity); + +#ifdef CLIENT_DLL + IClientUnknown *pUnk = (IClientUnknown*)pHandleEntity; + return pUnk->GetBaseEntity(); +#else + if ( staticpropmgr->IsStaticProp( pHandleEntity ) ) + return NULL; + + IServerUnknown *pUnk = (IServerUnknown*)pHandleEntity; + return pUnk->GetBaseEntity(); +#endif +} + +inline CBaseEntity *EntityFromEntityHandle( IHandleEntity *pHandleEntity ) +{ +#ifdef CLIENT_DLL + IClientUnknown *pUnk = (IClientUnknown*)pHandleEntity; + return pUnk->GetBaseEntity(); +#else +#ifndef _X360 + if ( staticpropmgr->IsStaticProp( pHandleEntity ) ) + return NULL; +#else + if ( !pHandleEntity || pHandleEntity->m_bIsStaticProp ) + return NULL; +#endif + + IServerUnknown *pUnk = (IServerUnknown*)pHandleEntity; + Assert( !pUnk || pUnk->GetBaseEntity() ); + return pUnk->GetBaseEntity(); +#endif +} + + +typedef bool (*ShouldHitFunc_t)( IHandleEntity *pHandleEntity, int contentsMask ); + +//----------------------------------------------------------------------------- +// traceline methods +//----------------------------------------------------------------------------- +class CTraceFilterSimple : public CTraceFilter +{ +public: + // It does have a base, but we'll never network anything below here.. + DECLARE_CLASS_NOBASE( CTraceFilterSimple ); + + CTraceFilterSimple( const IHandleEntity *passentity, int collisionGroup, ShouldHitFunc_t pExtraShouldHitCheckFn = NULL ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + virtual void SetPassEntity( const IHandleEntity *pPassEntity ) { m_pPassEnt = pPassEntity; } + virtual void SetCollisionGroup( int iCollisionGroup ) { m_collisionGroup = iCollisionGroup; } + + const IHandleEntity *GetPassEntity( void ){ return m_pPassEnt;} + +private: + const IHandleEntity *m_pPassEnt; + int m_collisionGroup; + ShouldHitFunc_t m_pExtraShouldHitCheckFunction; + +}; + +class CTraceFilterSkipTwoEntities : public CTraceFilterSimple +{ +public: + // It does have a base, but we'll never network anything below here.. + DECLARE_CLASS( CTraceFilterSkipTwoEntities, CTraceFilterSimple ); + + CTraceFilterSkipTwoEntities( const IHandleEntity *passentity = NULL, const IHandleEntity *passentity2 = NULL, int collisionGroup = COLLISION_GROUP_NONE ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + virtual void SetPassEntity2( const IHandleEntity *pPassEntity2 ) { m_pPassEnt2 = pPassEntity2; } + +private: + const IHandleEntity *m_pPassEnt2; +}; + +class CTraceFilterSimpleList : public CTraceFilterSimple +{ +public: + CTraceFilterSimpleList( int collisionGroup ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + + void AddEntityToIgnore( IHandleEntity *pEntity ); + void AddEntitiesToIgnore( int nCount, IHandleEntity **ppEntities ); + +protected: + CUtlVector m_PassEntities; +}; + +class CTraceFilterOnlyHitThis : public CTraceFilter +{ +public: + // It does have a base, but we'll never network anything below here.. + DECLARE_CLASS_NOBASE( CTraceFilterOnlyHitThis ); + + CTraceFilterOnlyHitThis( const IHandleEntity *hitentity ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + +private: + const IHandleEntity *m_pHitEnt; +}; + +class CTraceFilterOnlyNPCsAndPlayer : public CTraceFilterSimple +{ +public: + CTraceFilterOnlyNPCsAndPlayer( const IHandleEntity *passentity, int collisionGroup ) + : CTraceFilterSimple( passentity, collisionGroup ) + { + } + + virtual TraceType_t GetTraceType() const + { + return TRACE_ENTITIES_ONLY; + } + + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); +}; + +class CTraceFilterNoNPCsOrPlayer : public CTraceFilterSimple +{ +public: + CTraceFilterNoNPCsOrPlayer( const IHandleEntity *passentity = NULL, int collisionGroup = COLLISION_GROUP_NONE ) + : CTraceFilterSimple( passentity, collisionGroup ) + { + } + + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); +}; + +//----------------------------------------------------------------------------- +// Purpose: Custom trace filter used for NPC LOS traces +//----------------------------------------------------------------------------- +class CTraceFilterLOS : public CTraceFilterSkipTwoEntities +{ +public: + CTraceFilterLOS( IHandleEntity *pHandleEntity, int collisionGroup, IHandleEntity *pHandleEntity2 = NULL ); + bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); +}; + +class CTraceFilterSkipClassname : public CTraceFilterSimple +{ +public: + CTraceFilterSkipClassname( const IHandleEntity *passentity, const char *pchClassname, int collisionGroup ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + +private: + + const char *m_pchClassname; +}; + +class CTraceFilterSkipTwoClassnames : public CTraceFilterSkipClassname +{ +public: + // It does have a base, but we'll never network anything below here.. + DECLARE_CLASS( CTraceFilterSkipTwoClassnames, CTraceFilterSkipClassname ); + + CTraceFilterSkipTwoClassnames( const IHandleEntity *passentity, const char *pchClassname, const char *pchClassname2, int collisionGroup ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + +private: + const char *m_pchClassname2; +}; + +class CTraceFilterSimpleClassnameList : public CTraceFilterSimple +{ +public: + CTraceFilterSimpleClassnameList( const IHandleEntity *passentity, int collisionGroup ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + + void AddClassnameToIgnore( const char *pchClassname ); +private: + CUtlVector m_PassClassnames; +}; + +class CTraceFilterChain : public CTraceFilter +{ +public: + CTraceFilterChain( ITraceFilter *pTraceFilter1, ITraceFilter *pTraceFilter2 ); + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ); + +private: + ITraceFilter *m_pTraceFilter1; + ITraceFilter *m_pTraceFilter2; +}; + +// helper +void DebugDrawLine( const Vector& vecAbsStart, const Vector& vecAbsEnd, int r, int g, int b, bool test, float duration ); + +extern ConVar *r_visualizetraces; + +#ifdef DETECT_TRACE_SPIKES +#define BeginDetectTraceSpike() \ + extern void DoReportExpensiveTrace( bool repeat, float time ); \ + extern float g_TraceSpikeTolerance; \ + CFastTimer spikeTimer; \ + spikeTimer.Start() + +#define EndDetectTraceSpike() \ + spikeTimer.End() + +#define DidTraceSpike() \ + ( spikeTimer.GetDuration().GetMillisecondsF() > g_TraceSpikeTolerance ) + +#define ReportExpensiveTrace( repeat ) if ( DidTraceSpike() ) DoReportExpensiveTrace( repeat, spikeTimer.GetDuration().GetMillisecondsF() ) + +#else + +#define BeginDetectTraceSpike() ((void)0) +#define EndDetectTraceSpike() ((void)0) +#define DidTraceSpike() false +#define ReportExpensiveTrace( repeat ) ((void)0) +#endif + +inline void UTIL_TraceLine( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, + const IHandleEntity *ignore, int collisionGroup, trace_t *ptr ) +{ + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd ); + CTraceFilterSimple traceFilter( ignore, collisionGroup ); + + enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); + EndDetectTraceSpike(); + + if( r_visualizetraces->GetBool() || DidTraceSpike() ) + { + DebugDrawLine( ptr->startpos, ptr->endpos, 255, 0, 0, true, ( r_visualizetraces->GetBool() ) ? -1.0f : .5 ); + ReportExpensiveTrace( false ); + if ( DidTraceSpike() ) // Opimizer will remove this block + { + ReportExpensiveTrace( false ); + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd ); + CTraceFilterSimple traceFilter( ignore, collisionGroup ); + + enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); + EndDetectTraceSpike(); + if ( DidTraceSpike() ) + { + ReportExpensiveTrace( true ); + } + } + } +} + +inline void UTIL_TraceLine( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, + ITraceFilter *pFilter, trace_t *ptr ) +{ + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd ); + + enginetrace->TraceRay( ray, mask, pFilter, ptr ); + EndDetectTraceSpike(); + + if( r_visualizetraces->GetBool() || DidTraceSpike() ) + { + DebugDrawLine( ptr->startpos, ptr->endpos, 255, 0, 0, true, ( r_visualizetraces->GetBool() ) ? -1.0f : .5 ); + ReportExpensiveTrace( false ); + if ( DidTraceSpike() ) // Opimizer will remove this block + { + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd ); + + enginetrace->TraceRay( ray, mask, pFilter, ptr ); + EndDetectTraceSpike(); + + if ( DidTraceSpike() ) + { + ReportExpensiveTrace( true ); + } + } + } +} + +inline void UTIL_TraceHull( const Vector &vecAbsStart, const Vector &vecAbsEnd, const Vector &hullMin, + const Vector &hullMax, unsigned int mask, const IHandleEntity *ignore, + int collisionGroup, trace_t *ptr ) +{ + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd, hullMin, hullMax ); + CTraceFilterSimple traceFilter( ignore, collisionGroup ); + + enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); + EndDetectTraceSpike(); + + if( r_visualizetraces->GetBool() || DidTraceSpike() ) + { + DebugDrawLine( ptr->startpos, ptr->endpos, 255, 255, 0, true, ( r_visualizetraces->GetBool() ) ? -1.0f : .5 ); + ReportExpensiveTrace( false ); + if ( DidTraceSpike() ) // Opimizer will remove this block + { + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd, hullMin, hullMax ); + CTraceFilterSimple traceFilter( ignore, collisionGroup ); + + enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); + EndDetectTraceSpike(); + + if ( DidTraceSpike() ) + { + ReportExpensiveTrace( true ); + } + } + } +} + +inline void UTIL_TraceHull( const Vector &vecAbsStart, const Vector &vecAbsEnd, const Vector &hullMin, + const Vector &hullMax, unsigned int mask, ITraceFilter *pFilter, trace_t *ptr ) +{ + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd, hullMin, hullMax ); + + enginetrace->TraceRay( ray, mask, pFilter, ptr ); + + EndDetectTraceSpike(); + if( r_visualizetraces->GetBool() || DidTraceSpike() ) + { + DebugDrawLine( ptr->startpos, ptr->endpos, 255, 255, 0, true, ( r_visualizetraces->GetBool() ) ? -1.0f : .5 ); + ReportExpensiveTrace( false ); + if ( DidTraceSpike() ) // Opimizer will remove this block + { + BeginDetectTraceSpike(); + Ray_t ray; + ray.Init( vecAbsStart, vecAbsEnd, hullMin, hullMax ); + + enginetrace->TraceRay( ray, mask, pFilter, ptr ); + + EndDetectTraceSpike(); + if( DidTraceSpike() ) + { + ReportExpensiveTrace( true ); + } + } + } +} + +inline void UTIL_TraceRay( const Ray_t &ray, unsigned int mask, + const IHandleEntity *ignore, int collisionGroup, trace_t *ptr ) +{ + CTraceFilterSimple traceFilter( ignore, collisionGroup ); + + enginetrace->TraceRay( ray, mask, &traceFilter, ptr ); + + if( r_visualizetraces->GetBool() ) + { + DebugDrawLine( ptr->startpos, ptr->endpos, 255, 0, 0, true, -1.0f ); + } +} + +inline void UTIL_TraceRay( const Ray_t &ray, unsigned int mask, + ITraceFilter *pFilter, trace_t *ptr ) +{ + enginetrace->TraceRay( ray, mask, pFilter, ptr ); + + if( r_visualizetraces->GetBool() ) + { + DebugDrawLine( ptr->startpos, ptr->endpos, 255, 0, 0, true, -1.0f ); + } +} +// Sweeps a particular entity through the world +void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, unsigned int mask, trace_t *ptr ); +void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, + unsigned int mask, ITraceFilter *pFilter, trace_t *ptr ); +void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Vector &vecAbsEnd, + unsigned int mask, const IHandleEntity *ignore, int collisionGroup, trace_t *ptr ); + +bool UTIL_EntityHasMatchingRootParent( CBaseEntity *pRootParent, CBaseEntity *pEntity ); + +inline int UTIL_PointContents( const Vector &vec, int contentsMask ) +{ + return enginetrace->GetPointContents( vec, contentsMask ); +} + +// Sweeps against a particular model, using collision rules +void UTIL_TraceModel( const Vector &vecStart, const Vector &vecEnd, const Vector &hullMin, + const Vector &hullMax, CBaseEntity *pentModel, int collisionGroup, trace_t *ptr ); + +void UTIL_ClipTraceToPlayers( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, ITraceFilter *filter, trace_t *tr ); + +// Particle effect tracer +void UTIL_ParticleTracer( const char *pszTracerEffectName, const Vector &vecStart, const Vector &vecEnd, int iEntIndex = 0, int iAttachment = 0, bool bWhiz = false ); + +// Old style, non-particle system, tracers +void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex = 0, int iAttachment = TRACER_DONT_USE_ATTACHMENT, float flVelocity = 0, bool bWhiz = false, const char *pCustomTracerName = NULL, int iParticleID = 0 ); + +bool UTIL_IsLowViolence( void ); +bool UTIL_ShouldShowBlood( int bloodColor ); +void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ); + +void UTIL_BloodImpact( const Vector &pos, const Vector &dir, int color, int amount ); +void UTIL_BloodDecalTrace( trace_t *pTrace, int bloodColor ); +void UTIL_DecalTrace( trace_t *pTrace, char const *decalName ); +bool UTIL_IsSpaceEmpty( CBaseEntity *pMainEnt, const Vector &vMin, const Vector &vMax ); +bool UTIL_IsSpaceEmpty( CBaseEntity *pMainEnt, const Vector &vMin, const Vector &vMax, unsigned int mask, ITraceFilter *pFilter ); + +void UTIL_StringToVector( float *pVector, const char *pString ); +void UTIL_StringToFloatArray( float *pVector, int count, const char *pString ); + +CBasePlayer *UTIL_PlayerByIndex( int entindex ); + +// decodes/encodes a buffer using a 64bit ICE key (inplace) +void UTIL_DecodeICE( unsigned char * buffer, int size, const unsigned char *key ); +void UTIL_EncodeICE( unsigned char * buffer, unsigned int size, const unsigned char *key ); +unsigned short UTIL_GetAchievementEventMask( void ); + +//assumes the object is already in a mostly passable space +#define FL_AXIS_DIRECTION_NONE ( 0 ) +#define FL_AXIS_DIRECTION_X ( 1 << 0 ) +#define FL_AXIS_DIRECTION_NX ( 1 << 1 ) +#define FL_AXIS_DIRECTION_Y ( 1 << 2 ) +#define FL_AXIS_DIRECTION_NY ( 1 << 3 ) +#define FL_AXIS_DIRECTION_Z ( 1 << 4 ) +#define FL_AXIS_DIRECTION_NZ ( 1 << 5 ) + +bool UTIL_FindClosestPassableSpace( const Vector &vCenter, const Vector &vExtents, const Vector &vIndecisivePush, ITraceFilter *pTraceFilter, unsigned int fMask, unsigned int iIterations, Vector &vCenterOut, int nAxisRestrictionFlags = FL_AXIS_DIRECTION_NONE ); +bool UTIL_FindClosestPassableSpace( CBaseEntity *pEntity, const Vector &vIndecisivePush, unsigned int fMask, unsigned int iIterations, Vector &vOriginOut, Vector *pStartingPosition = NULL, int nAxisRestrictionFlags = FL_AXIS_DIRECTION_NONE ); +bool UTIL_FindClosestPassableSpace( CBaseEntity *pEntity, const Vector &vIndecisivePush, unsigned int fMask, Vector *pStartingPosition = NULL, int nAxisRestrictionFlags = FL_AXIS_DIRECTION_NONE ); + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Given a position and a ray, return the shortest distance between the two. + * If 'pos' is beyond either end of the ray, the returned distance is negated. + */ +inline float DistanceToRay( const Vector &pos, const Vector &rayStart, const Vector &rayEnd, float *along = NULL, Vector *pointOnRay = NULL ) +{ + Vector to = pos - rayStart; + Vector dir = rayEnd - rayStart; + float length = dir.NormalizeInPlace(); + + float rangeAlong = DotProduct( dir, to ); + if (along) + { + *along = rangeAlong; + } + + float range; + + if (rangeAlong < 0.0f) + { + // off start point + range = -(pos - rayStart).Length(); + + if (pointOnRay) + { + *pointOnRay = rayStart; + } + } + else if (rangeAlong > length) + { + // off end point + range = -(pos - rayEnd).Length(); + + if (pointOnRay) + { + *pointOnRay = rayEnd; + } + } + else // within ray bounds + { + Vector onRay = rayStart + rangeAlong * dir; + range = (pos - onRay).Length(); + + if (pointOnRay) + { + *pointOnRay = onRay; + } + } + + return range; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** +* Macro for creating an interface that when inherited from automatically maintains a list of instances +* that inherit from that interface. +*/ + +// interface for entities that want to a auto maintained global list +#define DECLARE_AUTO_LIST( interfaceName ) \ + class interfaceName; \ + abstract_class interfaceName \ + { \ + public: \ + interfaceName( bool bAutoAdd = true ); \ + virtual ~interfaceName(); \ + virtual CBaseEntity* GetEntity( void ) = 0; \ + static void Add( interfaceName *pElement ) { m_##interfaceName##AutoList.AddToTail( pElement ); } \ + static void Remove( interfaceName *pElement ) { m_##interfaceName##AutoList.FindAndFastRemove( pElement ); } \ + static const CUtlVector< interfaceName* >& AutoList( void ) { return m_##interfaceName##AutoList; } \ + private: \ + static CUtlVector< interfaceName* > m_##interfaceName##AutoList; \ + }; + +// Creates a simple function for accessing the higher level entity +#define IMPLEMENT_AUTO_LIST_GET() \ + virtual CBaseEntity* GetEntity( void ) { return this; } + +// Creates the auto add/remove constructor/destructor... +// Pass false to the constructor to not auto add +#define IMPLEMENT_AUTO_LIST( interfaceName ) \ + CUtlVector< class interfaceName* > interfaceName::m_##interfaceName##AutoList; \ + interfaceName::interfaceName( bool bAutoAdd ) \ + { \ + if ( bAutoAdd ) \ + { \ + Add( this ); \ + } \ + } \ + interfaceName::~interfaceName() \ + { \ + Remove( this ); \ + } + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Simple class for tracking intervals of game time. + * Upon creation, the timer is invalidated. To measure time intervals, start the timer via Start(). + */ +class IntervalTimer +{ +public: +#ifdef CLIENT_DLL + DECLARE_PREDICTABLE(); +#endif + DECLARE_DATADESC(); + DECLARE_CLASS_NOBASE( IntervalTimer ); + DECLARE_EMBEDDED_NETWORKVAR(); + + IntervalTimer( void ) : m_timestamp( -1.0f ) + { + } + + void Reset( void ) + { + m_timestamp = Now(); + } + + void Start( void ) + { + m_timestamp = Now(); + } + + void StartFromTime( float startTime ) + { + m_timestamp = startTime; + } + + void Invalidate( void ) + { + m_timestamp = -1.0f; + } + + bool HasStarted( void ) const + { + return (m_timestamp > 0.0f); + } + + /// if not started, elapsed time is very large + float GetElapsedTime( void ) const + { + return (HasStarted()) ? (Now() - m_timestamp) : 99999.9f; + } + + bool IsLessThen( float duration ) const + { + return (Now() - m_timestamp < duration) ? true : false; + } + + bool IsGreaterThen( float duration ) const + { + return (Now() - m_timestamp > duration) ? true : false; + } + + float GetStartTime( void ) const + { + return m_timestamp; + } + +protected: + CNetworkVar( float, m_timestamp ); + float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime +}; + +#ifdef CLIENT_DLL +EXTERN_RECV_TABLE(DT_IntervalTimer); +#else +EXTERN_SEND_TABLE(DT_IntervalTimer); +#endif + +//-------------------------------------------------------------------------------------------------------------- +/** + * Simple class for counting down a short interval of time. + * Upon creation, the timer is invalidated. Invalidated countdown timers are considered to have elapsed. + */ +class CountdownTimer +{ +public: +#ifdef CLIENT_DLL + DECLARE_PREDICTABLE(); +#endif + DECLARE_CLASS_NOBASE( CountdownTimer ); + DECLARE_EMBEDDED_NETWORKVAR(); + + CountdownTimer( void ) : + m_duration( 0.0f ), m_timestamp( -1.0f) + { + } + + void Reset( void ) + { + m_timestamp = Now() + m_duration; + } + + void Start( float duration ) + { + m_timestamp = Now() + duration; + m_duration = duration; + } + + void StartFromTime( float startTime, float duration ) + { + m_timestamp = startTime + duration; + m_duration = duration; + } + + void Invalidate( void ) + { + m_timestamp = -1.0f; + } + + bool HasStarted( void ) const + { + return (m_timestamp > 0.0f); + } + + bool IsElapsed( void ) const + { + return (Now() > m_timestamp); + } + + float GetElapsedTime( void ) const + { + return Now() - m_timestamp + m_duration; + } + + float GetRemainingTime( void ) const + { + return (m_timestamp - Now()); + } + + /// return original countdown time + float GetCountdownDuration( void ) const + { + return (m_timestamp > 0.0f) ? m_duration : 0.0f; + } + + /// 1.0 for newly started, 0.0 for elapsed + float GetRemainingRatio( void ) const + { + if ( HasStarted() ) + { + float left = GetRemainingTime() / m_duration; + if ( left < 0.0f ) + return 0.0f; + if ( left > 1.0f ) + return 1.0f; + return left; + } + + return 0.0f; + } + +private: + CNetworkVar( float, m_duration ); + CNetworkVar( float, m_timestamp ); + float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime +}; + +#ifdef CLIENT_DLL +EXTERN_RECV_TABLE(DT_CountdownTimer); +#else +EXTERN_SEND_TABLE(DT_CountdownTimer); +#endif + + +//-------------------------------------------------------------------------------------------------------------- +/** +* Simple class for tracking change in values over time. +*/ +#define TIMELINE_ARRAY_SIZE 64 +#define TIMELINE_INTERVAL_START 0.25f + +enum TimelineCompression_t +{ + TIMELINE_COMPRESSION_SUM, + TIMELINE_COMPRESSION_COUNT_PER_INTERVAL, + TIMELINE_COMPRESSION_AVERAGE, + TIMELINE_COMPRESSION_AVERAGE_BLEND, + + TIMELINE_COMPRESSION_TOTAL +}; + +class CTimeline : public IntervalTimer +{ +public: + DECLARE_DATADESC(); + DECLARE_CLASS( CTimeline, IntervalTimer ); + DECLARE_EMBEDDED_NETWORKVAR(); + + CTimeline( void ) + { + ClearValues(); + } + + void ClearValues( void ); + void ClearAndStart( void ) { ClearValues(); Start(); } + void StopRecording( void ) { m_bStopped = true; } + void RecordValue( float flValue ); + void RecordFinalValue( float flValue ) { RecordValue( flValue ); StopRecording(); } + + int Count( void ) const + { + return m_nBucketCount; + } + + float GetValue( int i ) const; + + float GetValueAtInterp( float fInterp ) const; + + float GetValueTime( int i ) const + { + Assert( i >= 0 && i < m_nBucketCount ); + return static_cast( i ) * m_flInterval; + } + + float GetInterval( void ) const + { + return m_flInterval; + } + + void SetCompressionType( TimelineCompression_t nCompressionType ) + { + m_nCompressionType = nCompressionType; + } + + TimelineCompression_t GetCompressionType( void ) const + { + return m_nCompressionType; + } + +private: + int GetCurrentBucket( void ) + { + return static_cast( Now() - m_timestamp ) / m_flInterval; + } + + void Compress( void ); + + CNetworkArray( float, m_flValues, TIMELINE_ARRAY_SIZE ); + CNetworkArray( int, m_nValueCounts, TIMELINE_ARRAY_SIZE ); + CNetworkVar( int, m_nBucketCount ); + CNetworkVar( float, m_flInterval ); + CNetworkVar( float, m_flFinalValue ); + CNetworkVar( TimelineCompression_t, m_nCompressionType ); + CNetworkVar( bool, m_bStopped ); +}; + +#ifdef CLIENT_DLL +EXTERN_RECV_TABLE(DT_Timeline); +#else +EXTERN_SEND_TABLE(DT_Timeline); +#endif + +char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename = NULL ); + +int UTIL_StringFieldToInt( const char *szValue, const char **pValueStrings, int iNumStrings ); + +int UTIL_CountNumBitsSet( unsigned int nVar ); +int UTIL_CountNumBitsSet( uint64 nVar ); + +bool UTIL_GetModDir( char *lpszTextOut, unsigned int nSize ); + +/*UTIL_CalcFrustumThroughPolygon - Given a frustum and a polygon, calculate how the current frustum would clip the polygon, then generate a new frustum that runs along the edge of the clipped polygon. +-returns number of planes in the output frustum, 0 if the polygon was completely clipped by the input frustum +-vFrustumOrigin can be thought of as the camera origin if your frustum is a view frustum +-planes should face inward +-iPreserveCount will preserve N planes at the end of your input frustum and ensure they're at the end of your output frustum. Assuming your input frustum is of type "Frustum", a value of 2 would preserve your near and far planes +-to ensure that your output frustum can hold the entire complex frustum we generate. Make it of size (iPolyVertCount + iCurrentFrustumPlanes + iPreserveCount). Otherwise the output frustum will be simplified to fit your maximum output by eliminating bounding planes with the clipped area. +-a lack of input frustum is considered valid input*/ +int UTIL_CalcFrustumThroughConvexPolygon( const Vector *pPolyVertices, int iPolyVertCount, const Vector &vFrustumOrigin, const VPlane *pInputFrustumPlanes, int iInputFrustumPlanes, VPlane *pOutputFrustumPlanes, int iMaxOutputPlanes, int iPreserveCount ); + + +//----------------------------------------------------------------------------- +// class CFlaggedEntitiesEnum +//----------------------------------------------------------------------------- +// enumerate entities that match a set of edict flags into a static array +class CFlaggedEntitiesEnum : public IPartitionEnumerator +{ +public: + CFlaggedEntitiesEnum( CBaseEntity **pList, int listMax, int flagMask ); + + // This gets called by the enumeration methods with each element + // that passes the test. + virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity ); + + int GetCount() { return m_count; } + bool AddToList( CBaseEntity *pEntity ); + +private: + CBaseEntity **m_pList; + int m_listMax; + int m_flagMask; + int m_count; +}; + +class CHurtableEntitiesEnum : public IPartitionEnumerator +{ +public: + CHurtableEntitiesEnum( CBaseEntity **pList, int listMax ); + + // This gets called by the enumeration methods with each element + // that passes the test. + virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity ); + + int GetCount() { return m_count; } + bool AddToList( CBaseEntity *pEntity ); + +private: + CBaseEntity **m_pList; + int m_listMax; + int m_count; +}; + +int UTIL_EntitiesAlongRay( const Ray_t &ray, CFlaggedEntitiesEnum *pEnum ); + +inline int UTIL_EntitiesAlongRay( CBaseEntity **pList, int listMax, const Ray_t &ray, int flagMask ) +{ + CFlaggedEntitiesEnum rayEnum( pList, listMax, flagMask ); + return UTIL_EntitiesAlongRay( ray, &rayEnum ); +} + + +#endif // UTIL_SHARED_H diff --git a/lib/linux/mathlib_i486.a b/lib/linux/mathlib_i486.a index 963b347ae..e84278f33 100644 Binary files a/lib/linux/mathlib_i486.a and b/lib/linux/mathlib_i486.a differ diff --git a/lib/linux/tier1_i486.a b/lib/linux/tier1_i486.a index 3e1cce21e..b12705b8e 100644 Binary files a/lib/linux/tier1_i486.a and b/lib/linux/tier1_i486.a differ diff --git a/linux_sdk/Makefile b/linux_sdk/Makefile index 30c14ab6c..206d39c51 100644 --- a/linux_sdk/Makefile +++ b/linux_sdk/Makefile @@ -95,8 +95,9 @@ DEFINES +=-DGNUC -DPOSIX -D_POSIX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstri -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE -BASE_CFLAGS = -fno-strict-aliasing -Wall -Wsign-compare -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \ +BASE_CFLAGS = -fno-strict-aliasing -Wall -Wsign-compare -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \ -Wno-delete-non-virtual-dtor +BASE_CFLAGS += -Wno-class-memaccess -Wno-unknown-pragmas -Wno-narrowing -fpermissive SHLIBCFLAGS = -fPIC # Flags passed to the c compiler diff --git a/public/SoundEmitterSystem/isoundemittersystembase.h b/public/SoundEmitterSystem/isoundemittersystembase.h index 46bd4b2b9..364737643 100644 --- a/public/SoundEmitterSystem/isoundemittersystembase.h +++ b/public/SoundEmitterSystem/isoundemittersystembase.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -16,12 +16,14 @@ #include "soundflags.h" #include "mathlib/compressed_vector.h" #include "appframework/IAppSystem.h" +#include "tier3/tier3.h" #define SOUNDEMITTERSYSTEM_INTERFACE_VERSION "VSoundEmitter002" #define SOUNDGENDER_MACRO "$gender" #define SOUNDGENDER_MACRO_LENGTH 7 // Length of above including $ +class KeyValues; typedef short HSOUNDSCRIPTHANDLE; #define SOUNDEMITTER_INVALID_HANDLE (HSOUNDSCRIPTHANDLE)-1 @@ -103,8 +105,8 @@ struct sound_interval_t T range; interval_t &ToInterval( interval_t &dest ) const { dest.start = start; dest.range = range; return dest; } - void FromInterval( const interval_t &from ) { start = (T)from.start; range = (T)from.range; } - float Random() const { interval_t temp = { start, range }; return RandomInterval( temp ); } + void FromInterval( const interval_t &from ) { start = from.start; range = from.range; } + float Random() const { return RandomFloat( start, start+range ); } }; @@ -146,8 +148,8 @@ struct CSoundParametersInternal void SetChannel( int newChannel ) { channel = newChannel; } void SetVolume( float start, float range = 0.0 ) { volume.start = start; volume.range = range; } - void SetPitch( float start, float range = 0.0 ) { pitch.start = (uint8)start; pitch.range = (uint8)range; } - void SetSoundLevel( float start, float range = 0.0 ) { soundlevel.start = (uint16)start; soundlevel.range = (uint16)range; } + void SetPitch( float start, float range = 0.0 ) { pitch.start = start; pitch.range = range; } + void SetSoundLevel( float start, float range = 0.0 ) { soundlevel.start = start; soundlevel.range = range; } void SetDelayMsec( int delay ) { delay_msec = delay; } void SetShouldPreload( bool bShouldPreload ) { m_bShouldPreload = bShouldPreload; } void SetOnlyPlayToOwner( bool b ) { play_to_owner_only = b; } @@ -189,7 +191,7 @@ struct CSoundParametersInternal byte reserved; // 28 - + KeyValues * m_pGameData; // 32 }; #pragma pack() @@ -260,6 +262,16 @@ abstract_class ISoundEmitterSystemBase : public IAppSystem virtual bool GetParametersForSoundEx( const char *soundname, HSOUNDSCRIPTHANDLE& handle, CSoundParameters& params, gender_t gender, bool isbeingemitted = false ) = 0; virtual soundlevel_t LookupSoundLevelByHandle( char const *soundname, HSOUNDSCRIPTHANDLE& handle ) = 0; + + virtual char const *GetSoundNameForHash( unsigned int hash ) = 0; // Returns NULL if hash not found!!! + virtual unsigned int HashSoundName( char const *pchSndName ) = 0; + virtual bool IsValidHash( unsigned int hash ) = 0; + + virtual void DescribeSound( char const *soundname ) = 0; + // Flush and reload + virtual void Flush() = 0; + + virtual void AddSoundsFromFile( const char *filename, bool bPreload, bool bIsOverride = false ) = 0; }; #endif // ISOUNDEMITTERSYSTEMBASE_H diff --git a/public/SoundParametersInternal.cpp b/public/SoundParametersInternal.cpp index 95f034c18..7b2628da0 100644 --- a/public/SoundParametersInternal.cpp +++ b/public/SoundParametersInternal.cpp @@ -11,8 +11,9 @@ #if !defined(_STATIC_LINKED) || defined(SOUNDEMITTERSYSTEM_DLL) #include "SoundEmitterSystem/isoundemittersystembase.h" -#include "interval.h" +#include "tier2/interval.h" #include "soundchars.h" +#include "KeyValues.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -339,29 +340,42 @@ CSoundParametersInternal::CSoundParametersInternal() had_missing_wave_files = false; uses_gender_token = false; + // TERROR: + m_pGameData = NULL; + } CSoundParametersInternal::CSoundParametersInternal( const CSoundParametersInternal& src ) { m_pSoundNames = NULL; m_pConvertedNames = NULL; + // TERROR: + m_pGameData = NULL; + // TERROR: + m_pGameData = NULL; + CopyFrom( src ); } CSoundParametersInternal::~CSoundParametersInternal() { if ( m_nSoundNames > 1 ) - delete m_pSoundNames; + free(m_pSoundNames ); if ( m_nConvertedNames > 1 ) - delete m_pConvertedNames; + free( m_pConvertedNames); + + m_pConvertedNames = NULL; + m_pSoundNames = NULL; + m_nSoundNames = 0; + m_nConvertedNames = 0; } void CSoundParametersInternal::CopyFrom( const CSoundParametersInternal& src ) { if ( m_nSoundNames > 1 ) - delete m_pSoundNames; + free(m_pSoundNames); if ( m_nConvertedNames > 1 ) - delete m_pConvertedNames; + free(m_pConvertedNames); channel = src.channel; volume = src.volume; @@ -375,7 +389,7 @@ void CSoundParametersInternal::CopyFrom( const CSoundParametersInternal& src ) { if ( m_nSoundNames > 1 ) { - m_pSoundNames = new SoundFile[m_nSoundNames]; + m_pSoundNames = (SoundFile*)malloc( sizeof(SoundFile)*m_nSoundNames); memcpy( m_pSoundNames, src.m_pSoundNames, m_nSoundNames * sizeof(SoundFile) ); } else @@ -393,7 +407,7 @@ void CSoundParametersInternal::CopyFrom( const CSoundParametersInternal& src ) { if ( m_nConvertedNames > 1 ) { - m_pConvertedNames = new SoundFile[m_nConvertedNames]; + m_pConvertedNames = (SoundFile*)malloc( sizeof(SoundFile)*m_nConvertedNames); memcpy( m_pConvertedNames, src.m_pConvertedNames, m_nConvertedNames * sizeof(SoundFile) ); } else diff --git a/public/appframework/IAppSystem.h b/public/appframework/IAppSystem.h index 1552725cd..7e1acea06 100644 --- a/public/appframework/IAppSystem.h +++ b/public/appframework/IAppSystem.h @@ -32,6 +32,15 @@ enum InitReturnVal_t INIT_LAST_VAL, }; +enum AppSystemTier_t +{ + APP_SYSTEM_TIER0 = 0, + APP_SYSTEM_TIER1, + APP_SYSTEM_TIER2, + APP_SYSTEM_TIER3, + + APP_SYSTEM_TIER_OTHER, +}; abstract_class IAppSystem { diff --git a/public/basehandle.h b/public/basehandle.h index 492a20b3a..b625a2714 100644 --- a/public/basehandle.h +++ b/public/basehandle.h @@ -110,6 +110,20 @@ inline bool CBaseHandle::IsValid() const inline int CBaseHandle::GetEntryIndex() const { + // There is a hack here: due to a bug in the original implementation of the + // entity handle system, an attempt to look up an invalid entity index in + // certain cirumstances might fall through to the the mask operation below. + // This would mask an invalid index to be in fact a lookup of entity number + // NUM_ENT_ENTRIES, so invalid ent indexes end up actually looking up the + // last slot in the entities array. Since this slot is always empty, the + // lookup returns NULL and the expected behavior occurs through this unexpected + // route. + // A lot of code actually depends on this behavior, and the bug was only exposed + // after a change to NUM_SERIAL_NUM_BITS increased the number of allowable + // static props in the world. So the if-stanza below detects this case and + // retains the prior (bug-submarining) behavior. + if ( !IsValid() ) + return NUM_ENT_ENTRIES-1; return m_Index & ENT_ENTRY_MASK; } diff --git a/public/bittools.h b/public/bittools.h new file mode 100644 index 000000000..8efd19984 --- /dev/null +++ b/public/bittools.h @@ -0,0 +1,46 @@ +//===== Copyright © 1996-2009, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef BITTOOLS_H +#define BITTOOLS_H +#ifdef _WIN32 +#pragma once +#endif + +namespace bittools +{ + template + struct RecurseBit + { + enum {result = RecurseBit::result}; + }; + + template + struct RecurseBit<0, C> + { + enum {result = C}; + }; + + template + struct RecursePow2 + { + enum {result = RecursePow2::result}; + }; + + template + struct RecursePow2<0, C> + { + enum {result = C}; + }; + +} + +#define ROUND_TO_POWER_OF_2( n ) ( bittools::RecursePow2< (n) - 1 >::result ) +#define MINIMUM_BITS_NEEDED( n ) ( bittools::RecurseBit< (n) - 1 >::result ) + +#endif //BITTOOLS_H + diff --git a/public/bitvec.h b/public/bitvec.h index c14a41056..51ac08161 100644 --- a/public/bitvec.h +++ b/public/bitvec.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -46,7 +46,7 @@ inline int FirstBitInWord( unsigned int elem, int offset ) #if _WIN32 if ( !elem ) return -1; -#if _X360 +#if defined( _X360 ) // this implements CountTrailingZeros() / BitScanForward() unsigned int mask = elem-1; unsigned int comp = ~elem; @@ -276,7 +276,7 @@ class CBitVecT : public BASE_OPS // class CVarBitVecBase // // Defines the operations necessary for a variable sized bit array - +template class CVarBitVecBase { public: @@ -296,18 +296,18 @@ class CVarBitVecBase protected: CVarBitVecBase(); CVarBitVecBase(int numBits); - CVarBitVecBase( const CVarBitVecBase &from ); - CVarBitVecBase &operator=( const CVarBitVecBase &from ); + CVarBitVecBase( const CVarBitVecBase &from ); + CVarBitVecBase &operator=( const CVarBitVecBase &from ); ~CVarBitVecBase(void); - void ValidateOperand( const CVarBitVecBase &operand ) const { Assert(GetNumBits() == operand.GetNumBits()); } + void ValidateOperand( const CVarBitVecBase &operand ) const { Assert(GetNumBits() == operand.GetNumBits()); } unsigned GetEndMask() const { return ::GetEndMask( GetNumBits() ); } private: - unsigned short m_numBits; // Number of bits in the bitstring - unsigned short m_numInts; // Number of ints to needed to store bitstring + BITCOUNTTYPE m_numBits; // Number of bits in the bitstring + BITCOUNTTYPE m_numInts; // Number of ints to needed to store bitstring uint32 m_iBitStringStorage; // If the bit string fits in one int, it goes here uint32 * m_pInt; // Array of ints containing the bitstring @@ -396,7 +396,7 @@ class CFixedBitVecBase // // inheritance instead of typedef to allow forward declarations -class CVarBitVec : public CBitVecT +class CVarBitVec : public CBitVecT< CVarBitVecBase > { public: CVarBitVec() @@ -404,7 +404,20 @@ class CVarBitVec : public CBitVecT } CVarBitVec(int numBits) - : CBitVecT(numBits) + : CBitVecT< CVarBitVecBase >(numBits) + { + } +}; + +class CLargeVarBitVec : public CBitVecT< CVarBitVecBase > +{ +public: + CLargeVarBitVec() + { + } + + CLargeVarBitVec(int numBits) + : CBitVecT< CVarBitVecBase >(numBits) { } }; @@ -432,14 +445,16 @@ typedef CBitVec<32> CDWordBitVec; //----------------------------------------------------------------------------- -inline CVarBitVecBase::CVarBitVecBase() +template +inline CVarBitVecBase::CVarBitVecBase() { memset( this, 0, sizeof( *this ) ); } //----------------------------------------------------------------------------- -inline CVarBitVecBase::CVarBitVecBase(int numBits) +template +inline CVarBitVecBase::CVarBitVecBase(int numBits) { Assert( numBits ); m_numBits = numBits; @@ -452,7 +467,8 @@ inline CVarBitVecBase::CVarBitVecBase(int numBits) //----------------------------------------------------------------------------- -inline CVarBitVecBase::CVarBitVecBase( const CVarBitVecBase &from ) +template +inline CVarBitVecBase::CVarBitVecBase( const CVarBitVecBase &from ) { if ( from.m_numInts ) { @@ -468,7 +484,8 @@ inline CVarBitVecBase::CVarBitVecBase( const CVarBitVecBase &from ) //----------------------------------------------------------------------------- -inline CVarBitVecBase &CVarBitVecBase::operator=( const CVarBitVecBase &from ) +template +inline CVarBitVecBase &CVarBitVecBase::operator=( const CVarBitVecBase &from ) { Resize( from.GetNumBits() ); if ( m_pInt ) @@ -482,14 +499,16 @@ inline CVarBitVecBase &CVarBitVecBase::operator=( const CVarBitVecBase &from ) // Output : //----------------------------------------------------------------------------- -inline CVarBitVecBase::~CVarBitVecBase(void) +template +inline CVarBitVecBase::~CVarBitVecBase(void) { FreeInts(); } //----------------------------------------------------------------------------- -inline void CVarBitVecBase::Attach( uint32 *pBits, int numBits ) +template +inline void CVarBitVecBase::Attach( uint32 *pBits, int numBits ) { FreeInts(); m_numBits = numBits; @@ -508,7 +527,8 @@ inline void CVarBitVecBase::Attach( uint32 *pBits, int numBits ) //----------------------------------------------------------------------------- -inline bool CVarBitVecBase::Detach( uint32 **ppBits, int *pNumBits ) +template +inline bool CVarBitVecBase::Detach( uint32 **ppBits, int *pNumBits ) { if ( !m_numBits ) { @@ -574,8 +594,8 @@ inline CBitVecAccessor CBitVecT::operator[](int i) template inline void CBitVecT::Init( int val ) { - if ( CBitVecT::Base() ) - memset( CBitVecT::Base(), ( val ) ? 0xff : 0, CBitVecT::GetNumDWords() * sizeof(int) ); + if ( this->Base() ) + memset( this->Base(), ( val ) ? 0xff : 0, this->GetNumDWords() * sizeof(int) ); } //----------------------------------------------------------------------------- @@ -636,7 +656,7 @@ inline void CBitVecT::Clear(int bitNum) template inline void CBitVecT::Set( int bitNum, bool bNewVal ) { - uint32 *pInt = CBitVecT::Base() + BitVec_Int( bitNum ); + uint32 *pInt = this->Base() + BitVec_Int( bitNum ); uint32 bitMask = BitVec_Bit( bitNum ); if ( bNewVal ) { @@ -653,7 +673,7 @@ inline void CBitVecT::Set( int bitNum, bool bNewVal ) template inline void CBitVecT::Set( uint32 offset, uint32 mask ) { - uint32 *pInt = CBitVecT::Base() + offset; + uint32 *pInt = this->Base() + offset; *pInt |= mask; } @@ -662,7 +682,7 @@ inline void CBitVecT::Set( uint32 offset, uint32 mask ) template inline void CBitVecT::Clear( uint32 offset, uint32 mask ) { - uint32 *pInt = CBitVecT::Base() + offset; + uint32 *pInt = this->Base() + offset; *pInt &= ~mask; } @@ -671,7 +691,7 @@ inline void CBitVecT::Clear( uint32 offset, uint32 mask ) template inline uint32 CBitVecT::Get( uint32 offset, uint32 mask ) { - uint32 *pInt = CBitVecT::Base() + offset; + uint32 *pInt = this->Base() + offset; return ( *pInt & mask ); } @@ -683,14 +703,14 @@ inline uint32 CBitVecT::Get( uint32 offset, uint32 mask ) template inline void CBitVecT::And(const CBitVecT &addStr, CBitVecT *out) const { - ValidateOperand( addStr ); - ValidateOperand( *out ); + this->ValidateOperand( addStr ); + this->ValidateOperand( *out ); uint32 * pDest = out->Base(); - const uint32 *pOperand1 = CBitVecT::Base(); + const uint32 *pOperand1 = this->Base(); const uint32 *pOperand2 = addStr.Base(); - for (int i = CBitVecT::GetNumDWords() - 1; i >= 0 ; --i) + for (int i = this->GetNumDWords() - 1; i >= 0 ; --i) { pDest[i] = pOperand1[i] & pOperand2[i]; } @@ -704,14 +724,14 @@ inline void CBitVecT::And(const CBitVecT &addStr, CBitVecT *out) const template inline void CBitVecT::Or(const CBitVecT &orStr, CBitVecT *out) const { - ValidateOperand( orStr ); - ValidateOperand( *out ); + this->ValidateOperand( orStr ); + this->ValidateOperand( *out ); uint32 * pDest = out->Base(); - const uint32 *pOperand1 = CBitVecT::Base(); + const uint32 *pOperand1 = this->Base(); const uint32 *pOperand2 = orStr.Base(); - for (int i = CBitVecT::GetNumDWords() - 1; i >= 0; --i) + for (int i = this->GetNumDWords() - 1; i >= 0; --i) { pDest[i] = pOperand1[i] | pOperand2[i]; } @@ -726,10 +746,10 @@ template inline void CBitVecT::Xor(const CBitVecT &xorStr, CBitVecT *out) const { uint32 * pDest = out->Base(); - const uint32 *pOperand1 = CBitVecT::Base(); + const uint32 *pOperand1 = this->Base(); const uint32 *pOperand2 = xorStr.Base(); - for (int i = CBitVecT::GetNumDWords() - 1; i >= 0; --i) + for (int i = this->GetNumDWords() - 1; i >= 0; --i) { pDest[i] = pOperand1[i] ^ pOperand2[i]; } @@ -743,12 +763,12 @@ inline void CBitVecT::Xor(const CBitVecT &xorStr, CBitVecT *out) const template inline void CBitVecT::Not(CBitVecT *out) const { - ValidateOperand( *out ); + this->ValidateOperand( *out ); uint32 * pDest = out->Base(); - const uint32 *pOperand = CBitVecT::Base(); + const uint32 *pOperand = this->Base(); - for (int i = CBitVecT::GetNumDWords() - 1; i >= 0; --i) + for (int i = this->GetNumDWords() - 1; i >= 0; --i) { pDest[i] = ~(pOperand[i]); } @@ -762,12 +782,12 @@ inline void CBitVecT::Not(CBitVecT *out) const template inline void CBitVecT::CopyTo(CBitVecT *out) const { - out->Resize( CBitVecT::GetNumBits() ); + out->Resize( this->GetNumBits() ); - ValidateOperand( *out ); + this->ValidateOperand( *out ); Assert( out != this ); - memcpy( out->Base(), CBitVecT::Base(), CBitVecT::GetNumDWords() * sizeof( int ) ); + memcpy( out->Base(), this->Base(), this->GetNumDWords() * sizeof( int ) ); } //----------------------------------------------------------------------------- @@ -781,11 +801,11 @@ inline bool CBitVecT::IsAllClear(void) const // Number of available bits may be more than the number // actually used, so make sure to mask out unused bits // before testing for zero - (const_cast(this))->Base()[CBitVecT::GetNumDWords()-1] &= CBitVecT::GetEndMask(); // external semantics of const retained + (const_cast(this))->Base()[this->GetNumDWords()-1] &= CBitVecT::GetEndMask(); // external semantics of const retained - for (int i = CBitVecT::GetNumDWords() - 1; i >= 0; --i) + for (int i = this->GetNumDWords() - 1; i >= 0; --i) { - if ( CBitVecT::Base()[i] !=0 ) + if ( this->Base()[i] !=0 ) { return false; } @@ -804,11 +824,11 @@ inline bool CBitVecT::IsAllSet(void) const // Number of available bits may be more than the number // actually used, so make sure to mask out unused bits // before testing for set bits - (const_cast(this))->Base()[CBitVecT::GetNumDWords()-1] |= ~CBitVecT::GetEndMask(); // external semantics of const retained + (const_cast(this))->Base()[this->GetNumDWords()-1] |= ~CBitVecT::GetEndMask(); // external semantics of const retained - for (int i = CBitVecT::GetNumDWords() - 1; i >= 0; --i) + for (int i = this->GetNumDWords() - 1; i >= 0; --i) { - if ( CBitVecT::Base()[i] != ~0 ) + if ( this->Base()[i] != ~0 ) { return false; } @@ -824,8 +844,8 @@ inline bool CBitVecT::IsAllSet(void) const template inline void CBitVecT::SetAll(void) { - if ( CBitVecT::Base() ) - memset( CBitVecT::Base(), 0xff, CBitVecT::GetNumDWords() * sizeof(int) ); + if ( this->Base() ) + memset( this->Base(), 0xff, this->GetNumDWords() * sizeof(int) ); } //----------------------------------------------------------------------------- @@ -836,8 +856,8 @@ inline void CBitVecT::SetAll(void) template inline void CBitVecT::ClearAll(void) { - if ( CBitVecT::Base() ) - memset( CBitVecT::Base(), 0, CBitVecT::GetNumDWords() * sizeof(int) ); + if ( this->Base() ) + memset( this->Base(), 0, this->GetNumDWords() * sizeof(int) ); } //----------------------------------------------------------------------------- @@ -849,12 +869,12 @@ inline void CBitVecT::Copy( const CBitVecT &other, int nBits nBits = other.GetNumBits(); } - CBitVecT::Resize( nBits ); + this->Resize( nBits ); - ValidateOperand( other ); + this->ValidateOperand( other ); Assert( &other != this ); - memcpy( CBitVecT::Base(), other.Base(), CBitVecT::GetNumDWords() * sizeof( uint32 ) ); + memcpy( this->Base(), other.Base(), this->GetNumDWords() * sizeof( uint32 ) ); } //----------------------------------------------------------------------------- @@ -863,7 +883,7 @@ inline bool CBitVecT::Compare( const CBitVecT &other, int nB { if ( nBits == - 1 ) { - if ( other.GetNumBits() != CBitVecT::GetNumBits() ) + if ( other.GetNumBits() != this->GetNumBits() ) { return false; } @@ -871,33 +891,33 @@ inline bool CBitVecT::Compare( const CBitVecT &other, int nB nBits = other.GetNumBits(); } - if ( nBits > other.GetNumBits() || nBits > CBitVecT::GetNumBits() ) + if ( nBits > other.GetNumBits() || nBits > this->GetNumBits() ) { return false; } - (const_cast(this))->Base()[CBitVecT::GetNumDWords()-1] &= CBitVecT::GetEndMask(); // external semantics of const retained - (const_cast(&other))->Base()[CBitVecT::GetNumDWords()-1] &= other.CBitVecT::GetEndMask(); // external semantics of const retained + (const_cast(this))->Base()[this->GetNumDWords()-1] &= CBitVecT::GetEndMask(); // external semantics of const retained + (const_cast(&other))->Base()[this->GetNumDWords()-1] &= other.CBitVecT::GetEndMask(); // external semantics of const retained int nBytes = PAD_NUMBER( nBits, 8 ) >> 3; - return ( memcmp( CBitVecT::Base(), other.Base(), nBytes ) == 0 ); + return ( memcmp( this->Base(), other.Base(), nBytes ) == 0 ); } //----------------------------------------------------------------------------- template inline uint32 CBitVecT::GetDWord(int i) const { - Assert(i >= 0 && i < CBitVecT::GetNumDWords()); - return CBitVecT::Base()[i]; + Assert(i >= 0 && i < this->GetNumDWords()); + return this->Base()[i]; } //----------------------------------------------------------------------------- template inline void CBitVecT::SetDWord(int i, uint32 val) { - Assert(i >= 0 && i < CBitVecT::GetNumDWords()); - CBitVecT::Base()[i] = val; + Assert(i >= 0 && i < this->GetNumDWords()); + this->Base()[i] = val; } //----------------------------------------------------------------------------- @@ -943,7 +963,8 @@ inline unsigned GetStartBitMask( int startBit ) return g_StartMask[ startBit & 31 ]; } -inline int CVarBitVecBase::FindNextSetBit( int startBit ) const +template +inline int CVarBitVecBase::FindNextSetBit( int startBit ) const { if ( startBit < GetNumBits() ) { @@ -1044,14 +1065,18 @@ inline int CFixedBitVecBase::FindNextSetBit( int startBit ) const const uint32 * RESTRICT pCurElem = Base() + wordIndex; unsigned int elem = *pCurElem; elem &= startMask; - do + while ( wordIndex < NUM_INTS ) { if ( elem ) + { return FirstBitInWord(elem, wordIndex << 5); - ++pCurElem; - elem = *pCurElem; - ++wordIndex; - } while( wordIndex <= NUM_INTS-1); + } + else if ( ++wordIndex < NUM_INTS ) + { + ++pCurElem; + elem = *pCurElem; + } + } } } @@ -1276,9 +1301,10 @@ inline void CBitVecT< CFixedBitVecBase<32> >::Set( int bitNum, bool bNewVal ) // Purpose: Resizes the bit string to a new number of bits // Input : resizeNumBits - //----------------------------------------------------------------------------- -inline void CVarBitVecBase::Resize( int resizeNumBits, bool bClearAll ) +template +inline void CVarBitVecBase::Resize( int resizeNumBits, bool bClearAll ) { - Assert( resizeNumBits >= 0 && resizeNumBits <= USHRT_MAX ); + Assert( resizeNumBits >= 0 && ((BITCOUNTTYPE)resizeNumBits == resizeNumBits) ); int newIntCount = CalcNumIntsForBits( resizeNumBits ); if ( newIntCount != GetNumDWords() ) @@ -1320,7 +1346,8 @@ inline void CVarBitVecBase::Resize( int resizeNumBits, bool bClearAll ) // Purpose: Allocate the storage for the ints // Input : numInts - //----------------------------------------------------------------------------- -inline void CVarBitVecBase::AllocInts( int numInts ) +template +inline void CVarBitVecBase::AllocInts( int numInts ) { Assert( !m_pInt ); @@ -1341,7 +1368,8 @@ inline void CVarBitVecBase::AllocInts( int numInts ) // Purpose: Reallocate the storage for the ints // Input : numInts - //----------------------------------------------------------------------------- -inline void CVarBitVecBase::ReallocInts( int numInts ) +template +inline void CVarBitVecBase::ReallocInts( int numInts ) { Assert( Base() ); if ( numInts == 0) @@ -1376,7 +1404,8 @@ inline void CVarBitVecBase::ReallocInts( int numInts ) //----------------------------------------------------------------------------- // Purpose: Free storage allocated with AllocInts //----------------------------------------------------------------------------- -inline void CVarBitVecBase::FreeInts( void ) +template +inline void CVarBitVecBase::FreeInts( void ) { if ( m_numInts > 1 ) { diff --git a/public/bone_accessor.cpp b/public/bone_accessor.cpp index ddd49624b..fb54cf873 100644 --- a/public/bone_accessor.cpp +++ b/public/bone_accessor.cpp @@ -7,6 +7,9 @@ #include "cbase.h" #include "bone_accessor.h" +// NOTE: This has to be the last file included! +#include "tier0/memdbgon.h" + #if defined( CLIENT_DLL ) && defined( _DEBUG ) diff --git a/public/bone_accessor.h b/public/bone_accessor.h index 32e4dd144..665ee24bb 100644 --- a/public/bone_accessor.h +++ b/public/bone_accessor.h @@ -22,11 +22,11 @@ class CBoneAccessor public: CBoneAccessor(); - CBoneAccessor( matrix3x4_t *pBones ); // This can be used to allow access to all bones. + CBoneAccessor( matrix3x4a_t *pBones ); // This can be used to allow access to all bones. // Initialize. #if defined( CLIENT_DLL ) - void Init( const C_BaseAnimating *pAnimating, matrix3x4_t *pBones ); + void Init( const C_BaseAnimating *pAnimating, matrix3x4a_t *pBones ); #endif int GetReadableBones(); @@ -36,11 +36,11 @@ class CBoneAccessor void SetWritableBones( int flags ); // Get bones for read or write access. - const matrix3x4_t& GetBone( int iBone ) const; - const matrix3x4_t& operator[]( int iBone ) const; - matrix3x4_t& GetBoneForWrite( int iBone ); + const matrix3x4a_t& GetBone( int iBone ) const; + const matrix3x4a_t& operator[]( int iBone ) const; + matrix3x4a_t& GetBoneForWrite( int iBone ); - matrix3x4_t *GetBoneArrayForWrite( ) const; + matrix3x4a_t *GetBoneArrayForWrite( ) const; private: @@ -51,7 +51,7 @@ class CBoneAccessor // Only used in the client DLL for debug verification. const C_BaseAnimating *m_pAnimating; - matrix3x4_t *m_pBones; + matrix3x4a_t *m_pBones; int m_ReadableBones; // Which bones can be read. int m_WritableBones; // Which bones can be written. @@ -65,14 +65,14 @@ inline CBoneAccessor::CBoneAccessor() m_ReadableBones = m_WritableBones = 0; } -inline CBoneAccessor::CBoneAccessor( matrix3x4_t *pBones ) +inline CBoneAccessor::CBoneAccessor( matrix3x4a_t *pBones ) { m_pAnimating = NULL; m_pBones = pBones; } #if defined( CLIENT_DLL ) - inline void CBoneAccessor::Init( const C_BaseAnimating *pAnimating, matrix3x4_t *pBones ) + inline void CBoneAccessor::Init( const C_BaseAnimating *pAnimating, matrix3x4a_t *pBones ) { m_pAnimating = pAnimating; m_pBones = pBones; @@ -99,7 +99,7 @@ inline void CBoneAccessor::SetWritableBones( int flags ) m_WritableBones = flags; } -inline const matrix3x4_t& CBoneAccessor::GetBone( int iBone ) const +inline const matrix3x4a_t& CBoneAccessor::GetBone( int iBone ) const { #if defined( CLIENT_DLL ) && defined( _DEBUG ) SanityCheckBone( iBone, true ); @@ -107,7 +107,7 @@ inline const matrix3x4_t& CBoneAccessor::GetBone( int iBone ) const return m_pBones[iBone]; } -inline const matrix3x4_t& CBoneAccessor::operator[]( int iBone ) const +inline const matrix3x4a_t& CBoneAccessor::operator[]( int iBone ) const { #if defined( CLIENT_DLL ) && defined( _DEBUG ) SanityCheckBone( iBone, true ); @@ -115,7 +115,7 @@ inline const matrix3x4_t& CBoneAccessor::operator[]( int iBone ) const return m_pBones[iBone]; } -inline matrix3x4_t& CBoneAccessor::GetBoneForWrite( int iBone ) +inline matrix3x4a_t& CBoneAccessor::GetBoneForWrite( int iBone ) { #if defined( CLIENT_DLL ) && defined( _DEBUG ) SanityCheckBone( iBone, false ); @@ -123,7 +123,7 @@ inline matrix3x4_t& CBoneAccessor::GetBoneForWrite( int iBone ) return m_pBones[iBone]; } -inline matrix3x4_t *CBoneAccessor::GetBoneArrayForWrite( void ) const +inline matrix3x4a_t *CBoneAccessor::GetBoneArrayForWrite( void ) const { return m_pBones; } diff --git a/public/bone_setup.cpp b/public/bone_setup.cpp index 00aa3de86..2a1477a22 100644 --- a/public/bone_setup.cpp +++ b/public/bone_setup.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -28,6 +28,23 @@ // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" +class CBoneSetup +{ +public: + CBoneSetup( const CStudioHdr *pStudioHdr, int boneMask, const float poseParameter[], IPoseDebugger *pPoseDebugger = NULL ); + void InitPose( Vector pos[], Quaternion q[] ); + void AccumulatePose( Vector pos[], Quaternion q[], int sequence, float cycle, float flWeight, float flTime, CIKContext *pIKContext ); + void CalcAutoplaySequences( Vector pos[], Quaternion q[], float flRealTime, CIKContext *pIKContext ); +private: + void AddSequenceLayers( Vector pos[], Quaternion q[], mstudioseqdesc_t &seqdesc, int sequence, float cycle, float flWeight, float flTime, CIKContext *pIKContext ); + void AddLocalLayers( Vector pos[], Quaternion q[], mstudioseqdesc_t &seqdesc, int sequence, float cycle, float flWeight, float flTime, CIKContext *pIKContext ); +public: + const CStudioHdr *m_pStudioHdr; + int m_boneMask; + const float *m_flPoseParameter; + IPoseDebugger *m_pPoseDebugger; +}; + // ----------------------------------------------------------------- template class CBoneSetupMemoryPool @@ -40,7 +57,9 @@ class CBoneSetupMemoryPool { p = new T[MAXSTUDIOBONES]; if ( ((size_t)p) % TSLIST_NODE_ALIGNMENT != 0 ) + { DebuggerBreak(); + } } return p; @@ -57,7 +76,7 @@ class CBoneSetupMemoryPool CBoneSetupMemoryPool g_QaternionPool; CBoneSetupMemoryPool g_VectorPool; -CBoneSetupMemoryPool g_MatrixPool; +CBoneSetupMemoryPool g_MatrixPool; // ----------------------------------------------------------------- CBoneCache *CBoneCache::CreateResource( const bonecacheparams_t ¶ms ) @@ -138,7 +157,7 @@ void CBoneCache::UpdateBones( const matrix3x4_t *pBoneToWorld, int numbones, flo m_timeValid = curtime; } -matrix3x4_t *CBoneCache::GetCachedBone( int studioIndex ) +matrix3x4a_t *CBoneCache::GetCachedBone( int studioIndex ) { int cachedIndex = StudioToCached()[studioIndex]; if ( cachedIndex >= 0 ) @@ -178,9 +197,9 @@ bool CBoneCache::IsValid( float curtime, float dt ) // private functions -matrix3x4_t *CBoneCache::BoneArray() +matrix3x4a_t *CBoneCache::BoneArray() { - return (matrix3x4_t *)( (char *)(this+1) + m_matrixOffset ); + return (matrix3x4a_t *)( (char *)(this+1) + m_matrixOffset ); } short *CBoneCache::StudioToCached() @@ -194,7 +213,7 @@ short *CBoneCache::CachedToStudio() } // Construct a singleton -static CDataManager g_StudioBoneCache( 24 * 1024L ); +static CDataManager g_StudioBoneCache( 128 * 1024L ); CBoneCache *Studio_GetBoneCache( memhandle_t cacheHandle ) { @@ -230,11 +249,11 @@ void Studio_InvalidateBoneCache( memhandle_t cacheHandle ) void BuildBoneChain( const CStudioHdr *pStudioHdr, - const matrix3x4_t &rootxform, + const matrix3x4a_t &rootxform, const Vector pos[], const Quaternion q[], int iBone, - matrix3x4_t *pBoneToWorld ) + matrix3x4a_t *pBoneToWorld ) { CBoneBitList boneComputed; BuildBoneChain( pStudioHdr, rootxform, pos, q, iBone, pBoneToWorld, boneComputed ); @@ -355,7 +374,7 @@ void ExtractAnimValue( int frame, mstudioanimvalue_t *panimvalue, float scale, f void CalcBoneQuaternion( int frame, float s, const Quaternion &baseQuat, const RadianEuler &baseRot, const Vector &baseRotScale, int iBaseFlags, const Quaternion &baseAlignment, - const mstudioanim_t *panim, Quaternion &q ) + const mstudio_rle_anim_t *panim, Quaternion &q ) { if ( panim->flags & STUDIO_ANIM_RAWROT ) { @@ -457,7 +476,7 @@ void CalcBoneQuaternion( int frame, float s, inline void CalcBoneQuaternion( int frame, float s, const mstudiobone_t *pBone, const mstudiolinearbone_t *pLinearBones, - const mstudioanim_t *panim, Quaternion &q ) + const mstudio_rle_anim_t *panim, Quaternion &q ) { if (pLinearBones) { @@ -478,7 +497,7 @@ inline void CalcBoneQuaternion( int frame, float s, //----------------------------------------------------------------------------- void CalcBonePosition( int frame, float s, const Vector &basePos, const Vector &baseBoneScale, - const mstudioanim_t *panim, Vector &pos ) + const mstudio_rle_anim_t *panim, Vector &pos ) { if (panim->flags & STUDIO_ANIM_RAWPOS) { @@ -534,7 +553,7 @@ void CalcBonePosition( int frame, float s, inline void CalcBonePosition( int frame, float s, const mstudiobone_t *pBone, const mstudiolinearbone_t *pLinearBones, - const mstudioanim_t *panim, Vector &pos ) + const mstudio_rle_anim_t *panim, Vector &pos ) { if (pLinearBones) { @@ -558,7 +577,7 @@ void SetupSingleBoneMatrix( mstudioseqdesc_t &seqdesc = pOwnerHdr->pSeqdesc( nSequence ); mstudioanimdesc_t &animdesc = pOwnerHdr->pAnimdesc( seqdesc.anim( 0, 0 ) ); int iLocalFrame = iFrame; - mstudioanim_t *panim = animdesc.pAnim( &iLocalFrame ); + mstudio_rle_anim_t *panim = (mstudio_rle_anim_t *)animdesc.pAnim( &iLocalFrame ); float s = 0; mstudiobone_t *pbone = pOwnerHdr->pBone( iBone ); @@ -644,7 +663,7 @@ static void CalcDecompressedAnimation( const mstudiocompressedikerror_t *pCompre //----------------------------------------------------------------------------- static void CalcLocalHierarchyAnimation( const CStudioHdr *pStudioHdr, - matrix3x4_t *boneToWorld, + matrix3x4a_t *boneToWorld, CBoneBitList &boneComputed, Vector *pos, Quaternion *q, @@ -659,11 +678,17 @@ static void CalcLocalHierarchyAnimation( int boneMask ) { +#ifdef STAGING_ONLY + Assert( iNewParent == -1 || (iNewParent >= 0 && iNewParent < MAXSTUDIOBONES) ); + Assert( iBone > 0 ); + Assert( iBone < MAXSTUDIOBONES ); +#endif // STAGING_ONLY + Vector localPos; Quaternion localQ; // make fake root transform - static matrix3x4_t rootXform( 1.0f, 0, 0, 0, 0, 1.0f, 0, 0, 0, 0, 1.0f, 0 ); + static ALIGN16 matrix3x4a_t rootXform ALIGN16_POST ( 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f ); // FIXME: missing check to see if seq has a weight for this bone float weight = 1.0f; @@ -696,12 +721,19 @@ static void CalcLocalHierarchyAnimation( CalcDecompressedAnimation( pHierarchy->pLocalAnim(), iFrame - pHierarchy->iStart, flFraq, localPos, localQ ); BuildBoneChain( pStudioHdr, rootXform, pos, q, iBone, boneToWorld, boneComputed ); - BuildBoneChain( pStudioHdr, rootXform, pos, q, iNewParent, boneToWorld, boneComputed ); matrix3x4_t localXform; AngleMatrix( localQ, localPos, localXform ); - ConcatTransforms( boneToWorld[iNewParent], localXform, boneToWorld[iBone] ); + if ( iNewParent != -1 ) + { + BuildBoneChain( pStudioHdr, rootXform, pos, q, iNewParent, boneToWorld, boneComputed ); + ConcatTransforms( boneToWorld[iNewParent], localXform, boneToWorld[iBone] ); + } + else + { + boneToWorld[iBone] = localXform; + } // back solve Vector p1; @@ -775,7 +807,7 @@ static void CalcZeroframeData( const CStudioHdr *pStudioHdr, const studiohdr_t * } pData += sizeof( Vector48 ); } - if (pAnimbone[j].flags & BONE_HAS_SAVEFRAME_ROT) + if (pAnimbone[j].flags & BONE_HAS_SAVEFRAME_ROT64) { if ((i >= 0) && (pStudioHdr->boneFlags(i) & boneMask)) { @@ -790,7 +822,7 @@ static void CalcZeroframeData( const CStudioHdr *pStudioHdr, const studiohdr_t * else { float s1; - int index = (int)(fFrame / animdesc.zeroframespan); + int index = fFrame / animdesc.zeroframespan; if (index >= animdesc.zeroframecount - 1) { index = animdesc.zeroframecount - 2; @@ -800,9 +832,9 @@ static void CalcZeroframeData( const CStudioHdr *pStudioHdr, const studiohdr_t * { s1 = clamp( (fFrame - index * animdesc.zeroframespan) / animdesc.zeroframespan, 0.0f, 1.0f ); } - int i0 = MAX( index - 1, 0 ); + int i0 = max( index - 1, 0 ); int i1 = index; - int i2 = MIN( index + 1, animdesc.zeroframecount - 1 ); + int i2 = min( index + 1, animdesc.zeroframecount - 1 ); for (j = 0; j < pAnimStudioHdr->numbones; j++) { if (pAnimGroup) @@ -824,7 +856,7 @@ static void CalcZeroframeData( const CStudioHdr *pStudioHdr, const studiohdr_t * } pData += sizeof( Vector48 ) * animdesc.zeroframecount; } - if (pAnimbone[j].flags & BONE_HAS_SAVEFRAME_ROT) + if (pAnimbone[j].flags & BONE_HAS_SAVEFRAME_ROT64) { if ((i >= 0) && (pStudioHdr->boneFlags(i) & boneMask)) { @@ -865,7 +897,7 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt const studiohdr_t *pSeqStudioHdr; const mstudiolinearbone_t *pSeqLinearBones; const mstudiobone_t *pSeqbone; - const mstudioanim_t *panim; + const mstudio_rle_anim_t *panim; const studiohdr_t *pAnimStudioHdr; const mstudiolinearbone_t *pAnimLinearBones; const mstudiobone_t *pAnimbone; @@ -873,12 +905,12 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt pSeqGroup = pVModel->pSeqGroup( sequence ); int baseanimation = pStudioHdr->iRelativeAnim( sequence, animation ); - mstudioanimdesc_t &animdesc = pStudioHdr->pAnimdesc( baseanimation ); - pSeqStudioHdr = pStudioHdr->pSeqStudioHdr( sequence ); + mstudioanimdesc_t &animdesc = ((CStudioHdr *)pStudioHdr)->pAnimdesc( baseanimation ); + pSeqStudioHdr = ((CStudioHdr *)pStudioHdr)->pSeqStudioHdr( sequence ); pSeqLinearBones = pSeqStudioHdr->pLinearBones(); pSeqbone = pSeqStudioHdr->pBone( 0 ); pAnimGroup = pVModel->pAnimGroup( baseanimation ); - pAnimStudioHdr = pStudioHdr->pAnimStudioHdr( baseanimation ); + pAnimStudioHdr = ((CStudioHdr *)pStudioHdr)->pAnimStudioHdr( baseanimation ); pAnimLinearBones = pAnimStudioHdr->pLinearBones(); pAnimbone = pAnimStudioHdr->pBone( 0 ); @@ -892,7 +924,7 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt int iLocalFrame = iFrame; float flStall; - panim = animdesc.pAnim( &iLocalFrame, flStall ); + panim = (mstudio_rle_anim_t *)animdesc.pAnim( &iLocalFrame, flStall ); float *pweight = seqdesc.pBoneweight( 0 ); pbone = pStudioHdr->pBone( 0 ); @@ -929,7 +961,7 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt // if the animation isn't available, look for the zero frame cache if (!panim) { - CalcZeroframeData( pStudioHdr, pAnimStudioHdr, pAnimGroup, pAnimbone, animdesc, fFrame, pos, q, boneMask, 1.0 ); + CalcZeroframeData( ((CStudioHdr *)pStudioHdr), pAnimStudioHdr, pAnimGroup, pAnimbone, animdesc, fFrame, pos, q, boneMask, 1.0 ); return; } @@ -962,7 +994,7 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt // calculate a local hierarchy override if (animdesc.numlocalhierarchy) { - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int i; @@ -976,10 +1008,17 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt int iBone = pAnimGroup->masterBone[pHierarchy->iBone]; if (iBone >= 0 && (pStudioHdr->boneFlags(iBone) & boneMask)) { - int iNewParent = pAnimGroup->masterBone[pHierarchy->iNewParent]; - if (iNewParent >= 0 && (pStudioHdr->boneFlags(iNewParent) & boneMask)) + if ( pHierarchy->iNewParent != -1 ) + { + int iNewParent = pAnimGroup->masterBone[pHierarchy->iNewParent]; + if (iNewParent >= 0 && (pStudioHdr->boneFlags(iNewParent) & boneMask)) + { + CalcLocalHierarchyAnimation( pStudioHdr, boneToWorld, boneComputed, pos, q, pbone, pHierarchy, iBone, iNewParent, cycle, iFrame, s, boneMask ); + } + } + else { - CalcLocalHierarchyAnimation( pStudioHdr, boneToWorld, boneComputed, pos, q, pbone, pHierarchy, iBone, iNewParent, cycle, iFrame, s, boneMask ); + CalcLocalHierarchyAnimation( pStudioHdr, boneToWorld, boneComputed, pos, q, pbone, pHierarchy, iBone, -1, cycle, iFrame, s, boneMask ); } } } @@ -1011,7 +1050,7 @@ static void CalcAnimation( const CStudioHdr *pStudioHdr, Vector *pos, Quaternion return; } - mstudioanimdesc_t &animdesc = pStudioHdr->pAnimdesc( animation ); + mstudioanimdesc_t &animdesc = ((CStudioHdr *)pStudioHdr)->pAnimdesc( animation ); mstudiobone_t *pbone = pStudioHdr->pBone( 0 ); const mstudiolinearbone_t *pLinearBones = pStudioHdr->pLinearBones(); @@ -1026,7 +1065,7 @@ static void CalcAnimation( const CStudioHdr *pStudioHdr, Vector *pos, Quaternion int iLocalFrame = iFrame; float flStall; - mstudioanim_t *panim = animdesc.pAnim( &iLocalFrame, flStall ); + mstudio_rle_anim_t *panim = (mstudio_rle_anim_t *)animdesc.pAnim( &iLocalFrame, flStall ); float *pweight = seqdesc.pBoneweight( 0 ); @@ -1099,7 +1138,7 @@ static void CalcAnimation( const CStudioHdr *pStudioHdr, Vector *pos, Quaternion if (animdesc.numlocalhierarchy) { - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int i; @@ -1228,17 +1267,17 @@ void WorldSpaceSlerp( float s2; // weight for q2, pos2 // make fake root transform - matrix3x4_t rootXform; + matrix3x4a_t rootXform; SetIdentityMatrix( rootXform ); // matrices for q2, pos2 - matrix3x4_t *srcBoneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *srcBoneToWorld = g_MatrixPool.Alloc(); CBoneBitList srcBoneComputed; - matrix3x4_t *destBoneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *destBoneToWorld = g_MatrixPool.Alloc(); CBoneBitList destBoneComputed; - matrix3x4_t *targetBoneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *targetBoneToWorld = g_MatrixPool.Alloc(); CBoneBitList targetBoneComputed; virtualmodel_t *pVModel = pStudioHdr->GetVirtualModel(); @@ -1314,10 +1353,10 @@ void WorldSpaceSlerp( } else { - matrix3x4_t worldToBone; + matrix3x4a_t worldToBone; MatrixInvert( targetBoneToWorld[n], worldToBone ); - matrix3x4_t local; + matrix3x4a_t local; ConcatTransforms( worldToBone, targetBoneToWorld[i], local ); MatrixAngles( local, q1[i], tmp ); @@ -1607,7 +1646,7 @@ void ScaleBones( int i, j; Quaternion q3; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( sequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( sequence ); virtualmodel_t *pVModel = pStudioHdr->GetVirtualModel(); const virtualgroup_t *pSeqGroup = NULL; @@ -1658,7 +1697,7 @@ void Studio_LocalPoseParameter( const CStudioHdr *pStudioHdr, const float posePa return; } - const mstudioposeparamdesc_t &Pose = pStudioHdr->pPoseParameter( iPose ); + const mstudioposeparamdesc_t &Pose = ((CStudioHdr *)pStudioHdr)->pPoseParameter( iPose ); float flValue = poseParameter[iPose]; @@ -1786,7 +1825,7 @@ inline bool PoseIsAllZeros( // remove "zero" positional blends baseanim = pStudioHdr->iRelativeAnim( sequence, seqdesc.anim(i0 ,i1 ) ); - mstudioanimdesc_t &anim = pStudioHdr->pAnimdesc( baseanim ); + mstudioanimdesc_t &anim = ((CStudioHdr *)pStudioHdr)->pAnimdesc( baseanim ); return (anim.flags & STUDIO_ALLZEROS) != 0; } @@ -1902,7 +1941,7 @@ bool CalcPoseSingle( if (sequence >= pStudioHdr->GetNumSeq()) { sequence = 0; - seqdesc = pStudioHdr->pSeqdesc( sequence ); + seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( sequence ); } @@ -1925,7 +1964,7 @@ bool CalcPoseSingle( if (iPose != -1) { /* - const mstudioposeparamdesc_t &Pose = pStudioHdr->pPoseParameter( iPose ); + const mstudioposeparamdesc_t &Pose = ((CStudioHdr *)pStudioHdr)->pPoseParameter( iPose ); cycle = poseParameter[ iPose ] * (Pose.end - Pose.start) + Pose.start; */ cycle = poseParameter[ iPose ]; @@ -2083,19 +2122,16 @@ bool CalcPoseSingle( // Purpose: calculate a pose for a single sequence // adds autolayers, runs local ik rukes //----------------------------------------------------------------------------- -void AddSequenceLayers( - const CStudioHdr *pStudioHdr, - CIKContext *pIKContext, - Vector pos[], - Quaternion q[], - mstudioseqdesc_t &seqdesc, - int sequence, - float cycle, - const float poseParameter[], - int boneMask, - float flWeight, - float flTime - ) +void CBoneSetup::AddSequenceLayers( + Vector pos[], + Quaternion q[], + mstudioseqdesc_t &seqdesc, + int sequence, + float cycle, + float flWeight, + float flTime, + CIKContext *pIKContext + ) { for (int i = 0; i < seqdesc.numautolayers; i++) { @@ -2118,12 +2154,12 @@ void AddSequenceLayers( } else { - int iSequence = pStudioHdr->iRelativeSeq( sequence, pLayer->iSequence ); - int iPose = pStudioHdr->GetSharedPoseParameter( iSequence, pLayer->iPose ); + int iSequence = m_pStudioHdr->iRelativeSeq( sequence, pLayer->iSequence ); + int iPose = m_pStudioHdr->GetSharedPoseParameter( iSequence, pLayer->iPose ); if (iPose != -1) { - const mstudioposeparamdesc_t &Pose = pStudioHdr->pPoseParameter( iPose ); - index = poseParameter[ iPose ] * (Pose.end - Pose.start) + Pose.start; + const mstudioposeparamdesc_t &Pose = ((CStudioHdr *)m_pStudioHdr)->pPoseParameter( iPose ); + index = m_flPoseParameter[ iPose ] * (Pose.end - Pose.start) + Pose.start; } else { @@ -2169,8 +2205,8 @@ void AddSequenceLayers( } } - int iSequence = pStudioHdr->iRelativeSeq( sequence, pLayer->iSequence ); - AccumulatePose( pStudioHdr, pIKContext, pos, q, iSequence, layerCycle, poseParameter, boneMask, layerWeight, flTime ); + int iSequence = m_pStudioHdr->iRelativeSeq( sequence, pLayer->iSequence ); + AccumulatePose( pos, q, iSequence, layerCycle, layerWeight, flTime, pIKContext ); } } @@ -2179,18 +2215,15 @@ void AddSequenceLayers( // Purpose: calculate a pose for a single sequence // adds autolayers, runs local ik rukes //----------------------------------------------------------------------------- -void AddLocalLayers( - const CStudioHdr *pStudioHdr, - CIKContext *pIKContext, +void CBoneSetup::AddLocalLayers( Vector pos[], Quaternion q[], mstudioseqdesc_t &seqdesc, int sequence, float cycle, - const float poseParameter[], - int boneMask, float flWeight, - float flTime + float flTime, + CIKContext *pIKContext ) { if (!(seqdesc.flags & STUDIO_LOCAL)) @@ -2247,11 +2280,65 @@ void AddLocalLayers( layerCycle = (cycle - pLayer->start) / (pLayer->end - pLayer->start); } - int iSequence = pStudioHdr->iRelativeSeq( sequence, pLayer->iSequence ); - AccumulatePose( pStudioHdr, pIKContext, pos, q, iSequence, layerCycle, poseParameter, boneMask, layerWeight, flTime ); + int iSequence = m_pStudioHdr->iRelativeSeq( sequence, pLayer->iSequence ); + AccumulatePose( pos, q, iSequence, layerCycle, layerWeight, flTime, pIKContext ); + } +} + +//----------------------------------------------------------------------------- +// Purpose: my sleezy attempt at an interface only class +//----------------------------------------------------------------------------- + +IBoneSetup::IBoneSetup( const CStudioHdr *pStudioHdr, int boneMask, const float poseParameter[], IPoseDebugger *pPoseDebugger ) +{ + m_pBoneSetup = new CBoneSetup( pStudioHdr, boneMask, poseParameter, pPoseDebugger ); +} + +IBoneSetup::~IBoneSetup( void ) +{ + if ( m_pBoneSetup ) + { + delete m_pBoneSetup; } } +void IBoneSetup::InitPose( Vector pos[], QuaternionAligned q[] ) +{ + ::InitPose( m_pBoneSetup->m_pStudioHdr, pos, q, m_pBoneSetup->m_boneMask ); +} + +void IBoneSetup::AccumulatePose( Vector pos[], Quaternion q[], int sequence, float cycle, float flWeight, float flTime, CIKContext *pIKContext ) +{ + m_pBoneSetup->AccumulatePose( pos, q, sequence, cycle, flWeight, flTime, pIKContext ); +} + +void IBoneSetup::CalcAutoplaySequences( Vector pos[], Quaternion q[], float flRealTime, CIKContext *pIKContext ) +{ + m_pBoneSetup->CalcAutoplaySequences( pos, q, flRealTime, pIKContext ); +} + +void CalcBoneAdj( const CStudioHdr *pStudioHdr, Vector pos[], Quaternion q[], const float controllers[], int boneMask ); + +// takes a "controllers[]" array normalized to 0..1 and adds in the adjustments to pos[], and q[]. +void IBoneSetup::CalcBoneAdj( Vector pos[], Quaternion q[], const float controllers[] ) +{ + ::CalcBoneAdj( m_pBoneSetup->m_pStudioHdr, pos, q, controllers, m_pBoneSetup->m_boneMask ); +} + +CStudioHdr *IBoneSetup::GetStudioHdr() +{ + return (CStudioHdr *)m_pBoneSetup->m_pStudioHdr; +} + +CBoneSetup::CBoneSetup( const CStudioHdr *pStudioHdr, int boneMask, const float poseParameter[], IPoseDebugger *pPoseDebugger ) +{ + m_pStudioHdr = pStudioHdr; + m_boneMask = boneMask; + m_flPoseParameter = poseParameter; + m_pPoseDebugger = pPoseDebugger; +} + +#if 0 //----------------------------------------------------------------------------- // Purpose: calculate a pose for a single sequence // adds autolayers, runs local ik rukes @@ -2269,7 +2356,7 @@ void CalcPose( float flTime ) { - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( sequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( sequence ); Assert( flWeight >= 0.0f && flWeight <= 1.0f ); // This shouldn't be necessary, but the Assert should help us catch whoever is screwing this up @@ -2297,23 +2384,20 @@ void CalcPose( seq_ik.SolveSequenceLocks( seqdesc, pos, q ); } } - +#endif //----------------------------------------------------------------------------- // Purpose: accumulate a pose for a single sequence on top of existing animation // adds autolayers, runs local ik rukes //----------------------------------------------------------------------------- -void AccumulatePose( - const CStudioHdr *pStudioHdr, - CIKContext *pIKContext, +void CBoneSetup::AccumulatePose( Vector pos[], Quaternion q[], int sequence, float cycle, - const float poseParameter[], - int boneMask, float flWeight, - float flTime + float flTime, + CIKContext *pIKContext ) { Vector pos2[MAXSTUDIOBONES]; @@ -2328,37 +2412,41 @@ void AccumulatePose( #ifdef CLIENT_DLL // Trigger pose debugger - g_pPoseDebugger->AccumulatePose( pStudioHdr, pIKContext, pos, q, sequence, cycle, poseParameter, boneMask, flWeight, flTime ); + if (m_pPoseDebugger) + { + m_pPoseDebugger->AccumulatePose( m_pStudioHdr, pIKContext, pos, q, sequence, cycle, m_flPoseParameter, m_boneMask, flWeight, flTime ); + } #endif - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( sequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)m_pStudioHdr)->pSeqdesc( sequence ); // add any IK locks to prevent extremities from moving CIKContext seq_ik; if (seqdesc.numiklocks) { - seq_ik.Init( pStudioHdr, vec3_angle, vec3_origin, 0.0, 0, boneMask ); // local space relative so absolute position doesn't mater + seq_ik.Init( m_pStudioHdr, vec3_angle, vec3_origin, 0.0, 0, m_boneMask ); // local space relative so absolute position doesn't mater seq_ik.AddSequenceLocks( seqdesc, pos, q ); } if (seqdesc.flags & STUDIO_LOCAL) { - InitPose( pStudioHdr, pos2, q2, boneMask ); + ::InitPose( m_pStudioHdr, pos2, q2, m_boneMask ); } - if (CalcPoseSingle( pStudioHdr, pos2, q2, seqdesc, sequence, cycle, poseParameter, boneMask, flTime )) + if (CalcPoseSingle( m_pStudioHdr, pos2, q2, seqdesc, sequence, cycle, m_flPoseParameter, m_boneMask, flTime )) { // this weight is wrong, the IK rules won't composite at the correct intensity - AddLocalLayers( pStudioHdr, pIKContext, pos2, q2, seqdesc, sequence, cycle, poseParameter, boneMask, 1.0, flTime ); - SlerpBones( pStudioHdr, q, pos, seqdesc, sequence, q2, pos2, flWeight, boneMask ); + AddLocalLayers( pos2, q2, seqdesc, sequence, cycle, 1.0, flTime, pIKContext ); + SlerpBones( m_pStudioHdr, q, pos, seqdesc, sequence, q2, pos2, flWeight, m_boneMask ); } + if ( pIKContext ) { - pIKContext->AddDependencies( seqdesc, sequence, cycle, poseParameter, flWeight ); + pIKContext->AddDependencies( seqdesc, sequence, cycle, m_flPoseParameter, flWeight ); } - AddSequenceLayers( pStudioHdr, pIKContext, pos, q, seqdesc, sequence, cycle, poseParameter, boneMask, flWeight, flTime ); + AddSequenceLayers( pos, q, seqdesc, sequence, cycle, flWeight, flTime, pIKContext ); if (seqdesc.numiklocks) { @@ -2600,7 +2688,7 @@ void debugLine(const Vector& origin, const Vector& dest, int r, int g, int b, bo //----------------------------------------------------------------------------- // Purpose: for a 2 bone chain, find the IK solution and reset the matrices //----------------------------------------------------------------------------- -bool Studio_SolveIK( mstudioikchain_t *pikchain, Vector &targetFoot, matrix3x4_t *pBoneToWorld ) +bool Studio_SolveIK( mstudioikchain_t *pikchain, Vector &targetFoot, matrix3x4a_t *pBoneToWorld ) { if (pikchain->pLink(0)->kneeDir.LengthSqr() > 0.0) { @@ -2624,7 +2712,7 @@ bool Studio_SolveIK( mstudioikchain_t *pikchain, Vector &targetFoot, matrix3x4_t // Purpose: Solve Knee position for a known hip and foot location, but no specific knee direction preference //----------------------------------------------------------------------------- -bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, matrix3x4_t *pBoneToWorld ) +bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, matrix3x4a_t *pBoneToWorld ) { Vector worldFoot, worldKnee, worldThigh; @@ -2662,7 +2750,7 @@ bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, matri //----------------------------------------------------------------------------- // Purpose: Realign the matrix so that its X axis points along the desired axis. //----------------------------------------------------------------------------- -void Studio_AlignIKMatrix( matrix3x4_t &mMat, const Vector &vAlignTo ) +void Studio_AlignIKMatrix( matrix3x4a_t &mMat, const Vector &vAlignTo ) { Vector tmp1, tmp2, tmp3; @@ -2688,7 +2776,7 @@ void Studio_AlignIKMatrix( matrix3x4_t &mMat, const Vector &vAlignTo ) // Purpose: Solve Knee position for a known hip and foot location, and a known knee direction //----------------------------------------------------------------------------- -bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vector &targetKneePos, Vector &targetKneeDir, matrix3x4_t *pBoneToWorld ) +bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vector &targetKneePos, Vector &targetKneeDir, matrix3x4a_t *pBoneToWorld ) { Vector worldFoot, worldKnee, worldThigh; @@ -2710,8 +2798,8 @@ bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vecto // exaggerate knee targets for legs that are nearly straight // FIXME: should be configurable, and the ikKnee should be from the original animation, not modifed - float d = (targetFoot-worldThigh).Length() - MIN( l1, l2 ); - d = MAX( l1 + l2, d ); + float d = (targetFoot-worldThigh).Length() - min( l1, l2 ); + d = max( l1 + l2, d ); // FIXME: too short knee directions cause trouble d = d * 100; @@ -2731,7 +2819,7 @@ bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vecto // too close? // limit distance to about an 80 degree knee bend - float minDist = MAX( fabs(l1 - l2) * 1.15, MIN( l1, l2 ) * 0.15 ); + float minDist = max( fabs(l1 - l2) * 1.15, min( l1, l2 ) * 0.15 ); if (ikFoot.Length() < minDist) { // too close to get an accurate vector, just use original vector @@ -2743,9 +2831,9 @@ bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vecto CIKSolver ik; if (ik.solve( l1, l2, ikFoot.Base(), ikTargetKnee.Base(), ikKnee.Base() )) { - matrix3x4_t& mWorldThigh = pBoneToWorld[ iThigh ]; - matrix3x4_t& mWorldKnee = pBoneToWorld[ iKnee ]; - matrix3x4_t& mWorldFoot = pBoneToWorld[ iFoot ]; + matrix3x4a_t& mWorldThigh = pBoneToWorld[ iThigh ]; + matrix3x4a_t& mWorldKnee = pBoneToWorld[ iKnee ]; + matrix3x4a_t& mWorldFoot = pBoneToWorld[ iFoot ]; //debugLine( worldThigh, ikKnee + worldThigh, 255, 0, 0, true, 0 ); //debugLine( ikKnee + worldThigh, ikFoot + worldThigh, 255, 0, 0, true,0 ); @@ -3195,7 +3283,7 @@ void CIKContext::AddDependencies( mstudioseqdesc_t &seqdesc, int iSequence, floa } else { - flCycle = MAX( 0.0, MIN( flCycle, 0.9999 ) ); + flCycle = max( 0.0, min( flCycle, 0.9999 ) ); } } @@ -3261,7 +3349,7 @@ void CIKContext::AddAutoplayLocks( Vector pos[], Quaternion q[] ) return; } - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int ikOffset = m_ikLock.AddMultipleToTail( m_pStudioHdr->GetNumIKAutoplayLocks() ); @@ -3269,7 +3357,7 @@ void CIKContext::AddAutoplayLocks( Vector pos[], Quaternion q[] ) for (int i = 0; i < m_pStudioHdr->GetNumIKAutoplayLocks(); i++) { - const mstudioiklock_t &lock = m_pStudioHdr->pIKAutoplayLock( i ); + const mstudioiklock_t &lock = ((CStudioHdr *)m_pStudioHdr)->pIKAutoplayLock( i ); mstudioikchain_t *pchain = m_pStudioHdr->pIKChain( lock.chain ); int bone = pchain->pLink( 2 )->bone; @@ -3320,7 +3408,7 @@ void CIKContext::AddSequenceLocks( mstudioseqdesc_t &seqdesc, Vector pos[], Quat return; } - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int ikOffset = m_ikLock.AddMultipleToTail( seqdesc.numiklocks ); @@ -3366,7 +3454,7 @@ void CIKContext::BuildBoneChain( const Vector pos[], const Quaternion q[], int iBone, - matrix3x4_t *pBoneToWorld, + matrix3x4a_t *pBoneToWorld, CBoneBitList &boneComputed ) { Assert( m_pStudioHdr->boneFlags( iBone ) & m_boneMask ); @@ -3380,17 +3468,17 @@ void CIKContext::BuildBoneChain( //----------------------------------------------------------------------------- void BuildBoneChain( const CStudioHdr *pStudioHdr, - const matrix3x4_t &rootxform, + const matrix3x4a_t &rootxform, const Vector pos[], const Quaternion q[], int iBone, - matrix3x4_t *pBoneToWorld, + matrix3x4a_t *pBoneToWorld, CBoneBitList &boneComputed ) { if ( boneComputed.IsBoneMarked(iBone) ) return; - matrix3x4_t bonematrix; + matrix3x4a_t bonematrix; QuaternionMatrix( q[iBone], pos[iBone], bonematrix ); int parent = pStudioHdr->boneParent( iBone ); @@ -3624,7 +3712,7 @@ void CIKContext::ClearTargets( void ) // transform into a pos and q in parents bonespace //----------------------------------------------------------------------------- -void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneToWorld[], CBoneBitList &boneComputed ) +void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4a_t boneToWorld[], CBoneBitList &boneComputed ) { int i, j; @@ -3689,7 +3777,7 @@ void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneTo pTarget->est.floor = Lerp( pRule->flRuleWeight, pTarget->est.floor, pRule->floor ); pTarget->est.radius = Lerp( pRule->flRuleWeight, pTarget->est.radius, pRule->radius ); //pTarget->est.latched = Lerp( pRule->flRuleWeight, pTarget->est.latched, pRule->latched ); - pTarget->est.latched = MIN( pTarget->est.latched, pRule->latched ); + pTarget->est.latched = min( pTarget->est.latched, pRule->latched ); pTarget->est.release = Lerp( pRule->flRuleWeight, pTarget->est.release, pRule->release ); pTarget->est.flWeight = Lerp( pRule->flRuleWeight, pTarget->est.flWeight, pRule->flWeight ); } @@ -3707,7 +3795,7 @@ void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneTo if (pRule->latched > 0.0) pTarget->est.latched = 0.0; else - pTarget->est.latched = MIN( pTarget->est.latched, 1.0f - pRule->flWeight ); + pTarget->est.latched = min( pTarget->est.latched, 1.0f - pRule->flWeight ); } break; case IK_RELEASE: @@ -3716,7 +3804,7 @@ void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneTo if (pRule->latched > 0.0) pTarget->est.latched = 0.0; else - pTarget->est.latched = MIN( pTarget->est.latched, 1.0f - pRule->flWeight ); + pTarget->est.latched = min( pTarget->est.latched, 1.0f - pRule->flWeight ); pTarget->est.flWeight = (pTarget->est.flWeight) * (1 - pRule->flWeight * pRule->flRuleWeight); } @@ -3882,40 +3970,23 @@ void CIKContext::AutoIKRelease( void ) float ft = m_flTime - pTarget->error.flErrorTime; if (dt < 0.25) { - pTarget->error.ramp = MIN( pTarget->error.ramp + ft * 4.0, 1.0 ); + pTarget->error.ramp = min( pTarget->error.ramp + ft * 4.0, 1.0 ); } else { - pTarget->error.ramp = MAX( pTarget->error.ramp - ft * 4.0, 0.0 ); + pTarget->error.ramp = max( pTarget->error.ramp - ft * 4.0, 0.0 ); } if (pTarget->error.ramp > 0.0) { ikcontextikrule_t ikrule; - ikrule.index = -1; ikrule.chain = pTarget->chain; ikrule.bone = 0; ikrule.type = IK_RELEASE; ikrule.slot = i; - ikrule.height = 0.0f; - ikrule.radius = 0.0f; - ikrule.floor = 0.0f; - ikrule.pos = Vector(0.0f, 0.0f, 0.0f); - ikrule.q = Quaternion(0.0f, 0.0f, 0.0f, 0.0f); - ikrule.start = 0.0f; - ikrule.peak = 0.0f; - ikrule.tail = 0.0f; - ikrule.end = 0.0f; - ikrule.top = 0.0f; - ikrule.drop = 0.0f; - ikrule.commit = 0.0f; - ikrule.release = 0.0f; ikrule.flWeight = SimpleSpline( pTarget->error.ramp ); ikrule.flRuleWeight = 1.0; ikrule.latched = dt < 0.25 ? 0.0 : ikrule.flWeight; - ikrule.szLabel = NULL; - ikrule.kneeDir = Vector(0.0f, 0.0f, 0.0f); - ikrule.kneePos = Vector(0.0f, 0.0f, 0.0f); // don't bother with AutoIKRelease if the bone isn't going to be calculated // this code is crashing for some unknown reason. @@ -3946,22 +4017,22 @@ void CIKContext::AutoIKRelease( void ) } else { - DevWarning( 1, "AutoIKRelease (%s) got a NULL pBone %d\n", m_pStudioHdr->name(), bone ); + DevWarning( 1, "AutoIKRelease (%s) got a NULL pBone %d\n", m_pStudioHdr->pszName(), bone ); } } else { - DevWarning( 1, "AutoIKRelease (%s) got an out of range bone %d (%d)\n", m_pStudioHdr->name(), bone, m_pStudioHdr->numbones() ); + DevWarning( 1, "AutoIKRelease (%s) got an out of range bone %d (%d)\n", m_pStudioHdr->pszName(), bone, m_pStudioHdr->numbones() ); } } else { - DevWarning( 1, "AutoIKRelease (%s) got a NULL pchain %d\n", m_pStudioHdr->name(), pTarget->chain ); + DevWarning( 1, "AutoIKRelease (%s) got a NULL pchain %d\n", m_pStudioHdr->pszName(), pTarget->chain ); } } else { - DevWarning( 1, "AutoIKRelease (%s) got an out of range chain %d (%d)\n", m_pStudioHdr->name(), pTarget->chain, m_pStudioHdr->numikchains()); + DevWarning( 1, "AutoIKRelease (%s) got an out of range chain %d (%d)\n", m_pStudioHdr->pszName(), pTarget->chain, m_pStudioHdr->numikchains()); } } else @@ -3975,7 +4046,7 @@ void CIKContext::AutoIKRelease( void ) -void CIKContext::SolveDependencies( Vector pos[], Quaternion q[], matrix3x4_t boneToWorld[], CBoneBitList &boneComputed ) +void CIKContext::SolveDependencies( Vector pos[], Quaternion q[], matrix3x4a_t boneToWorld[], CBoneBitList &boneComputed ) { // ASSERT_NO_REENTRY(); @@ -4206,13 +4277,13 @@ void CIKContext::SolveAutoplayLocks( Quaternion q[] ) { - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int i; for (i = 0; i < m_ikLock.Count(); i++) { - const mstudioiklock_t &lock = m_pStudioHdr->pIKAutoplayLock( i ); + const mstudioiklock_t &lock = ((CStudioHdr *)m_pStudioHdr)->pIKAutoplayLock( i ); SolveLock( &lock, i, pos, q, boneToWorld, boneComputed ); } g_MatrixPool.Free( boneToWorld ); @@ -4230,7 +4301,7 @@ void CIKContext::SolveSequenceLocks( Quaternion q[] ) { - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int i; @@ -4255,7 +4326,7 @@ void CIKContext::AddAllLocks( Vector pos[], Quaternion q[] ) return; } - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int ikOffset = m_ikLock.AddMultipleToTail( m_pStudioHdr->GetNumIKChains() ); @@ -4307,7 +4378,7 @@ void CIKContext::SolveAllLocks( Quaternion q[] ) { - matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); + matrix3x4a_t *boneToWorld = g_MatrixPool.Alloc(); CBoneBitList boneComputed; int i; @@ -4336,7 +4407,7 @@ void CIKContext::SolveLock( int i, Vector pos[], Quaternion q[], - matrix3x4_t boneToWorld[], + matrix3x4a_t boneToWorld[], CBoneBitList &boneComputed ) { @@ -4386,18 +4457,15 @@ void CIKContext::SolveLock( //----------------------------------------------------------------------------- // Purpose: run all animations that automatically play and are driven off of poseParameters //----------------------------------------------------------------------------- -void CalcAutoplaySequences( - const CStudioHdr *pStudioHdr, - CIKContext *pIKContext, - Vector pos[], - Quaternion q[], - const float poseParameters[], - int boneMask, - float realTime - ) +void CBoneSetup::CalcAutoplaySequences( + Vector pos[], + Quaternion q[], + float flRealTime, + CIKContext *pIKContext + ) { -// ASSERT_NO_REENTRY(); - + // ASSERT_NO_REENTRY(); + int i; if ( pIKContext ) { @@ -4405,19 +4473,19 @@ void CalcAutoplaySequences( } unsigned short *pList = NULL; - int count = pStudioHdr->GetAutoplayList( &pList ); + int count = m_pStudioHdr->GetAutoplayList( &pList ); for (i = 0; i < count; i++) { int sequenceIndex = pList[i]; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( sequenceIndex ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)m_pStudioHdr)->pSeqdesc( sequenceIndex ); if (seqdesc.flags & STUDIO_AUTOPLAY) { float cycle = 0; - float cps = Studio_CPS( pStudioHdr, seqdesc, sequenceIndex, poseParameters ); - cycle = realTime * cps; + float cps = Studio_CPS( m_pStudioHdr, seqdesc, sequenceIndex, m_flPoseParameter ); + cycle = flRealTime * cps; cycle = cycle - (int)cycle; - AccumulatePose( pStudioHdr, NULL, pos, q, sequenceIndex, cycle, poseParameters, boneMask, 1.0, realTime ); + AccumulatePose( pos, q, sequenceIndex, cycle, 1.0, flRealTime, pIKContext ); } } @@ -4438,13 +4506,14 @@ void Studio_BuildMatrices( const Vector pos[], const Quaternion q[], int iBone, + float flScale, matrix3x4_t bonetoworld[MAXSTUDIOBONES], int boneMask ) { int i, j; - int chain[MAXSTUDIOBONES]; + int chain[MAXSTUDIOBONES] = {}; int chainlength = 0; if (iBone < -1 || iBone >= pStudioHdr->numbones()) @@ -4473,7 +4542,23 @@ void Studio_BuildMatrices( matrix3x4_t bonematrix; matrix3x4_t rotationmatrix; // model to world transformation - AngleMatrix( angles, origin, rotationmatrix); + AngleMatrix( angles, origin, rotationmatrix ); + + // Account for a change in scale + if ( flScale < 1.0f-FLT_EPSILON || flScale > 1.0f+FLT_EPSILON ) + { + Vector vecOffset; + MatrixGetColumn( rotationmatrix, 3, vecOffset ); + vecOffset -= origin; + vecOffset *= flScale; + vecOffset += origin; + MatrixSetColumn( vecOffset, 3, rotationmatrix ); + + // Scale it uniformly + VectorScale( rotationmatrix[0], flScale, rotationmatrix[0] ); + VectorScale( rotationmatrix[1], flScale, rotationmatrix[1] ); + VectorScale( rotationmatrix[2], flScale, rotationmatrix[2] ); + } for (j = chainlength - 1; j >= 0; j--) { @@ -4645,9 +4730,9 @@ void DoQuatInterpBone( { float dot = fabs( QuaternionDotProduct( pProc->pTrigger( i )->trigger, src ) ); // FIXME: a fast acos should be acceptable - dot = clamp( dot, -1, 1 ); + dot = clamp( dot, -1.f, 1.f ); weight[i] = 1 - (2 * acos( dot ) * pProc->pTrigger( i )->inv_tolerance ); - weight[i] = MAX( 0, weight[i] ); + weight[i] = max( 0, weight[i] ); scale += weight[i]; } @@ -4758,7 +4843,7 @@ void DoAimAtBone( if ( pStudioHdr ) { // This means it's AIMATATTACH - const mstudioattachment_t &attachment( pStudioHdr->pAttachment( pProc->aim ) ); + const mstudioattachment_t &attachment( ((CStudioHdr *)pStudioHdr)->pAttachment( pProc->aim ) ); ConcatTransforms( bonetoworld.GetBone( attachment.localbone ), attachment.local, @@ -4981,6 +5066,34 @@ float Studio_GetController( const CStudioHdr *pStudioHdr, int iController, float } +//----------------------------------------------------------------------------- +// Purpose: Calculates default values for the pose parameters +// Output: fills in an array +//----------------------------------------------------------------------------- + +void Studio_CalcDefaultPoseParameters( const CStudioHdr *pStudioHdr, float flPoseParameter[], int nCount ) +{ + int nPoseCount = pStudioHdr->GetNumPoseParameters(); + int nNumParams = MIN( nCount, MAXSTUDIOPOSEPARAM ); + + for ( int i = 0; i < nNumParams; ++i ) + { + // Default to middle of the pose parameter range + flPoseParameter[ i ] = 0.5f; + if ( i < nPoseCount ) + { + const mstudioposeparamdesc_t &Pose = ((CStudioHdr *)pStudioHdr)->pPoseParameter( i ); + + // Want to try for a zero state. If one doesn't exist set it to .5 by default. + if ( Pose.start < 0.0f && Pose.end > 0.0f ) + { + float flPoseDelta = Pose.end - Pose.start; + flPoseParameter[i] = -Pose.start / flPoseDelta; + } + } + } +} + //----------------------------------------------------------------------------- // Purpose: converts a ranged pose parameter value into a 0..1 encoded value // Output: ctlValue contains 0..1 encoding. @@ -4994,7 +5107,7 @@ float Studio_SetPoseParameter( const CStudioHdr *pStudioHdr, int iParameter, flo return 0; } - const mstudioposeparamdesc_t &PoseParam = pStudioHdr->pPoseParameter( iParameter ); + const mstudioposeparamdesc_t &PoseParam = ((CStudioHdr *)pStudioHdr)->pPoseParameter( iParameter ); Assert( IsFinite( flValue ) ); @@ -5029,12 +5142,12 @@ float Studio_GetPoseParameter( const CStudioHdr *pStudioHdr, int iParameter, flo return 0; } - const mstudioposeparamdesc_t &PoseParam = pStudioHdr->pPoseParameter( iParameter ); + const mstudioposeparamdesc_t &PoseParam = ((CStudioHdr *)pStudioHdr)->pPoseParameter( iParameter ); return ctlValue * (PoseParam.end - PoseParam.start) + PoseParam.start; } -#ifdef _MSC_VER +#ifdef _WIN32 #pragma warning (disable : 4701) #endif @@ -5043,6 +5156,7 @@ float Studio_GetPoseParameter( const CStudioHdr *pStudioHdr, int iParameter, flo //----------------------------------------------------------------------------- static int ClipRayToHitbox( const Ray_t &ray, mstudiobbox_t *pbox, matrix3x4_t& matrix, trace_t &tr ) { + const float flProjEpsilon = 0.01f; // scale by current t so hits shorten the ray and increase the likelihood of early outs Vector delta2; VectorScale( ray.m_Delta, (0.5f * tr.fraction), delta2 ); @@ -5085,29 +5199,42 @@ static int ClipRayToHitbox( const Ray_t &ray, mstudiobbox_t *pbox, matrix3x4_t& } // now check cross axes for separation - float tmp, cextent; + float tmp, tmpfix, cextent; Vector cross; CrossProduct( delta2, segmentCenter, cross ); cextent = cross.x * matrix[0][0] + cross.y * matrix[1][0] + cross.z * matrix[2][0]; cextent = fabsf(cextent); tmp = boxextents[1]*uextent[2] + boxextents[2]*uextent[1]; - if ( cextent > tmp ) + tmpfix = MAX(tmp, flProjEpsilon); + if ( cextent > tmpfix ) return -1; + +// if ( cextent > tmp && cextent <= tmpfix ) +// DevWarning( "ClipRayToHitbox trace precision error case\n" ); cextent = cross.x * matrix[0][1] + cross.y * matrix[1][1] + cross.z * matrix[2][1]; cextent = fabsf(cextent); tmp = boxextents[0]*uextent[2] + boxextents[2]*uextent[0]; - if ( cextent > tmp ) + tmpfix = MAX(tmp, flProjEpsilon); + if ( cextent > tmpfix ) return -1; +// if ( cextent > tmp && cextent <= tmpfix ) +// DevWarning( "ClipRayToHitbox trace precision error case\n" ); + cextent = cross.x * matrix[0][2] + cross.y * matrix[1][2] + cross.z * matrix[2][2]; cextent = fabsf(cextent); tmp = boxextents[0]*uextent[1] + boxextents[1]*uextent[0]; - if ( cextent > tmp ) + tmpfix = MAX(tmp, flProjEpsilon); + if ( cextent > tmpfix ) return -1; +// if ( cextent > tmp && cextent <= tmpfix ) +// DevWarning( "ClipRayToHitbox trace precision error case\n" ); + // !!! We hit this box !!! compute intersection point and return Vector start; + // Compute ray start in bone space VectorITransform( ray.m_Start, matrix, start ); // extent is delta2 in bone space, recompute delta in bone space @@ -5118,6 +5245,7 @@ static int ClipRayToHitbox( const Ray_t &ray, mstudiobbox_t *pbox, matrix3x4_t& trace_t boxTrace; if ( !IntersectRayWithBox( start, extent, pbox->bbmin, pbox->bbmax, 0.0f, &boxTrace ) ) return -1; + Assert( IsFinite(boxTrace.fraction) ); tr.fraction *= boxTrace.fraction; tr.startsolid = boxTrace.startsolid; @@ -5129,7 +5257,7 @@ static int ClipRayToHitbox( const Ray_t &ray, mstudiobbox_t *pbox, matrix3x4_t& return hitside; } -#ifdef _MSC_VER +#ifdef _WIN32 #pragma warning (default : 4701) #endif @@ -5154,6 +5282,7 @@ bool SweepBoxToStudio( IPhysicsSurfaceProps *pProps, const Ray_t& ray, CStudioHd if ( ( fBoneContents & fContentsMask ) == 0 ) continue; + //FIXME: Won't work with scaling! trace_t obbTrace; if ( IntersectRayWithOBB( clippedRay, *hitboxbones[pbox->bone], pbox->bbmin, pbox->bbmax, 0.0f, &obbTrace ) ) { @@ -5194,7 +5323,7 @@ bool SweepBoxToStudio( IPhysicsSurfaceProps *pProps, const Ray_t& ray, CStudioHd // Purpose: //----------------------------------------------------------------------------- bool TraceToStudio( IPhysicsSurfaceProps *pProps, const Ray_t& ray, CStudioHdr *pStudioHdr, mstudiohitboxset_t *set, - matrix3x4_t **hitboxbones, int fContentsMask, trace_t &tr ) + matrix3x4_t **hitboxbones, int fContentsMask, const Vector &vecOrigin, float flScale, trace_t &tr ) { if ( !ray.m_IsRay ) { @@ -5220,8 +5349,50 @@ bool TraceToStudio( IPhysicsSurfaceProps *pProps, const Ray_t& ray, CStudioHdr * // columns are axes of the bones in world space, translation is in world space matrix3x4_t& matrix = *hitboxbones[pbox->bone]; + + // Because we're sending in a matrix with scale data, and because the matrix inversion in the hitbox + // code does not handle that case, we pre-scale the bones and ray down here and do our collision checks + // in unscaled space. We can then rescale the results afterwards. + + int side = -1; + if ( flScale < 1.0f-FLT_EPSILON || flScale > 1.0f+FLT_EPSILON ) + { + matrix3x4_t matScaled; + MatrixCopy( matrix, matScaled ); + + float invScale = 1.0f / flScale; + + Vector vecBoneOrigin; + MatrixGetColumn( matScaled, 3, vecBoneOrigin ); + + // Pre-scale the origin down + Vector vecNewOrigin = vecBoneOrigin - vecOrigin; + vecNewOrigin *= invScale; + vecNewOrigin += vecOrigin; + MatrixSetColumn( vecNewOrigin, 3, matScaled ); + + // Scale it uniformly + VectorScale( matScaled[0], invScale, matScaled[0] ); + VectorScale( matScaled[1], invScale, matScaled[1] ); + VectorScale( matScaled[2], invScale, matScaled[2] ); + + // Pre-scale our ray as well + Vector vecRayStart = ray.m_Start - vecOrigin; + vecRayStart *= invScale; + vecRayStart += vecOrigin; + + Vector vecRayDelta = ray.m_Delta * invScale; + + Ray_t newRay; + newRay.Init( vecRayStart, vecRayStart + vecRayDelta ); + + side = ClipRayToHitbox( newRay, pbox, matScaled, tr ); + } + else + { + side = ClipRayToHitbox( ray, pbox, matrix, tr ); + } - int side = ClipRayToHitbox( ray, pbox, matrix, tr ); if ( side >= 0 ) { hitbox = i; @@ -5289,16 +5460,16 @@ void Studio_SeqAnims( const CStudioHdr *pStudioHdr, mstudioseqdesc_t &seqdesc, i Studio_LocalPoseParameter( pStudioHdr, poseParameter, seqdesc, iSequence, 0, s0, i0 ); Studio_LocalPoseParameter( pStudioHdr, poseParameter, seqdesc, iSequence, 1, s1, i1 ); - panim[0] = &pStudioHdr->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0 , i1 ) ) ); + panim[0] = &((CStudioHdr *)pStudioHdr)->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0 , i1 ) ) ); weight[0] = (1 - s0) * (1 - s1); - panim[1] = &pStudioHdr->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0+1, i1 ) ) ); + panim[1] = &((CStudioHdr *)pStudioHdr)->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0+1, i1 ) ) ); weight[1] = (s0) * (1 - s1); - panim[2] = &pStudioHdr->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0 , i1+1 ) ) ); + panim[2] = &((CStudioHdr *)pStudioHdr)->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0 , i1+1 ) ) ); weight[2] = (1 - s0) * (s1); - panim[3] = &pStudioHdr->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0+1, i1+1 ) ) ); + panim[3] = &((CStudioHdr *)pStudioHdr)->pAnimdesc( pStudioHdr->iRelativeAnim( iSequence, seqdesc.anim( i0+1, i1+1 ) ) ); weight[3] = (s0) * (s1); Assert( weight[0] >= 0.0f && weight[1] >= 0.0f && weight[2] >= 0.0f && weight[3] >= 0.0f ); @@ -5313,7 +5484,7 @@ int Studio_MaxFrame( const CStudioHdr *pStudioHdr, int iSequence, const float po mstudioanimdesc_t *panim[4]; float weight[4]; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ); Studio_SeqAnims( pStudioHdr, seqdesc, iSequence, poseParameter, panim, weight ); float maxFrame = 0; @@ -5330,7 +5501,7 @@ int Studio_MaxFrame( const CStudioHdr *pStudioHdr, int iSequence, const float po // FIXME: why does the weights sometimes not exactly add it 1.0 and this sometimes rounds down? - return static_cast(maxFrame + 0.01); + return (maxFrame + 0.01); } @@ -5343,7 +5514,7 @@ float Studio_FPS( const CStudioHdr *pStudioHdr, int iSequence, const float poseP mstudioanimdesc_t *panim[4]; float weight[4]; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ); Studio_SeqAnims( pStudioHdr, seqdesc, iSequence, poseParameter, panim, weight ); float t = 0; @@ -5388,7 +5559,7 @@ float Studio_CPS( const CStudioHdr *pStudioHdr, mstudioseqdesc_t &seqdesc, int i float Studio_Duration( const CStudioHdr *pStudioHdr, int iSequence, const float poseParameter[] ) { - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ); float cps = Studio_CPS( pStudioHdr, seqdesc, iSequence, poseParameter ); if( cps == 0 ) @@ -5574,7 +5745,7 @@ bool Studio_SeqMovement( const CStudioHdr *pStudioHdr, int iSequence, float flCy mstudioanimdesc_t *panim[4]; float weight[4]; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ); Studio_SeqAnims( pStudioHdr, seqdesc, iSequence, poseParameter, panim, weight ); @@ -5609,6 +5780,13 @@ bool Studio_SeqMovement( const CStudioHdr *pStudioHdr, int iSequence, float flCy return found; } +float Studio_SeqMovementAndDuration( const CStudioHdr *pStudioHdr, int iSequence, float flCycleFrom, float flCycleTo, const float poseParameter[], Vector &deltaPos ) +{ + QAngle deltaAngles; + Studio_SeqMovement( pStudioHdr, iSequence, flCycleFrom, flCycleTo, poseParameter, deltaPos, deltaAngles ); + + return Studio_Duration( pStudioHdr, iSequence, poseParameter ); +} //----------------------------------------------------------------------------- // Purpose: calculate instantaneous velocity in ips at a given point in the sequence's cycle @@ -5621,7 +5799,7 @@ bool Studio_SeqVelocity( const CStudioHdr *pStudioHdr, int iSequence, float flCy mstudioanimdesc_t *panim[4]; float weight[4]; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ); Studio_SeqAnims( pStudioHdr, seqdesc, iSequence, poseParameter, panim, weight ); vecVelocity.Init( ); @@ -5653,7 +5831,7 @@ float Studio_FindSeqDistance( const CStudioHdr *pStudioHdr, int iSequence, const mstudioanimdesc_t *panim[4]; float weight[4]; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ); Studio_SeqAnims( pStudioHdr, seqdesc, iSequence, poseParameter, panim, weight ); float flCycle = 0; @@ -5680,7 +5858,7 @@ int Studio_FindAttachment( const CStudioHdr *pStudioHdr, const char *pAttachment // Extract the bone index from the name for (int i = 0; i < pStudioHdr->GetNumAttachments(); i++) { - if (!stricmp(pAttachmentName,pStudioHdr->pAttachment(i).pszName( ))) + if (!V_stricmp(pAttachmentName,((CStudioHdr *)pStudioHdr)->pAttachment(i).pszName( ))) { return i; } @@ -5704,7 +5882,7 @@ int Studio_FindRandomAttachment( const CStudioHdr *pStudioHdr, const char *pAtta // Extract the bone index from the name for (int i = 0; i < pStudioHdr->GetNumAttachments(); i++) { - if ( strstr( pStudioHdr->pAttachment(i).pszName(), pAttachmentName ) ) + if ( strstr( ((CStudioHdr *)pStudioHdr)->pAttachment(i).pszName(), pAttachmentName ) ) { matchingAttachments.AddToTail(i); } @@ -5724,28 +5902,32 @@ int Studio_FindRandomAttachment( const CStudioHdr *pStudioHdr, const char *pAtta int Studio_BoneIndexByName( const CStudioHdr *pStudioHdr, const char *pName ) { - // binary search for the bone matching pName - int start = 0, end = pStudioHdr->numbones()-1; - const byte *pBoneTable = pStudioHdr->GetBoneTableSortedByName(); - mstudiobone_t *pbones = pStudioHdr->pBone( 0 ); - while (start <= end) + if ( pStudioHdr ) { - int mid = (start + end) >> 1; - int cmp = Q_stricmp( pbones[pBoneTable[mid]].pszName(), pName ); - - if ( cmp < 0 ) + // binary search for the bone matching pName + int start = 0, end = pStudioHdr->numbones()-1; + const byte *pBoneTable = pStudioHdr->GetBoneTableSortedByName(); + mstudiobone_t *pbones = pStudioHdr->pBone( 0 ); + while (start <= end) { - start = mid + 1; - } - else if ( cmp > 0 ) - { - end = mid - 1; - } - else - { - return pBoneTable[mid]; + int mid = (start + end) >> 1; + int cmp = Q_stricmp( pbones[pBoneTable[mid]].pszName(), pName ); + + if ( cmp < 0 ) + { + start = mid + 1; + } + else if ( cmp > 0 ) + { + end = mid - 1; + } + else + { + return pBoneTable[mid]; + } } } + return -1; } @@ -5769,7 +5951,7 @@ const char *Studio_GetKeyValueText( const CStudioHdr *pStudioHdr, int iSequence { if (iSequence >= 0 && iSequence < pStudioHdr->GetNumSeq()) { - return pStudioHdr->pSeqdesc( iSequence ).KeyValueText(); + return ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ).KeyValueText(); } } return NULL; @@ -5778,16 +5960,16 @@ const char *Studio_GetKeyValueText( const CStudioHdr *pStudioHdr, int iSequence bool Studio_PrefetchSequence( const CStudioHdr *pStudioHdr, int iSequence ) { bool pendingload = false; - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( iSequence ); int size0 = seqdesc.groupsize[ 0 ]; int size1 = seqdesc.groupsize[ 1 ]; for ( int i = 0; i < size0; ++i ) { for ( int j = 0; j < size1; ++j ) { - mstudioanimdesc_t &animdesc = pStudioHdr->pAnimdesc( seqdesc.anim( i, j ) ); + mstudioanimdesc_t &animdesc = ((CStudioHdr *)pStudioHdr)->pAnimdesc( seqdesc.anim( i, j ) ); int iFrame = 0; - mstudioanim_t *panim = animdesc.pAnim( &iFrame ); + byte *panim = animdesc.pAnim( &iFrame ); if ( !panim ) { pendingload = true; @@ -5798,3 +5980,81 @@ bool Studio_PrefetchSequence( const CStudioHdr *pStudioHdr, int iSequence ) // Everything for this sequence is resident? return !pendingload; } + + +//----------------------------------------------------------------------------- +// Purpose: Drive a flex controller from a component of a bone +//----------------------------------------------------------------------------- +void Studio_RunBoneFlexDrivers( float *pflFlexControllerWeights, const CStudioHdr *pStudioHdr, const Vector *pvPositions, const matrix3x4_t *pBoneToWorld, const matrix3x4_t &mRootToWorld ) +{ + bool bRootToWorldInvComputed = false; + matrix3x4_t mRootToWorldInv; + matrix3x4_t mParentInv; + matrix3x4_t mBoneLocal; + + const int nBoneFlexDriverCount = pStudioHdr->BoneFlexDriverCount(); + + for ( int i = 0; i < nBoneFlexDriverCount; ++i ) + { + const mstudioboneflexdriver_t *pBoneFlexDriver = pStudioHdr->BoneFlexDriver( i ); + const mstudiobone_t *pStudioBone = pStudioHdr->pBone( pBoneFlexDriver->m_nBoneIndex ); + + const int nControllerCount = pBoneFlexDriver->m_nControlCount; + + if ( pStudioBone->flags & BONE_USED_BY_BONE_MERGE ) + { + // The local space version of the bone is not available if this is a bonemerged bone + // so do the slow computation of the local version of the bone from boneToWorld + + if ( pStudioBone->parent < 0 ) + { + if ( !bRootToWorldInvComputed ) + { + MatrixInvert( mRootToWorld, mRootToWorldInv ); + bRootToWorldInvComputed = true; + } + + MatrixMultiply( mRootToWorldInv, pBoneToWorld[ pBoneFlexDriver->m_nBoneIndex ], mBoneLocal ); + } + else + { + MatrixInvert( pBoneToWorld[ pStudioBone->parent ], mParentInv ); + MatrixMultiply( mParentInv, pBoneToWorld[ pBoneFlexDriver->m_nBoneIndex ], mBoneLocal ); + } + + for ( int j = 0; j < nControllerCount; ++j ) + { + const mstudioboneflexdrivercontrol_t *pController = pBoneFlexDriver->pBoneFlexDriverControl( j ); + const mstudioflexcontroller_t *pFlexController = pStudioHdr->pFlexcontroller( static_cast< LocalFlexController_t >( pController->m_nFlexControllerIndex ) ); + + if ( pFlexController->localToGlobal < 0 ) + continue; + + Assert( pController->m_nFlexControllerIndex >= 0 && pController->m_nFlexControllerIndex < pStudioHdr->numflexcontrollers() ); + Assert( pController->m_nBoneComponent >= 0 && pController->m_nBoneComponent <= 2 ); + pflFlexControllerWeights[pFlexController->localToGlobal] = + RemapValClamped( mBoneLocal[pController->m_nBoneComponent][3], pController->m_flMin, pController->m_flMax, 0.0f, 1.0f ); + } + } + else + { + // Use the local space version of the bone directly for non-bonemerged bones + + const Vector &position = pvPositions[ pBoneFlexDriver->m_nBoneIndex ]; + + for ( int j = 0; j < nControllerCount; ++j ) + { + const mstudioboneflexdrivercontrol_t *pController = pBoneFlexDriver->pBoneFlexDriverControl( j ); + const mstudioflexcontroller_t *pFlexController = pStudioHdr->pFlexcontroller( static_cast< LocalFlexController_t >( pController->m_nFlexControllerIndex ) ); + + if ( pFlexController->localToGlobal < 0 ) + continue; + + Assert( pController->m_nFlexControllerIndex >= 0 && pController->m_nFlexControllerIndex < pStudioHdr->numflexcontrollers() ); + Assert( pController->m_nBoneComponent >= 0 && pController->m_nBoneComponent <= 2 ); + pflFlexControllerWeights[pFlexController->localToGlobal] = + RemapValClamped( position[pController->m_nBoneComponent], pController->m_flMin, pController->m_flMax, 0.0f, 1.0f ); + } + } + } +} diff --git a/public/bone_setup.h b/public/bone_setup.h index f4e0fd03c..e8b3e103e 100644 --- a/public/bone_setup.h +++ b/public/bone_setup.h @@ -20,6 +20,7 @@ class CBoneToWorld; class CIKContext; class CBoneAccessor; +class IPoseDebugger; // This provides access to networked arrays, so if this code actually changes a value, @@ -47,8 +48,6 @@ class CBoneBitList : public CBitVec }; - - //----------------------------------------------------------------------------- // Purpose: blends together all the bones from two p:q lists // @@ -61,67 +60,29 @@ void SlerpBones( Vector pos1[MAXSTUDIOBONES], mstudioseqdesc_t &seqdesc, // source of q2 and pos2 int sequence, - const Quaternion q2[MAXSTUDIOBONES], + const QuaternionAligned q2[MAXSTUDIOBONES], const Vector pos2[MAXSTUDIOBONES], float s, int boneMask ); -void InitPose( - const CStudioHdr *pStudioHdr, - Vector pos[], - Quaternion q[], - int boneMask - ); - -void CalcPose( - const CStudioHdr *pStudioHdr, - CIKContext *pIKContext, //optional - Vector pos[], - Quaternion q[], - int sequence, - float cycle, - const float poseParameter[], - int boneMask, - float flWeight = 1.0f, - float flTime = 0.0f - ); - -bool CalcPoseSingle( - const CStudioHdr *pStudioHdr, - Vector pos[], - Quaternion q[], - mstudioseqdesc_t &seqdesc, - int sequence, - float cycle, - const float poseParameter[], - int boneMask, - float flTime - ); - -void AccumulatePose( - const CStudioHdr *pStudioHdr, - CIKContext *pIKContext, //optional - Vector pos[], - Quaternion q[], - int sequence, - float cycle, - const float poseParameter[], - int boneMask, - float flWeight, - float flTime - ); +class CBoneSetup; +class IBoneSetup +{ +public: + IBoneSetup( const CStudioHdr *pStudioHdr, int boneMask, const float poseParameter[], IPoseDebugger *pPoseDebugger = NULL ); + ~IBoneSetup( void ); + void InitPose( Vector pos[], QuaternionAligned q[] ); + void AccumulatePose( Vector pos[], Quaternion q[], int sequence, float cycle, float flWeight, float flTime, CIKContext *pIKContext ); + void CalcAutoplaySequences( Vector pos[], Quaternion q[], float flRealTime, CIKContext *pIKContext ); + void CalcBoneAdj( Vector pos[], Quaternion q[], const float controllers[] ); -// takes a "controllers[]" array normalized to 0..1 and adds in the adjustments to pos[], and q[]. -void CalcBoneAdj( - const CStudioHdr *pStudioHdr, - Vector pos[], - Quaternion q[], - const float controllers[], - int boneMask - ); + CStudioHdr *GetStudioHdr(); +private: + CBoneSetup *m_pBoneSetup; +}; // Given two samples of a bone separated in time by dt, // compute the velocity and angular velocity of that bone @@ -142,19 +103,19 @@ void SetupSingleBoneMatrix( // Purpose: build boneToWorld transforms for a specific bone void BuildBoneChain( const CStudioHdr *pStudioHdr, - const matrix3x4_t &rootxform, + const matrix3x4a_t &rootxform, const Vector pos[], const Quaternion q[], int iBone, - matrix3x4_t *pBoneToWorld ); + matrix3x4a_t *pBoneToWorld ); void BuildBoneChain( const CStudioHdr *pStudioHdr, - const matrix3x4_t &rootxform, + const matrix3x4a_t &rootxform, const Vector pos[], const Quaternion q[], int iBone, - matrix3x4_t *pBoneToWorld, + matrix3x4a_t *pBoneToWorld, CBoneBitList &boneComputed ); @@ -220,7 +181,7 @@ class CIKTarget private: // internally latched footset, position struct x1 { - // matrix3x4_t worldTarget; + // matrix3x4a_t worldTarget; bool bNeedsLatch; bool bHasLatch; float influence; @@ -300,11 +261,11 @@ struct ikcontextikrule_t }; -void Studio_AlignIKMatrix( matrix3x4_t &mMat, const Vector &vAlignTo ); +void Studio_AlignIKMatrix( matrix3x4a_t &mMat, const Vector &vAlignTo ); -bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, matrix3x4_t* pBoneToWorld ); +bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, matrix3x4a_t* pBoneToWorld ); -bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vector &targetKneePos, Vector &targetKneeDir, matrix3x4_t* pBoneToWorld ); +bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vector &targetKneePos, Vector &targetKneeDir, matrix3x4a_t* pBoneToWorld ); @@ -316,9 +277,9 @@ class CIKContext void AddDependencies( mstudioseqdesc_t &seqdesc, int iSequence, float flCycle, const float poseParameters[], float flWeight = 1.0f ); void ClearTargets( void ); - void UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneToWorld[], CBoneBitList &boneComputed ); + void UpdateTargets( Vector pos[], Quaternion q[], matrix3x4a_t boneToWorld[], CBoneBitList &boneComputed ); void AutoIKRelease( void ); - void SolveDependencies( Vector pos[], Quaternion q[], matrix3x4_t boneToWorld[], CBoneBitList &boneComputed ); + void SolveDependencies( Vector pos[], Quaternion q[], matrix3x4a_t boneToWorld[], CBoneBitList &boneComputed ); void AddAutoplayLocks( Vector pos[], Quaternion q[] ); void SolveAutoplayLocks( Vector pos[], Quaternion q[] ); @@ -329,7 +290,7 @@ class CIKContext void AddAllLocks( Vector pos[], Quaternion q[] ); void SolveAllLocks( Vector pos[], Quaternion q[] ); - void SolveLock( const mstudioiklock_t *plock, int i, Vector pos[], Quaternion q[], matrix3x4_t boneToWorld[], CBoneBitList &boneComputed ); + void SolveLock( const mstudioiklock_t *plock, int i, Vector pos[], Quaternion q[], matrix3x4a_t boneToWorld[], CBoneBitList &boneComputed ); CUtlVectorFixed< CIKTarget, 12 > m_target; @@ -338,12 +299,12 @@ class CIKContext CStudioHdr const *m_pStudioHdr; bool Estimate( int iSequence, float flCycle, int iTarget, const float poseParameter[], float flWeight = 1.0f ); - void BuildBoneChain( const Vector pos[], const Quaternion q[], int iBone, matrix3x4_t *pBoneToWorld, CBoneBitList &boneComputed ); + void BuildBoneChain( const Vector pos[], const Quaternion q[], int iBone, matrix3x4a_t *pBoneToWorld, CBoneBitList &boneComputed ); // virtual IK rules, filtered and combined from each sequence CUtlVector< CUtlVector< ikcontextikrule_t > > m_ikChainRule; CUtlVector< ikcontextikrule_t > m_ikLock; - matrix3x4_t m_rootxform; + matrix3x4a_t m_rootxform; int m_iFramecounter; float m_flTime; @@ -355,16 +316,6 @@ class CIKContext // Purpose: //----------------------------------------------------------------------------- -// takes a "poseparameters[]" array normalized to 0..1 and layers on the sequences driven by them -void CalcAutoplaySequences( - const CStudioHdr *pStudioHdr, - CIKContext *pIKContext, //optional - Vector pos[], - Quaternion q[], - const float poseParameters[], - int boneMask, - float time - ); // replaces the bonetoworld transforms for all bones that are procedural bool CalcProceduralBone( @@ -380,7 +331,8 @@ void Studio_BuildMatrices( const Vector pos[], const Quaternion q[], int iBone, - matrix3x4_t bonetoworld[MAXSTUDIOBONES], + float flScale, + matrix3x4a_t bonetoworld[MAXSTUDIOBONES], int boneMask ); @@ -401,6 +353,7 @@ float Studio_SetController( const CStudioHdr *pStudioHdr, int iController, float // return value = value in bone space float Studio_GetController( const CStudioHdr *pStudioHdr, int iController, float ctlValue ); +void Studio_CalcDefaultPoseParameters( const CStudioHdr *pStudioHdr, float flPoseParameter[MAXSTUDIOPOSEPARAM], int nCount ); float Studio_GetPoseParameter( const CStudioHdr *pStudioHdr, int iParameter, float ctlValue ); float Studio_SetPoseParameter( const CStudioHdr *pStudioHdr, int iParameter, float flValue, float &ctlValue ); @@ -413,6 +366,7 @@ float Studio_FPS( const CStudioHdr *pStudioHdr, int iSequence, const float poseP float Studio_CPS( const CStudioHdr *pStudioHdr, mstudioseqdesc_t &seqdesc, int iSequence, const float poseParameter[] ); float Studio_Duration( const CStudioHdr *pStudioHdr, int iSequence, const float poseParameter[] ); void Studio_MovementRate( const CStudioHdr *pStudioHdr, int iSequence, const float poseParameter[], Vector *pVec ); +float Studio_SeqMovementAndDuration( const CStudioHdr *pStudioHdr, int iSequence, float flCycleFrom, float flCycleTo, const float poseParameter[], Vector &deltaPos ); // void Studio_Movement( const CStudioHdr *pStudioHdr, int iSequence, const float poseParameter[], Vector *pVec ); @@ -435,7 +389,7 @@ FORWARD_DECLARE_HANDLE( memhandle_t ); struct bonecacheparams_t { CStudioHdr *pStudioHdr; - matrix3x4_t *pBoneToWorld; + matrix3x4a_t *pBoneToWorld; float curtime; int boneMask; }; @@ -461,7 +415,7 @@ class CBoneCache void Init( const bonecacheparams_t ¶ms, unsigned int size, short *pStudioToCached, short *pCachedToStudio, int cachedBoneCount ); void UpdateBones( const matrix3x4_t *pBoneToWorld, int numbones, float curtime ); - matrix3x4_t *GetCachedBone( int studioIndex ); + matrix3x4a_t *GetCachedBone( int studioIndex ); void ReadCachedBones( matrix3x4_t *pBoneToWorld ); void ReadCachedBonePointers( matrix3x4_t **bones, int numbones ); @@ -472,7 +426,7 @@ class CBoneCache int m_boneMask; private: - matrix3x4_t *BoneArray(); + matrix3x4a_t *BoneArray(); short *StudioToCached(); short *CachedToStudio(); @@ -483,18 +437,89 @@ class CBoneCache unsigned short m_boneOutOffset; }; -CBoneCache *Studio_GetBoneCache( memhandle_t cacheHandle ); +void Studio_LockBoneCache(); +void Studio_UnlockBoneCache(); + +CBoneCache *Studio_GetBoneCache( memhandle_t cacheHandle, bool bLock = false ); +void Studio_ReleaseBoneCache( memhandle_t cacheHandle ); memhandle_t Studio_CreateBoneCache( bonecacheparams_t ¶ms ); void Studio_DestroyBoneCache( memhandle_t cacheHandle ); void Studio_InvalidateBoneCache( memhandle_t cacheHandle ); // Given a ray, trace for an intersection with this studiomodel. Get the array of bones from StudioSetupHitboxBones -bool TraceToStudio( class IPhysicsSurfaceProps *pProps, const Ray_t& ray, CStudioHdr *pStudioHdr, mstudiohitboxset_t *set, matrix3x4_t **hitboxbones, int fContentsMask, trace_t &trace ); - +bool TraceToStudio( class IPhysicsSurfaceProps *pProps, const Ray_t& ray, CStudioHdr *pStudioHdr, mstudiohitboxset_t *set, matrix3x4_t **hitboxbones, int fContentsMask, const Vector &vecOrigin, float flScale, trace_t &trace ); +// TERROR: TraceToStudio variant that prioritizes hitgroups, so bullets can pass through arms and chest to hit the head, for instance +bool TraceToStudioGrouped( IPhysicsSurfaceProps *pProps, const Ray_t& ray, CStudioHdr *pStudioHdr, mstudiohitboxset_t *set, + matrix3x4_t **hitboxbones, int fContentsMask, trace_t &tr, const CUtlVector< int > &sortedHitgroups ); void QuaternionSM( float s, const Quaternion &p, const Quaternion &q, Quaternion &qt ); void QuaternionMA( const Quaternion &p, float s, const Quaternion &q, Quaternion &qt ); bool Studio_PrefetchSequence( const CStudioHdr *pStudioHdr, int iSequence ); -#endif // BONE_SETUP_H +void Studio_RunBoneFlexDrivers( float *pFlexController, const CStudioHdr *pStudioHdr, const Vector *pPositions, const matrix3x4_t *pBoneToWorld, const matrix3x4_t &mRootToWorld ); + +//----------------------------------------------------------------------------- +// Computes a number of twist bones given a parent/child pair +// pqTwists, pflWeights, pqTwistBinds must all have at least nCount elements +//----------------------------------------------------------------------------- +void ComputeTwistBones( + Quaternion *pqTwists, + int nCount, + bool bInverse, + const Vector &vUp, + const Quaternion &qParent, + const matrix3x4_t &mChild, + const Quaternion &qBaseInv, + const float *pflWeights, + const Quaternion *pqTwistBinds ); + + + +//----------------------------------------------------------------------------- +// Find the non-linear transforms that fit a model with attachments to another model with attachments +//----------------------------------------------------------------------------- + +class CAttachmentFit +{ +public: + CAttachmentFit() { + m_bHasConverged = false; + m_localCenter.Init(); + m_posError.Init(); + m_bHasPosition = false; + m_scaleError.Init(); + m_rotError = quat_identity; + }; + + void LocalTransform( const matrix3x4_t &matFollowBoneToWorld, matrix3x4_t &matLocalBoneToWorld ); + + int m_nFollowBone; // bone to follow, as taken from attachment matches + CUtlVector< int > m_nLocalAtt; // index of local attachments + CUtlVector< int > m_nFollowAtt; // index of attachments that are being followed + + bool m_bHasConverged; // solution for this bone converged + Vector m_localCenter; // idealized rotation center of attachments + Vector m_posError; // accumulated position error to add to transform + bool m_bHasPosition; // flag to not calc rotation/scale until position error has been estimated + Vector m_scaleError; // accumulated axis independant scale error (relative to 1) + Quaternion m_rotError; // accumulated rotation error +}; + +class CAttachmentFitter +{ +public: + CAttachmentFitter( CStudioHdr *pStudioHdr, CStudioHdr *pFollowParent ); + bool Converg( const matrix3x4_t *pFollowBoneToWorld, matrix3x4_t *pLocalBoneToWorld ); + bool LocalTransform( int iBone, const matrix3x4_t *pFollowBoneToWorld, matrix3x4_t *pLocalBoneToWorld ); + bool IsValid( void ) { return (m_pFits.Count() > 0); } + +private: + bool m_bHasConverged; + CStudioHdr *m_pLocalHdr; + CStudioHdr *m_pFollowHdr; + + CUtlVector< CAttachmentFit *> m_pFits; // indexed by bones +}; + +#endif // BONE_SETUP_H \ No newline at end of file diff --git a/public/cmodel.h b/public/cmodel.h index b86a44231..c848c4701 100644 --- a/public/cmodel.h +++ b/public/cmodel.h @@ -71,7 +71,7 @@ struct Ray_t void Init( Vector const& start, Vector const& end ) { - Assert( &end ); + //Assert( &end ); VectorSubtract( end, start, m_Delta ); m_IsSwept = (m_Delta.LengthSqr() != 0); @@ -87,7 +87,7 @@ struct Ray_t void Init( Vector const& start, Vector const& end, Vector const& mins, Vector const& maxs ) { - Assert( &end ); + //Assert( &end ); VectorSubtract( end, start, m_Delta ); m_pWorldAxisTransform = NULL; diff --git a/public/collisionutils.cpp b/public/collisionutils.cpp index c3013299b..6ee8f846f 100644 --- a/public/collisionutils.cpp +++ b/public/collisionutils.cpp @@ -1374,6 +1374,14 @@ bool IntersectRayWithOBB( const Vector &vecRayStart, const Vector &vecRayDelta, if ( !IntersectRayWithBox( start, extent, vecOBBMins, vecOBBMaxs, flTolerance, pTrace ) ) return false; + // Fix up the start/end pos and fraction + Vector vecTemp; + VectorTransform( pTrace->endpos, matOBBToWorld, vecTemp ); + pTrace->endpos = vecTemp; + + pTrace->startpos = vecRayStart; + pTrace->fraction *= 2.0f; + // Fix up the plane information float flSign = pTrace->plane.normal[ pTrace->plane.type ]; pTrace->plane.normal[0] = flSign * matOBBToWorld[0][pTrace->plane.type]; @@ -1381,6 +1389,7 @@ bool IntersectRayWithOBB( const Vector &vecRayStart, const Vector &vecRayDelta, pTrace->plane.normal[2] = flSign * matOBBToWorld[2][pTrace->plane.type]; pTrace->plane.dist = DotProduct( pTrace->endpos, pTrace->plane.normal ); pTrace->plane.type = 3; + return true; } @@ -1917,9 +1926,9 @@ QuadBarycentricRetval_t PointInQuadToBarycentric( const Vector &v1, const Vector // NOTE: axisU[0][projAxes[0]] < axisU[0][projAxes[1]], // this is done to decrease error when dividing later // - if( FloatMakePositive( axisU[0][(int)projAxes[0]] ) < FloatMakePositive( axisU[0][(int)projAxes[1]] ) ) + if( FloatMakePositive( axisU[0][projAxes[0]] ) < FloatMakePositive( axisU[0][projAxes[1]] ) ) { - int tmp = (int)projAxes[0]; + int tmp = projAxes[0]; projAxes[0] = projAxes[1]; projAxes[1] = tmp; } @@ -1948,21 +1957,21 @@ QuadBarycentricRetval_t PointInQuadToBarycentric( const Vector &v1, const Vector double s = 0.0, t = 0.0; double A, negB, C; - A = ( axisU[0][(int)projAxes[1]] * axisV[0][(int)projAxes[0]] ) - - ( axisU[0][(int)projAxes[0]] * axisV[0][(int)projAxes[1]] ) - - ( axisU[1][(int)projAxes[1]] * axisV[0][(int)projAxes[0]] ) + - ( axisU[1][(int)projAxes[0]] * axisV[0][(int)projAxes[1]] ); - C = ( v1[(int)projAxes[1]] * axisU[0][(int)projAxes[0]] ) - - ( point[(int)projAxes[1]] * axisU[0][(int)projAxes[0]] ) - - ( v1[(int)projAxes[0]] * axisU[0][(int)projAxes[1]] ) + - ( point[(int)projAxes[0]] * axisU[0][(int)projAxes[1]] ); + A = ( axisU[0][projAxes[1]] * axisV[0][projAxes[0]] ) - + ( axisU[0][projAxes[0]] * axisV[0][projAxes[1]] ) - + ( axisU[1][projAxes[1]] * axisV[0][projAxes[0]] ) + + ( axisU[1][projAxes[0]] * axisV[0][projAxes[1]] ); + C = ( v1[projAxes[1]] * axisU[0][projAxes[0]] ) - + ( point[projAxes[1]] * axisU[0][projAxes[0]] ) - + ( v1[projAxes[0]] * axisU[0][projAxes[1]] ) + + ( point[projAxes[0]] * axisU[0][projAxes[1]] ); negB = C - - ( v1[(int)projAxes[1]] * axisU[1][(int)projAxes[0]] ) + - ( point[(int)projAxes[1]] * axisU[1][(int)projAxes[0]] ) + - ( v1[(int)projAxes[0]] * axisU[1][(int)projAxes[1]] ) - - ( point[(int)projAxes[0]] * axisU[1][(int)projAxes[1]] ) + - ( axisU[0][(int)projAxes[1]] * axisV[0][(int)projAxes[0]] ) - - ( axisU[0][(int)projAxes[0]] * axisV[0][(int)projAxes[1]] ); + ( v1[projAxes[1]] * axisU[1][projAxes[0]] ) + + ( point[projAxes[1]] * axisU[1][projAxes[0]] ) + + ( v1[projAxes[0]] * axisU[1][projAxes[1]] ) - + ( point[projAxes[0]] * axisU[1][projAxes[1]] ) + + ( axisU[0][projAxes[1]] * axisV[0][projAxes[0]] ) - + ( axisU[0][projAxes[0]] * axisV[0][projAxes[1]] ); if( ( A > -PIQ_PLANE_EPSILON ) && ( A < PIQ_PLANE_EPSILON ) ) { @@ -2008,7 +2017,7 @@ QuadBarycentricRetval_t PointInQuadToBarycentric( const Vector &v1, const Vector double QPlus = ( negB + quad ) / ( 2.0f * A ); double QMinus = ( negB - quad ) / ( 2.0f * A ); - ResolveQuadratic( QPlus, QMinus, axisU[0], axisU[1], axisV[0], axisV[1], v1, point, (int)projAxes[0], s, t ); + ResolveQuadratic( QPlus, QMinus, axisU[0], axisU[1], axisV[0], axisV[1], v1, point, projAxes[0], s, t ); } if( !bFlipped ) @@ -3250,4 +3259,148 @@ bool RayHasFullyContainedIntersectionWithQuad( const Ray_t &ray, return true; //there were lines crossing the quad plane, and every line crossing that plane had its intersection with the plane within the quad's boundaries } +//----------------------------------------------------------------------------- +// Purpose: override how single player rays hit the player +//----------------------------------------------------------------------------- + +bool LineCircleIntersection(const Vector2D ¢er, + const float radius, + const Vector2D &vLinePt, + const Vector2D &vLineDir, + float *fIntersection1, + float *fIntersection2) +{ + // Line = P + Vt + // Sphere = r (assume we've translated to origin) + // (P + Vt)^2 = r^2 + // VVt^2 + 2PVt + (PP - r^2) + // Solve as quadratic: (-b +/- sqrt(b^2 - 4ac)) / 2a + // If (b^2 - 4ac) is < 0 there is no solution. + // If (b^2 - 4ac) is = 0 there is one solution + // If (b^2 - 4ac) is > 0 there are two solutions. + + // Translate circle to origin. + const Vector2D P( vLinePt - center ); + + const float a = vLineDir.Dot(vLineDir); + const float b = 2.0f * P.Dot(vLineDir); + const float c = P.Dot(P) - (radius * radius); + + const float insideSqr = b*b - 4*a*c; + + // No solution - (b^2 - 4ac) is < 0 + if( insideSqr < -1.0e-6f ) + { + return false; + } + else + { + const float sqr = (float)FastSqrt(insideSqr); + const float denom = 1.0 / (2.0f * a); + const float t0 = (-b - sqr) * denom; + const float t1 = (-b + sqr) * denom; + + // One solution - (b^2 - 4ac) is = 0 + if( insideSqr < 1.0e-6f ) + { + // a = 0 if the line direction is the zero vector, in which case, + // the line starts inside the circle but will never exit. We fudge + // it for this case and say it intersects at the origin of the line. + // Otherwise, the result is the smallest positive result + *fIntersection1 = *fIntersection2 = ( a == 0.0f ) ? 0.0f : ( t0 < 0 ? t1 : t0 ); + Assert( !IS_NAN(*fIntersection1) ); + + // Started inside of the sphere (the only way we get one solution, unless + // the ray direction is the zero vector) + return c < 0; + } + // Two solutions - (b^2 - 4ac) is > 0 + else + { + *fIntersection1 = t0; + *fIntersection2 = t1; + } + + return true; + } +} + +bool IntersectRayWithAACylinder( const Ray_t &ray, + const Vector ¢er, float radius, float height, CBaseTrace *pTrace ) +{ + Assert( ray.m_IsRay ); + Collision_ClearTrace( ray.m_Start, ray.m_Delta, pTrace ); + + // First intersect the ray with the top + bottom planes + float halfHeight = height * 0.5; + + // Handle parallel case + Vector vStart = ray.m_Start - center; + Vector vEnd = vStart + ray.m_Delta; + + float flEnterFrac, flLeaveFrac; + if (FloatMakePositive(ray.m_Delta.z) < 1e-8) + { + if ( (vStart.z < -halfHeight) || (vStart.z > halfHeight) ) + { + return false; // no hit + } + flEnterFrac = 0.0f; flLeaveFrac = 1.0f; + } + else + { + // Clip the ray to the top and bottom of box + flEnterFrac = IntersectRayWithAAPlane( vStart, vEnd, 2, 1, halfHeight); + flLeaveFrac = IntersectRayWithAAPlane( vStart, vEnd, 2, 1, -halfHeight); + + if ( flLeaveFrac < flEnterFrac ) + { + float temp = flLeaveFrac; + flLeaveFrac = flEnterFrac; + flEnterFrac = temp; + } + + if ( flLeaveFrac < 0 || flEnterFrac > 1) + { + return false; + } + } + + // Intersect with circle + float flCircleEnterFrac, flCircleLeaveFrac; + if ( !LineCircleIntersection( vec3_origin.AsVector2D(), radius, + vStart.AsVector2D(), ray.m_Delta.AsVector2D(), &flCircleEnterFrac, &flCircleLeaveFrac ) ) + { + return false; // no hit + } + + Assert( flCircleEnterFrac <= flCircleLeaveFrac ); + if ( flCircleLeaveFrac < 0 || flCircleEnterFrac > 1) + { + return false; + } + + if ( flEnterFrac < flCircleEnterFrac ) + flEnterFrac = flCircleEnterFrac; + if ( flLeaveFrac > flCircleLeaveFrac ) + flLeaveFrac = flCircleLeaveFrac; + + if ( flLeaveFrac < flEnterFrac ) + return false; + + VectorMA( ray.m_Start, flEnterFrac , ray.m_Delta, pTrace->endpos ); + pTrace->fraction = flEnterFrac; + pTrace->contents = CONTENTS_SOLID; + + // Calculate the point on our center line where we're nearest the intersection point + Vector collisionCenter; + CalcClosestPointOnLineSegment( pTrace->endpos, center + Vector( 0, 0, halfHeight ), center - Vector( 0, 0, halfHeight ), collisionCenter ); + + // Our normal is the direction from that center point to the intersection point + pTrace->plane.normal = pTrace->endpos - collisionCenter; + VectorNormalize( pTrace->plane.normal ); + + return true; +} + #endif // !_STATIC_LINKED || _SHARED_LIB diff --git a/public/collisionutils.h b/public/collisionutils.h index 35cc3e30d..d59705682 100644 --- a/public/collisionutils.h +++ b/public/collisionutils.h @@ -190,6 +190,27 @@ bool IsBoxIntersectingSphere( const Vector& boxMin, const Vector& boxMax, bool IsBoxIntersectingSphereExtents( const Vector& boxCenter, const Vector& boxHalfDiag, const Vector& center, float radius ); + +//----------------------------------------------------------------------------- +// Returns true if a box intersects with a sphere +// NOTE: f4RadiusSq must have the radius sq in all components +//----------------------------------------------------------------------------- +FORCEINLINE bool IsBoxIntersectingSphere( const Vector& boxMin, const Vector& boxMax, + const fltx4& f4Center, const fltx4& f4RadiusSq ) +{ + // See Graphics Gems, box-sphere intersection + fltx4 f4Mins = LoadUnalignedSIMD( &boxMin.x ); + fltx4 f4Maxs = LoadUnalignedSIMD( &boxMax.x ); + fltx4 f4MinDelta = SubSIMD( f4Mins, f4Center ); + fltx4 f4MaxDelta = SubSIMD( f4Center, f4Maxs ); + f4MinDelta = MaxSIMD( f4MinDelta, Four_Zeros ); + f4MaxDelta = MaxSIMD( f4MaxDelta, Four_Zeros ); + fltx4 f4Delta = AddSIMD( f4MinDelta, f4MaxDelta ); + fltx4 f4DistSq = Dot3SIMD( f4Delta, f4Delta ); + return IsAllGreaterThan( f4RadiusSq, f4DistSq ); +} + + //----------------------------------------------------------------------------- // returns true if there's an intersection between ray and sphere //----------------------------------------------------------------------------- @@ -423,6 +444,26 @@ bool RayHasFullyContainedIntersectionWithQuad( const Ray_t &ray, +//----------------------------------------------------------------------------- +// Compute the intersection of a line and a circle +//----------------------------------------------------------------------------- +bool LineCircleIntersection(const Vector2D ¢er, + const float radius, + const Vector2D &vLinePt, + const Vector2D &vLineDir, + float *fIntersection1, + float *fIntersection2); + + +//----------------------------------------------------------------------------- +// Find the intersection of a ray with an axis-aligned cylinder +//----------------------------------------------------------------------------- +bool IntersectRayWithAACylinder( const Ray_t &ray, + const Vector ¢er, + float radius, + float height, + CBaseTrace *pTrace ); + //----------------------------------------------------------------------------- // INLINES //----------------------------------------------------------------------------- diff --git a/public/const.h b/public/const.h index ea82d4c44..d4b1797b6 100644 --- a/public/const.h +++ b/public/const.h @@ -25,14 +25,21 @@ #define INVALID_STEAM_LOGGED_IN_ELSEWHERE "This Steam account is being used in another location\n" // This is the default, see shareddefs.h for mod-specific value, which can override this -#define DEFAULT_TICK_INTERVAL (0.015) // 15 msec is the default +#define DEFAULT_TICK_INTERVAL (1.0f / 60.0f) // 16.666667 msec is the default #define MINIMUM_TICK_INTERVAL (0.001) #define MAXIMUM_TICK_INTERVAL (0.1) // This is the max # of players the engine can handle -#define ABSOLUTE_PLAYER_LIMIT 255 // not 256, so we can send the limit as a byte +// Note, must be power of 2 +#define ABSOLUTE_PLAYER_LIMIT 64 #define ABSOLUTE_PLAYER_LIMIT_DW ( (ABSOLUTE_PLAYER_LIMIT/32) + 1 ) +#if ABSOLUTE_PLAYER_LIMIT > 32 +#define CPlayerBitVec CBitVec +#else +#define CPlayerBitVec CDWordBitVec +#endif + // a player name may have 31 chars + 0 on the PC. // the 360 only allows 15 char + 0, but stick with the larger PC size for cross-platform communication #define MAX_PLAYER_NAME_LENGTH 32 @@ -65,10 +72,11 @@ // Used for networking ehandles. #define NUM_ENT_ENTRY_BITS (MAX_EDICT_BITS + 1) #define NUM_ENT_ENTRIES (1 << NUM_ENT_ENTRY_BITS) -#define ENT_ENTRY_MASK (NUM_ENT_ENTRIES - 1) #define INVALID_EHANDLE_INDEX 0xFFFFFFFF #define NUM_SERIAL_NUM_BITS (32 - NUM_ENT_ENTRY_BITS) +#define NUM_SERIAL_NUM_SHIFT_BITS (32 - NUM_SERIAL_NUM_BITS) +#define ENT_ENTRY_MASK (NUM_ENT_ENTRIES - 1) // Networked ehandles use less bits to encode the serial number. @@ -103,12 +111,12 @@ #define FL_ATCONTROLS (1<<6) // Player can't move, but keeps key inputs for controlling another entity #define FL_CLIENT (1<<7) // Is a player #define FL_FAKECLIENT (1<<8) // Fake client, simulated server side; don't send network messages to them +#define FL_INWATER (1<<9) // In water // NOTE if you move things up, make sure to change this value -#define PLAYER_FLAG_BITS 9 +#define PLAYER_FLAG_BITS 10 // NON-PLAYER SPECIFIC (i.e., not used by GameMovement or the client .dll ) -- Can still be applied to players, though -#define FL_INWATER (1<<9) // In water #define FL_FLY (1<<10) // Changes the SV_Movestep() behavior to not need to be on ground #define FL_SWIM (1<<11) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) #define FL_CONVEYOR (1<<12) @@ -130,6 +138,7 @@ #define FL_DISSOLVING (1<<28) // We're dissolving! #define FL_TRANSRAGDOLL (1<<29) // In the process of turning into a client side ragdoll. #define FL_UNBLOCKABLE_BY_PLAYER (1<<30) // pusher that can't be blocked by the player +#define FL_FREEZING (1<<31) // We're becoming frozen! // edict->movetype values enum MoveType_t @@ -201,8 +210,10 @@ enum SolidFlags_t FSOLID_USE_TRIGGER_BOUNDS = 0x0080, // Uses a special trigger bounds separate from the normal OBB FSOLID_ROOT_PARENT_ALIGNED = 0x0100, // Collisions are defined in root parent's local coordinate space FSOLID_TRIGGER_TOUCH_DEBRIS = 0x0200, // This trigger will touch debris objects + FSOLID_TRIGGER_TOUCH_PLAYER = 0x0400, // This trigger will touch only players + FSOLID_NOT_MOVEABLE = 0x0800, // Assume this object will not move - FSOLID_MAX_BITS = 10 + FSOLID_MAX_BITS = 12 }; //----------------------------------------------------------------------------- @@ -293,7 +304,7 @@ enum // if this is changed, update common/MaterialSystem/Sprite.cpp enum RenderMode_t { - kRenderNormal, // src + kRenderNormal = 0, // src kRenderTransColor, // c*a+dest*(1-a) kRenderTransTexture, // src*a+dest*(1-a) kRenderGlow, // src*a+dest -- No Z buffer checks -- Fixed size in screen space @@ -304,6 +315,8 @@ enum RenderMode_t kRenderTransAlphaAdd, // src + dest*(1-a) kRenderWorldGlow, // Same as kRenderGlow but not fixed size in screen space kRenderNone, // Don't render. + + kRenderModeCount, // must be last }; enum RenderFx_t @@ -313,26 +326,24 @@ enum RenderFx_t kRenderFxPulseFast, kRenderFxPulseSlowWide, kRenderFxPulseFastWide, + kRenderFxFadeSlow, kRenderFxFadeFast, kRenderFxSolidSlow, kRenderFxSolidFast, kRenderFxStrobeSlow, + kRenderFxStrobeFast, kRenderFxStrobeFaster, kRenderFxFlickerSlow, kRenderFxFlickerFast, kRenderFxNoDissipation, - kRenderFxDistort, // Distort/scale/translate flicker - kRenderFxHologram, // kRenderFxDistort + distance fade - kRenderFxExplode, // Scale up really big! - kRenderFxGlowShell, // Glowing Shell - kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!) - kRenderFxEnvRain, // for environmental rendermode, make rain - kRenderFxEnvSnow, // " " " , make snow - kRenderFxSpotlight, // TEST CODE for experimental spotlight - kRenderFxRagdoll, // HACKHACK: TEST CODE for signalling death of a ragdoll character + + kRenderFxFadeOut, + kRenderFxFadeIn, kRenderFxPulseFastWider, + kRenderFxGlowShell, // Glowing Shell + kRenderFxMax }; @@ -360,6 +371,11 @@ enum Collision_Group_t COLLISION_GROUP_NPC_ACTOR, // Used so NPCs in scripts ignore the player. COLLISION_GROUP_NPC_SCRIPTED, // USed for NPCs in scripts that should not collide with each other + COLLISION_GROUP_PZ_CLIP, + + + + COLLISION_GROUP_DEBRIS_BLOCK_PROJECTILE, // Only collides with bullets LAST_SHARED_COLLISION_GROUP }; @@ -368,12 +384,25 @@ enum Collision_Group_t #define SOUND_NORMAL_CLIP_DIST 1000.0f +//----------------------------------------------------------------------------- +// Base light indices to avoid index collision +//----------------------------------------------------------------------------- + +enum +{ + LIGHT_INDEX_TE_DYNAMIC = 0x10000000, + LIGHT_INDEX_PLAYER_BRIGHT = 0x20000000, + LIGHT_INDEX_MUZZLEFLASH = 0x40000000, + LIGHT_INDEX_LOW_PRIORITY = 0x64000000, +}; + // How many networked area portals do we allow? #define MAX_AREA_STATE_BYTES 32 #define MAX_AREA_PORTAL_STATE_BYTES 24 // user message max payload size (note, this value is used by the engine, so MODs cannot change it) -#define MAX_USER_MSG_DATA 255 +#define MAX_USER_MSG_BITS 12 +#define MAX_USER_MSG_DATA ( ( 1 << ( MAX_USER_MSG_BITS - 3 ) ) - 1 ) #define MAX_ENTITY_MSG_DATA 255 #define SOURCE_MT @@ -385,5 +414,16 @@ class CThreadNullMutex; typedef CThreadNullMutex CSourceMutex; #endif +#if defined( CLIENT_DLL ) +#define IsServerDll() false +#define IsClientDll() true +#elif defined( GAME_DLL ) +#define IsServerDll() true +#define IsClientDll() false +#else +#define IsServerDll() false +#define IsClientDll() false +#endif + #endif diff --git a/public/datamap.h b/public/datamap.h index 40d7c3181..bddb18e58 100644 --- a/public/datamap.h +++ b/public/datamap.h @@ -66,6 +66,7 @@ typedef enum _fieldtypes FIELD_VECTOR2D, // 2 floats FIELD_INTEGER64, // 64bit integer + FIELD_VECTOR4D, // 4 floats FIELD_TYPECOUNT, // MUST BE LAST } fieldtype_t; @@ -98,6 +99,7 @@ DECLARE_FIELD_SIZE( FIELD_FLOAT, sizeof(float) ) DECLARE_FIELD_SIZE( FIELD_STRING, sizeof(int) ) DECLARE_FIELD_SIZE( FIELD_VECTOR, 3 * sizeof(float) ) DECLARE_FIELD_SIZE( FIELD_VECTOR2D, 2 * sizeof(float) ) +DECLARE_FIELD_SIZE( FIELD_VECTOR4D, 4 * sizeof( float ) ) DECLARE_FIELD_SIZE( FIELD_QUATERNION, 4 * sizeof(float)) DECLARE_FIELD_SIZE( FIELD_INTEGER, sizeof(int)) DECLARE_FIELD_SIZE( FIELD_INTEGER64, sizeof(int64)) @@ -126,50 +128,51 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) ) #define ARRAYSIZE2D(p) (sizeof(p)/sizeof(p[0][0])) #define SIZE_OF_ARRAY(p) _ARRAYSIZE(p) -#define _FIELD(name, fieldtype, count, flags, mapname, tolerance) { fieldtype, #name, { offsetof(classNameTypedef, name), 0 }, count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, tolerance } -#define _FIELD_NETARRAY(array, i, fieldtype, count, flags, mapname, tolerance) { fieldtype, #array "[" #i "]", { offsetof(classNameTypedef, array) + offsetof(classNameTypedef::NetworkVar_##array, m_Value[i]), 0 }, count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->array ), NULL, 0, tolerance } -#define DEFINE_FIELD_NULL { FIELD_VOID,0, {0,0},0,0,0,0,0,0} +#define _FIELD(name,fieldtype,count,flags,mapname,tolerance) { fieldtype, #name, offsetof(classNameTypedef, name), count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, tolerance } +#define DEFINE_FIELD_NULL { FIELD_VOID,0,0,0,0,0,0,0,0} #define DEFINE_FIELD(name,fieldtype) _FIELD(name, fieldtype, 1, FTYPEDESC_SAVE, NULL, 0 ) +#define DEFINE_FIELD_NOT_SAVED(name,fieldtype) _FIELD(name, fieldtype, 1, 0, NULL, 0 ) + #define DEFINE_KEYFIELD(name,fieldtype, mapname) _FIELD(name, fieldtype, 1, FTYPEDESC_KEY | FTYPEDESC_SAVE, mapname, 0 ) -#define DEFINE_KEYFIELD_NETARRAY(array, i, fieldtype, mapname) _FIELD_NETARRAY(array, i, fieldtype, 1, FTYPEDESC_KEY | FTYPEDESC_SAVE, mapname, 0 ) #define DEFINE_KEYFIELD_NOT_SAVED(name,fieldtype, mapname)_FIELD(name, fieldtype, 1, FTYPEDESC_KEY, mapname, 0 ) #define DEFINE_AUTO_ARRAY(name,fieldtype) _FIELD(name, fieldtype, SIZE_OF_ARRAY(((classNameTypedef *)0)->name), FTYPEDESC_SAVE, NULL, 0 ) #define DEFINE_AUTO_ARRAY_KEYFIELD(name,fieldtype,mapname) _FIELD(name, fieldtype, SIZE_OF_ARRAY(((classNameTypedef *)0)->name), FTYPEDESC_SAVE, mapname, 0 ) #define DEFINE_ARRAY(name,fieldtype, count) _FIELD(name, fieldtype, count, FTYPEDESC_SAVE, NULL, 0 ) +#define DEFINE_ARRAY_NOT_SAVED(name,fieldtype, count) _FIELD(name, fieldtype, count, 0, NULL, 0 ) #define DEFINE_ENTITY_FIELD(name,fieldtype) _FIELD(edict_t, name, fieldtype, 1, FTYPEDESC_KEY | FTYPEDESC_SAVE, #name, 0 ) #define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype) _FIELD(edict_t, name, fieldtype, 1, FTYPEDESC_KEY | FTYPEDESC_SAVE | FTYPEDESC_GLOBAL, #name, 0 ) #define DEFINE_GLOBAL_FIELD(name,fieldtype) _FIELD(name, fieldtype, 1, FTYPEDESC_GLOBAL | FTYPEDESC_SAVE, NULL, 0 ) #define DEFINE_GLOBAL_KEYFIELD(name,fieldtype, mapname) _FIELD(name, fieldtype, 1, FTYPEDESC_GLOBAL | FTYPEDESC_KEY | FTYPEDESC_SAVE, mapname, 0 ) -#define DEFINE_CUSTOM_FIELD(name,datafuncs) { FIELD_CUSTOM, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, datafuncs, NULL } -#define DEFINE_CUSTOM_KEYFIELD(name,datafuncs,mapname) { FIELD_CUSTOM, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_KEY, mapname, datafuncs, NULL } +#define DEFINE_CUSTOM_FIELD(name,datafuncs) { FIELD_CUSTOM, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_SAVE, NULL, datafuncs, NULL } +#define DEFINE_CUSTOM_KEYFIELD(name,datafuncs,mapname) { FIELD_CUSTOM, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_SAVE | FTYPEDESC_KEY, mapname, datafuncs, NULL } #define DEFINE_AUTO_ARRAY2D(name,fieldtype) _FIELD(name, fieldtype, ARRAYSIZE2D(((classNameTypedef *)0)->name), FTYPEDESC_SAVE, NULL, 0 ) // Used by byteswap datadescs #define DEFINE_BITFIELD(name,fieldtype,bitcount) DEFINE_ARRAY(name,fieldtype,((bitcount+FIELD_BITS(fieldtype)-1)&~(FIELD_BITS(fieldtype)-1)) / FIELD_BITS(fieldtype) ) #define DEFINE_INDEX(name,fieldtype) _FIELD(name, fieldtype, 1, FTYPEDESC_INDEX, NULL, 0 ) #define DEFINE_EMBEDDED( name ) \ - { FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name.m_DataMap), sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f } + { FIELD_EMBEDDED, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name.m_DataMap), sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f } #define DEFINE_EMBEDDED_OVERRIDE( name, overridetype ) \ - { FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &((overridetype *)0)->m_DataMap, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f } + { FIELD_EMBEDDED, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &((overridetype *)0)->m_DataMap, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f } #define DEFINE_EMBEDDEDBYREF( name ) \ - { FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_PTR, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( *(((classNameTypedef *)0)->name) ), NULL, 0, 0.0f } + { FIELD_EMBEDDED, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_SAVE | FTYPEDESC_PTR, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( *(((classNameTypedef *)0)->name) ), NULL, 0, 0.0f } #define DEFINE_EMBEDDED_ARRAY( name, count ) \ - { FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, count, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f } + { FIELD_EMBEDDED, #name, offsetof(classNameTypedef, name), count, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f } #define DEFINE_EMBEDDED_AUTO_ARRAY( name ) \ - { FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, SIZE_OF_ARRAY( ((classNameTypedef *)0)->name ), FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f } + { FIELD_EMBEDDED, #name, offsetof(classNameTypedef, name), SIZE_OF_ARRAY( ((classNameTypedef *)0)->name ), FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f } #ifndef NO_ENTITY_PREDICTION // FTYPEDESC_KEY tells the prediction copy system to report the full nameof the field when reporting errors #define DEFINE_PRED_TYPEDESCRIPTION( name, fieldtype ) \ - { FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &fieldtype::m_PredMap } + { FIELD_EMBEDDED, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_SAVE | FTYPEDESC_KEY, NULL, NULL, NULL, &fieldtype::m_PredMap } #define DEFINE_PRED_TYPEDESCRIPTION_PTR( name, fieldtype ) \ - { FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_PTR, NULL, NULL, NULL, &fieldtype::m_PredMap } + { FIELD_EMBEDDED, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_SAVE | FTYPEDESC_PTR | FTYPEDESC_KEY, NULL, NULL, NULL, &fieldtype::m_PredMap } #else @@ -190,18 +193,18 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) ) //#define DEFINE_DATA( name, fieldextname, flags ) _FIELD(name, fieldtype, 1, flags, extname ) // INPUTS -#define DEFINE_INPUT( name, fieldtype, inputname ) { fieldtype, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_INPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, inputname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ) } -#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, { 0, 0 }, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast (&classNameTypedef::inputfunc) } +#define DEFINE_INPUT( name, fieldtype, inputname ) { fieldtype, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_INPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, inputname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ) } +#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, NULL, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast (&classNameTypedef::inputfunc) } // OUTPUTS // the variable 'name' MUST BE derived from CBaseOutput // we know the output type from the variable itself, so it doesn't need to be specified here class ISaveRestoreOps; extern ISaveRestoreOps *eventFuncs; -#define DEFINE_OUTPUT( name, outputname ) { FIELD_CUSTOM, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_OUTPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, outputname, eventFuncs } +#define DEFINE_OUTPUT( name, outputname ) { FIELD_CUSTOM, #name, offsetof(classNameTypedef, name), 1, FTYPEDESC_OUTPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, outputname, eventFuncs } // replaces EXPORT table for portability and non-DLL based systems (xbox) -#define DEFINE_FUNCTION_RAW( function, func_type ) { FIELD_VOID, nameHolder.GenerateName(#function), { 0, 0 }, 1, FTYPEDESC_FUNCTIONTABLE, NULL, NULL, (inputfunc_t)((func_type)(&classNameTypedef::function)) } +#define DEFINE_FUNCTION_RAW( function, func_type ) { FIELD_VOID, nameHolder.GenerateName(#function), NULL, 1, FTYPEDESC_FUNCTIONTABLE, NULL, NULL, (inputfunc_t)((func_type)(&classNameTypedef::function)) } #define DEFINE_FUNCTION( function ) DEFINE_FUNCTION_RAW( function, inputfunc_t ) @@ -322,12 +325,22 @@ struct datamap_t // // Macros used to implement datadescs // +#define DECLARE_FRIEND_DATADESC_ACCESS() \ + template friend void DataMapAccess(T *, datamap_t **p); \ + template friend datamap_t *DataMapInit(T *); + #define DECLARE_SIMPLE_DATADESC() \ static datamap_t m_DataMap; \ static datamap_t *GetBaseMap(); \ template friend void DataMapAccess(T *, datamap_t **p); \ template friend datamap_t *DataMapInit(T *); +#define DECLARE_SIMPLE_DATADESC_INSIDE_NAMESPACE() \ + static datamap_t m_DataMap; \ + static datamap_t *GetBaseMap(); \ + template friend void ::DataMapAccess(T *, datamap_t **p); \ + template friend datamap_t *::DataMapInit(T *); + #define DECLARE_DATADESC() \ DECLARE_SIMPLE_DATADESC() \ virtual datamap_t *GetDataDescMap( void ); @@ -369,7 +382,25 @@ struct datamap_t className::m_DataMap.baseMap = className::GetBaseMap(); \ static typedescription_t dataDesc[] = \ { \ - { FIELD_VOID,0, {0,0},0,0,0,0,0,0}, /* so you can define "empty" tables */ + { FIELD_VOID,0,0,0,0,0,0,0,0}, /* so you can define "empty" tables */ + + +#define BEGIN_DATADESC_GUTS_NAMESPACE( className, nameSpace ) \ + template datamap_t *nameSpace::DataMapInit(T *); \ + template <> datamap_t *nameSpace::DataMapInit( className * ); \ + namespace className##_DataDescInit \ + { \ + datamap_t *g_DataMapHolder = nameSpace::DataMapInit( (className *)NULL ); /* This can/will be used for some clean up duties later */ \ + } \ + \ + template <> datamap_t *nameSpace::DataMapInit( className * ) \ + { \ + typedef className classNameTypedef; \ + static CDatadescGeneratedNameHolder nameHolder(#className); \ + className::m_DataMap.baseMap = className::GetBaseMap(); \ + static typedescription_t dataDesc[] = \ + { \ + { FIELD_VOID,0,0,0,0,0,0,0,0}, /* so you can define "empty" tables */ #define END_DATADESC() \ }; \ diff --git a/public/dt_common.h b/public/dt_common.h index 6dcbf90cb..e28e39fb9 100644 --- a/public/dt_common.h +++ b/public/dt_common.h @@ -115,6 +115,7 @@ typedef enum #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! DPT_Quaternion, #endif + DPT_Int64, DPT_NUMSendPropTypes } SendPropType; @@ -163,6 +164,9 @@ class DVariant case DPT_DataTable : Q_snprintf( text, sizeof(text), "DataTable" ); break; + case DPT_Int64: + Q_snprintf( text, sizeof(text), "%I64d", m_Int64 ); + break; default : Q_snprintf( text, sizeof(text), "DVariant type %i unknown", m_Type ); break; @@ -182,6 +186,7 @@ class DVariant #else float m_Vector[3]; #endif + int64 m_Int64; }; SendPropType m_Type; }; diff --git a/public/dt_send.cpp b/public/dt_send.cpp index ffc1c1773..6794ee346 100644 --- a/public/dt_send.cpp +++ b/public/dt_send.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -25,6 +25,7 @@ static CNonModifiedPointerProxy *s_pNonModifiedPointerProxyHead = NULL; void SendProxy_UInt8ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); void SendProxy_UInt16ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); void SendProxy_UInt32ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); +void SendProxy_UInt64ToInt64( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); const char *s_ElementNames[MAX_ARRAY_ELEMENTS] = { @@ -148,10 +149,12 @@ CStandardSendProxiesV1::CStandardSendProxiesV1() m_Int8ToInt32 = SendProxy_Int8ToInt32; m_Int16ToInt32 = SendProxy_Int16ToInt32; m_Int32ToInt32 = SendProxy_Int32ToInt32; + m_Int64ToInt64 = SendProxy_Int64ToInt64; m_UInt8ToInt32 = SendProxy_UInt8ToInt32; m_UInt16ToInt32 = SendProxy_UInt16ToInt32; m_UInt32ToInt32 = SendProxy_UInt32ToInt32; + m_UInt64ToInt64 = SendProxy_UInt64ToInt64; m_FloatToFloat = SendProxy_FloatToFloat; m_VectorToVector = SendProxy_VectorToVector; @@ -160,7 +163,6 @@ CStandardSendProxiesV1::CStandardSendProxiesV1() CStandardSendProxies::CStandardSendProxies() { m_DataTableToDataTable = SendProxy_DataTableToDataTable; - m_SendLocalDataTable = SendProxy_SendLocalDataTable; m_ppNonModifiedPointerProxies = &s_pNonModifiedPointerProxyHead; } @@ -203,6 +205,14 @@ void SendProxy_VectorToVector( const SendProp *pProp, const void *pStruct, const pOut->m_Vector[2] = v[2]; } +void SendProxy_VectorXYToVectorXY( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID) +{ + Vector& v = *(Vector*)pData; + Assert( v.IsValid() ); + pOut->m_Vector[0] = v[0]; + pOut->m_Vector[1] = v[1]; +} + #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! void SendProxy_QuaternionToQuaternion( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID) { @@ -230,6 +240,17 @@ void SendProxy_Int32ToInt32( const SendProp *pProp, const void *pStruct, const v pOut->m_Int = *((int*)pData); } +void SendProxy_Color32ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID ) +{ + //Always send/receive as little endian to preserve byte order across network byte swaps + pOut->m_Int = LittleDWord( *((uint32 *)pData) ); +} + +void SendProxy_Int64ToInt64( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID) +{ + pOut->m_Int64 = *((int64*)pData); +} + void SendProxy_UInt8ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID) { pOut->m_Int = *((unsigned char*)pData); @@ -245,6 +266,11 @@ void SendProxy_UInt32ToInt32( const SendProp *pProp, const void *pStruct, const *((unsigned long*)&pOut->m_Int) = *((unsigned long*)pData); } +void SendProxy_UInt64ToInt64( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID) +{ + *((int64*)&pOut->m_Int64) = *((uint64*)pData); +} + void SendProxy_StringToString( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID) { pOut->m_pString = (char*)pData; @@ -264,25 +290,6 @@ static void SendProxy_Empty( const SendProp *pProp, const void *pStruct, const v { } -//----------------------------------------------------------------------------- -// Purpose: If the recipient is the same as objectID, go ahead and iterate down -// the m_Local stuff, otherwise, act like it wasn't there at all. -// This way, only the local player receives information about him/herself. -// Input : *pVarData - -// *pOut - -// objectID - -//----------------------------------------------------------------------------- - -void* SendProxy_SendLocalDataTable( const SendProp *pProp, const void *pStruct, const void *pVarData, CSendProxyRecipients *pRecipients, int objectID ) -{ - pRecipients->SetOnly( objectID - 1 ); - return ( void * )pVarData; -} - - - - - // ---------------------------------------------------------------------- // // Prop setup functions (for building tables). // ---------------------------------------------------------------------- // @@ -295,6 +302,8 @@ float AssignRangeMultiplier( int nBits, double range ) iHighValue = ((1 << (unsigned long)nBits) - 1); float fHighLowMul = iHighValue / range; + if ( CloseEnough( range, 0 ) ) + fHighLowMul = iHighValue; // If the precision is messing us up, then adjust it so it won't. if ( (unsigned long)(fHighLowMul * range) > iHighValue || @@ -303,7 +312,7 @@ float AssignRangeMultiplier( int nBits, double range ) // Squeeze it down smaller and smaller until it's going to produce an integer // in the valid range when given the highest value. float multipliers[] = { 0.9999, 0.99, 0.9, 0.8, 0.7 }; - size_t i; + int i; for ( i=0; i < ARRAYSIZE( multipliers ); i++ ) { float fHighLowMul = (float)( iHighValue / range ) * multipliers[i]; @@ -339,7 +348,8 @@ SendProp SendPropFloat( int flags, float fLowValue, // For floating point, low and high values. float fHighValue, // High value. If HIGH_DEFAULT, it's (1< m_Bits; + CPlayerBitVec m_Bits; }; inline void CSendProxyRecipients::SetAllRecipients() @@ -138,21 +141,6 @@ inline void CSendProxyRecipients::ClearAllRecipients() m_Bits.ClearAll(); } -inline void CSendProxyRecipients::SetRecipient( int iClient ) -{ - m_Bits.Set( iClient ); -} - -inline void CSendProxyRecipients::ClearRecipient( int iClient ) -{ - m_Bits.Clear( iClient ); -} - -inline void CSendProxyRecipients::SetOnly( int iClient ) -{ - m_Bits.ClearAll(); - m_Bits.Set( iClient ); -} @@ -596,7 +584,6 @@ inline void SendTable::SetHasPropsEncodedAgainstTickcount( bool bState ) #define SENDINFO_ARRAY(varName) #varName, offsetof(currentSendDTClass::MakeANetworkVar_##varName, varName), sizeof(((currentSendDTClass*)0)->varName[0]) #define SENDINFO_ARRAY3(varName) #varName, offsetof(currentSendDTClass::MakeANetworkVar_##varName, varName), sizeof(((currentSendDTClass*)0)->varName[0]), sizeof(((currentSendDTClass*)0)->varName)/sizeof(((currentSendDTClass*)0)->varName[0]) #define SENDINFO_ARRAYELEM(varName, i) #varName "[" #i "]", offsetof(currentSendDTClass::MakeANetworkVar_##varName, varName[i]), sizeof(((currentSendDTClass*)0)->varName[0]) -#define SENDINFO_ARRAYELEM2(varName, i) #varName "[" #i "]", offsetof(currentSendDTClass::MakeANetworkVar_##varName, varName) + offsetof(currentSendDTClass::MakeANetworkVar_##varName::NetworkVar_##varName, m_Value[i]), sizeof(((currentSendDTClass*)0)->varName[0]) #define SENDINFO_NETWORKARRAYELEM(varName, i)#varName "[" #i "]", offsetof(currentSendDTClass::MakeANetworkVar_##varName, varName.m_Value[i]), sizeof(((currentSendDTClass*)0)->varName.m_Value[0]) // NOTE: Be VERY careful to specify any other vector elems for the same vector IN ORDER and @@ -604,14 +591,12 @@ inline void SendTable::SetHasPropsEncodedAgainstTickcount( bool bState ) // // Note: this macro specifies a negative offset so the engine can detect it and setup m_pNext #define SENDINFO_VECTORELEM(varName, i) #varName "[" #i "]", -(int)offsetof(currentSendDTClass::MakeANetworkVar_##varName, varName.m_Value[i]), sizeof(((currentSendDTClass*)0)->varName.m_Value[0]) -#define SENDINFO_VECTORELEM2(varName, i, which) #varName "[" #i "]", -(int)offsetof(currentSendDTClass::MakeANetworkVar_##varName, varName.m_Value.which), sizeof(((currentSendDTClass*)0)->varName.m_Value[0]) #define SENDINFO_STRUCTELEM(varName) #varName, offsetof(currentSendDTClass, varName), sizeof(((currentSendDTClass*)0)->varName.m_Value) #define SENDINFO_STRUCTARRAYELEM(varName, i)#varName "[" #i "]", offsetof(currentSendDTClass, varName.m_Value[i]), sizeof(((currentSendDTClass*)0)->varName.m_Value[0]) // Use this when you're not using a CNetworkVar to represent the data you're sending. #define SENDINFO_NOCHECK(varName) #varName, offsetof(currentSendDTClass, varName), sizeof(((currentSendDTClass*)0)->varName) -#define SENDINFO_NOCHECK_VECTORELEM(varName, i, which) #varName "[" #i "]", offsetof(currentSendDTClass, varName.which), sizeof(((currentSendDTClass*)0)->varName.which) #define SENDINFO_STRING_NOCHECK(varName) #varName, offsetof(currentSendDTClass, varName) #define SENDINFO_DT(varName) #varName, offsetof(currentSendDTClass, varName) #define SENDINFO_DT_NAME(varName, remoteVarName) #remoteVarName, offsetof(currentSendDTClass, varName) @@ -636,18 +621,17 @@ void SendProxy_QuaternionToQuaternion( const SendProp *pProp, const void *pStruc void SendProxy_Int8ToInt32 ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID ); void SendProxy_Int16ToInt32 ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID ); void SendProxy_Int32ToInt32 ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID ); +void SendProxy_Int64ToInt64 ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID ); +void SendProxy_Color32ToInt32 ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID ); void SendProxy_StringToString ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID ); + // pData is the address of a data table. void* SendProxy_DataTableToDataTable( const SendProp *pProp, const void *pStructBase, const void *pData, CSendProxyRecipients *pRecipients, int objectID ); // pData is the address of a pointer to a data table. void* SendProxy_DataTablePtrToDataTable( const SendProp *pProp, const void *pStructBase, const void *pData, CSendProxyRecipients *pRecipients, int objectID ); -// Used on player entities - only sends the data to the local player (objectID-1). -void* SendProxy_SendLocalDataTable( const SendProp *pProp, const void *pStruct, const void *pVarData, CSendProxyRecipients *pRecipients, int objectID ); - - // ------------------------------------------------------------------------ // // Use these functions to setup your data tables. // ------------------------------------------------------------------------ // @@ -766,6 +750,33 @@ SendProp SendPropArray3( +// +// Only use this if you change the array infrequently and you usually change all the elements +// when you do change it. +// +// The array data is all sent together, so even if you only change one element, +// it'll send all the elements. +// +// The upside is that it doesn't need extra bits to encode indices of all the variables. +// +#define SendPropArray_AllAtOnce( arrayName, propDefinition ) \ + SendPropArray( propDefinition, arrayName ) + + +// +// This is what you should use for most arrays. It will generate a separate SendProp for each array element +// in your array. That way, if you change one element of the array, it will only transmit that array element +// and not the whole array. +// +// Example: +// +// GenerateSendPropsForArrayElements( m_Array, SendPropInt( SENDINFO_ARRAY( m_Array ) ) +// +#define SendPropArray_UniqueElements( arrayName, propDefinition ) \ + SendPropArray3( SENDINFO_ARRAY3( arrayName ), propDefinition ) + + + // Use the macro to let it automatically generate a table name. You shouldn't // ever need to reference the table name. If you want to exclude this array, then // reference the name of the variable in varTemplate. diff --git a/public/dt_utlvector_common.cpp b/public/dt_utlvector_common.cpp index 537f36bce..640ae058a 100644 --- a/public/dt_utlvector_common.cpp +++ b/public/dt_utlvector_common.cpp @@ -9,10 +9,9 @@ #include "tier0/memdbgon.h" -#ifdef _DEBUG static CUtlDict *g_STDict = 0; static CUtlDict *g_RTDict = 0; -#endif + char* AllocateStringHelper2( const char *pFormat, va_list marker ) { diff --git a/public/dt_utlvector_common.h b/public/dt_utlvector_common.h index abc679dc0..d85fb819a 100644 --- a/public/dt_utlvector_common.h +++ b/public/dt_utlvector_common.h @@ -34,23 +34,30 @@ class UtlVectorTemplate pVec->AddMultipleToTail( len - pVec->Count() ); else if ( pVec->Count() > len ) pVec->RemoveMultiple( len, pVec->Count()-len ); + + // Ensure capacity + pVec->EnsureCapacity( len ); + + int nNumAllocated = pVec->NumAllocated(); + + // This is important to do because EnsureCapacity doesn't actually call the constructors + // on the elements, but we need them to be initialized, otherwise it'll have out-of-range + // values which will piss off the datatable encoder. + UtlVector_InitializeAllocatedElements( pVec->Base() + pVec->Count(), nNumAllocated - pVec->Count() ); } static void EnsureCapacity( void *pStruct, int offsetToUtlVector, int len ) { CUtlVector *pVec = (CUtlVector*)((char*)pStruct + offsetToUtlVector); + + pVec->EnsureCapacity( len ); - int oldNumAllocated = pVec->Count(); - - if ( oldNumAllocated < len ) - { - pVec->EnsureCapacity( len ); - - // This is important to do because EnsureCapacity doesn't actually call the constructors - // on the elements, but we need them to be initialized, otherwise it'll have out-of-range - // values which will piss off the datatable encoder. - UtlVector_InitializeAllocatedElements( pVec->Base() + oldNumAllocated, len - oldNumAllocated ); - } + int nNumAllocated = pVec->NumAllocated(); + + // This is important to do because EnsureCapacity doesn't actually call the constructors + // on the elements, but we need them to be initialized, otherwise it'll have out-of-range + // values which will piss off the datatable encoder. + UtlVector_InitializeAllocatedElements( pVec->Base() + pVec->Count(), nNumAllocated - pVec->Count() ); } }; diff --git a/public/dt_utlvector_send.cpp b/public/dt_utlvector_send.cpp index db73cf864..5c30b4b20 100644 --- a/public/dt_utlvector_send.cpp +++ b/public/dt_utlvector_send.cpp @@ -17,6 +17,16 @@ extern const char *s_ElementNames[MAX_ARRAY_ELEMENTS]; class CSendPropExtra_UtlVector { public: + CSendPropExtra_UtlVector() : + m_DataTableProxyFn( NULL ), + m_ProxyFn( NULL ), + m_EnsureCapacityFn( NULL ), + m_ElementStride( 0 ), + m_Offset( 0 ), + m_nMaxElements( 0 ) + { + } + SendTableProxyFn m_DataTableProxyFn; // If it's a datatable, then this is the proxy they specified. SendVarProxyFn m_ProxyFn; // If it's a non-datatable, then this is the proxy they specified. EnsureCapacityFn m_EnsureCapacityFn; diff --git a/public/engine/ivmodelinfo.h b/public/engine/ivmodelinfo.h index 11b918ddb..93a0cedc9 100644 --- a/public/engine/ivmodelinfo.h +++ b/public/engine/ivmodelinfo.h @@ -67,6 +67,7 @@ class IVModelInfo virtual const char *GetModelName( const model_t *model ) const = 0; virtual vcollide_t *GetVCollide( const model_t *model ) const = 0; virtual vcollide_t *GetVCollide( int modelindex ) const = 0; + virtual vcollide_t *GetPhysics2VCollide(int) const = 0; virtual void GetModelBounds( const model_t *model, Vector& mins, Vector& maxs ) const = 0; virtual void GetModelRenderBounds( const model_t *model, Vector& mins, Vector& maxs ) const = 0; virtual int GetModelFrameCount( const model_t *model ) const = 0; diff --git a/public/engine_hlds_api.h b/public/engine_hlds_api.h index 05a24f413..635840325 100644 --- a/public/engine_hlds_api.h +++ b/public/engine_hlds_api.h @@ -48,6 +48,10 @@ class IDedicatedServerAPI : public IAppSystem virtual void UpdateStatus(float *fps, int *nActive, int *nMaxPlayers, char *pszMap, int maxlen ) = 0; // Get current Hostname to display in the hlds UI (console window title bar, e.g. ) virtual void UpdateHostname(char *pszHostname, int maxlen) = 0; + + // for the multi-processed fork() server, set the server instance number (1..) + virtual void SetSubProcessID( int nID, int nSocketHandle ) = 0; + }; #endif // ENGINE_HLDS_API_H diff --git a/public/entitydefs.h b/public/entitydefs.h new file mode 100644 index 000000000..8f9811b8f --- /dev/null +++ b/public/entitydefs.h @@ -0,0 +1,21 @@ +//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ==== +// +// Entity definitions needed by hammer, compile tools, and the game. +// +//============================================================================= + +#ifndef ENTITYDEFS_H +#define ENTITYDEFS_H +#ifdef _WIN32 +#pragma once +#endif + + +#define MAX_ENTITY_NAME_LEN 256 +#define MAX_IO_NAME_LEN 256 + +#define VMF_IOPARAM_STRING_DELIMITER 0x1b // Use ESC as a delimiter so we can pass commas etc. in I/O parameters + + +#endif // ENTITYDEFS_H + diff --git a/public/gamebspfile.h b/public/gamebspfile.h index 706577e5c..d0bd0efb1 100644 --- a/public/gamebspfile.h +++ b/public/gamebspfile.h @@ -34,7 +34,8 @@ enum { GAMELUMP_DETAIL_PROPS_VERSION = 4, GAMELUMP_DETAIL_PROP_LIGHTING_VERSION = 0, - GAMELUMP_STATIC_PROPS_VERSION = 6, + GAMELUMP_STATIC_PROPS_MIN_VERSION = 4, + GAMELUMP_STATIC_PROPS_VERSION = 9, GAMELUMP_STATIC_PROP_LIGHTING_VERSION = 0, GAMELUMP_DETAIL_PROP_LIGHTING_HDR_VERSION = 0, }; @@ -130,7 +131,7 @@ enum // These are set in WC STATIC_PROP_IGNORE_NORMALS = 0x8, STATIC_PROP_NO_SHADOW = 0x10, - STATIC_PROP_SCREEN_SPACE_FADE = 0x20, + STATIC_PROP_UNUSED = 0x20, STATIC_PROP_NO_PER_VERTEX_LIGHTING = 0x40, // in vrad, compute lighting at // lighting origin, not for each vertex @@ -140,6 +141,11 @@ enum STATIC_PROP_WC_MASK = 0xd8, // all flags settable in hammer (?) }; +enum +{ + STATIC_PROP_SCREEN_SPACE_FADE_OBSOLETE = 0x20, // only keeping these here to be able to report errors +}; + struct StaticPropDictLump_t { DECLARE_BYTESWAP_DATADESC(); @@ -181,7 +187,27 @@ struct StaticPropLumpV5_t // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump }; -struct StaticPropLump_t +struct StaticPropLumpV6_t +{ + DECLARE_BYTESWAP_DATADESC(); + Vector m_Origin; + QAngle m_Angles; + unsigned short m_PropType; + unsigned short m_FirstLeaf; + unsigned short m_LeafCount; + unsigned char m_Solid; + unsigned char m_Flags; + int m_Skin; + float m_FadeMinDist; + float m_FadeMaxDist; + Vector m_LightingOrigin; + float m_flForcedFadeScale; + unsigned short m_nMinDXLevel; + unsigned short m_nMaxDXLevel; + // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump +}; + +struct StaticPropLumpV7_t { DECLARE_BYTESWAP_DATADESC(); Vector m_Origin; @@ -199,6 +225,54 @@ struct StaticPropLump_t unsigned short m_nMinDXLevel; unsigned short m_nMaxDXLevel; // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump + color32 m_DiffuseModulation; // per instance color and alpha modulation +}; + +struct StaticPropLumpV8_t +{ + DECLARE_BYTESWAP_DATADESC(); + Vector m_Origin; + QAngle m_Angles; + unsigned short m_PropType; + unsigned short m_FirstLeaf; + unsigned short m_LeafCount; + unsigned char m_Solid; + unsigned char m_Flags; + int m_Skin; + float m_FadeMinDist; + float m_FadeMaxDist; + Vector m_LightingOrigin; + float m_flForcedFadeScale; + unsigned char m_nMinCPULevel; + unsigned char m_nMaxCPULevel; + unsigned char m_nMinGPULevel; + unsigned char m_nMaxGPULevel; + // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump + color32 m_DiffuseModulation; // per instance color and alpha modulation +}; + +struct StaticPropLump_t +{ + DECLARE_BYTESWAP_DATADESC(); + Vector m_Origin; + QAngle m_Angles; + unsigned short m_PropType; + unsigned short m_FirstLeaf; + unsigned short m_LeafCount; + unsigned char m_Solid; + unsigned char m_Flags; + int m_Skin; + float m_FadeMinDist; + float m_FadeMaxDist; + Vector m_LightingOrigin; + float m_flForcedFadeScale; + unsigned char m_nMinCPULevel; + unsigned char m_nMaxCPULevel; + unsigned char m_nMinGPULevel; + unsigned char m_nMaxGPULevel; + // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump + color32 m_DiffuseModulation; // per instance color and alpha modulation + bool m_bDisableX360; }; struct StaticPropLeafLump_t diff --git a/public/iachievementmgr.h b/public/iachievementmgr.h index b4b7f84e7..36027af27 100644 --- a/public/iachievementmgr.h +++ b/public/iachievementmgr.h @@ -26,21 +26,24 @@ abstract_class IAchievement virtual int GetPointValue() = 0; virtual bool ShouldSaveWithGame() = 0; virtual bool ShouldHideUntilAchieved() = 0; + virtual const char *GetIconPath() = 0; + virtual int GetDisplayOrder() = 0; }; abstract_class IAchievementMgr { public: - virtual IAchievement* GetAchievementByIndex( int index ) = 0; - virtual CBaseAchievement* GetAchievementByID ( int id ) = 0; + virtual IAchievement* GetAchievementByIndex( int index, int nPlayerSlot ) = 0; + virtual IAchievement* GetAchievementByDisplayOrder( int orderIndex, int nPlayerSlot ) = 0; + virtual CBaseAchievement* GetAchievementByID ( int id, int nPlayerSlot ) = 0; virtual int GetAchievementCount() = 0; - virtual void InitializeAchievements() = 0; - virtual void AwardAchievement( int iAchievementID ) = 0; - virtual void OnMapEvent( const char *pchEventName ) = 0; - virtual void DownloadUserData() = 0; - virtual void EnsureGlobalStateLoaded() = 0; - virtual void SaveGlobalStateIfDirty( bool bAsync ) = 0; + virtual void InitializeAchievements( ) = 0; + virtual void AwardAchievement( int nAchievementID, int nPlayerSlot ) = 0; + virtual void OnMapEvent( const char *pchEventName, int nPlayerSlot ) = 0; + virtual void SaveGlobalStateIfDirty( ) = 0; + virtual bool HasAchieved( const char *pchName, int nPlayerSlot ) = 0; + virtual const CUtlVector& GetAchievedDuringCurrentGame( int nPlayerSlot ) = 0; }; // flags for IAchievement::GetFlags @@ -54,6 +57,7 @@ abstract_class IAchievementMgr #define ACH_FILTER_ATTACKER_IS_PLAYER 0x0100 #define ACH_FILTER_VICTIM_IS_PLAYER_ENEMY 0x0200 #define ACH_FILTER_FULL_ROUND_ONLY 0x0400 +#define ACH_FILTER_LOCAL_PLAYER_EVENTS 0x0800 // Evaluate player-specific events only #define ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS ACH_LISTEN_KILL_EVENTS | ACH_FILTER_ATTACKER_IS_PLAYER | ACH_FILTER_VICTIM_IS_PLAYER_ENEMY #define ACH_LISTEN_KILL_ENEMY_EVENTS ACH_LISTEN_KILL_EVENTS | ACH_FILTER_VICTIM_IS_PLAYER_ENEMY @@ -74,3 +78,7 @@ abstract_class IAchievementMgr ( ACHIEVEMENT_LOCALIZED_DESC_FROM_STR( pAchievement->GetName() ) ) #endif // IACHIEVEMENTMGR_H + +// Special slot designations +#define SINGLE_PLAYER_SLOT 0 +#define STEAM_PLAYER_SLOT 0 \ No newline at end of file diff --git a/public/idedicatedexports.h b/public/idedicatedexports.h index c9f134120..fbd430086 100644 --- a/public/idedicatedexports.h +++ b/public/idedicatedexports.h @@ -20,6 +20,7 @@ abstract_class IDedicatedExports : public IAppSystem public: virtual void Sys_Printf( char *text ) = 0; virtual void RunServer() = 0; + virtual bool IsGuiDedicatedServer() = 0; }; #define VENGINE_DEDICATEDEXPORTS_API_VERSION "VENGINE_DEDICATEDEXPORTS_API_VERSION003" diff --git a/public/inetchannelinfo.h b/public/inetchannelinfo.h index 6fe89b01c..9f74e3938 100644 --- a/public/inetchannelinfo.h +++ b/public/inetchannelinfo.h @@ -32,6 +32,7 @@ class INetChannelInfo ENTITIES, // all other entity bytes SOUNDS, // game sounds EVENTS, // event messages + TEMPENTS, // temp entities USERMESSAGES, // user messages ENTMESSAGES, // entity messages VOICE, // voice data @@ -75,3 +76,5 @@ class INetChannelInfo }; #endif // INETCHANNELINFO_H + + diff --git a/public/inetmessage.h b/public/inetmessage.h index 0c3332f44..eceb87343 100644 --- a/public/inetmessage.h +++ b/public/inetmessage.h @@ -28,7 +28,7 @@ class INetMessage virtual void SetNetChannel(INetChannel * netchan) = 0; // netchannel this message is from/for virtual void SetReliable( bool state ) = 0; // set to true if it's a reliable message - virtual bool Process( void ) = 0; // calles the recently set handler to process this message + virtual bool Process( void ) = 0; // calls the recently set handler to process this message virtual bool ReadFromBuffer( bf_read &buffer ) = 0; // returns true if parsing was OK virtual bool WriteToBuffer( bf_write &buffer ) = 0; // returns true if writing was OK @@ -40,6 +40,7 @@ class INetMessage virtual const char *GetName( void ) const = 0; // returns network message name, eg "svc_serverinfo" virtual INetChannel *GetNetChannel( void ) const = 0; virtual const char *ToString( void ) const = 0; // returns a human readable string about message content + virtual size_t GetSize() const = 0; }; diff --git a/public/ispatialpartition.h b/public/ispatialpartition.h index cc783c556..f8f380189 100644 --- a/public/ispatialpartition.h +++ b/public/ispatialpartition.h @@ -37,6 +37,8 @@ enum PARTITION_CLIENT_STATIC_PROPS = (1 << 5), PARTITION_ENGINE_STATIC_PROPS = (1 << 6), PARTITION_CLIENT_NON_STATIC_EDICTS = (1 << 7), // everything except the static props + PARTITION_CLIENT_TRIGGER_ENTITIES = (1 << 8), // client side prediction related triggers + PARTITION_CLIENT_IK_ATTACHMENT = (1 << 9), // Can be used as an IK attachment }; // Use this to look for all client edicts. @@ -44,7 +46,8 @@ enum PARTITION_CLIENT_NON_STATIC_EDICTS | \ PARTITION_CLIENT_STATIC_PROPS | \ PARTITION_CLIENT_RESPONSIVE_EDICTS | \ - PARTITION_CLIENT_SOLID_EDICTS \ + PARTITION_CLIENT_SOLID_EDICTS | \ + PARTITION_CLIENT_TRIGGER_ENTITIES \ ) @@ -92,7 +95,6 @@ class IPartitionEnumerator class IPartitionQueryCallback { public: - virtual void OnPreQuery_V1() = 0; virtual void OnPreQuery( SpatialPartitionListMask_t listMask ) = 0; virtual void OnPostQuery( SpatialPartitionListMask_t listMask ) = 0; }; @@ -110,6 +112,8 @@ enum abstract_class ISpatialPartition { public: + virtual ~ISpatialPartition() = 0; + // Create/destroy a handle for this dude in our system. Destroy // will also remove it from all lists it happens to be in virtual SpatialPartitionHandle_t CreateHandle( IHandleEntity *pHandleEntity ) = 0; @@ -144,7 +148,7 @@ abstract_class ISpatialPartition virtual void UnhideElement( SpatialPartitionHandle_t handle, SpatialTempHandle_t tempHandle ) = 0; // Installs callbacks to get called right before a query occurs - virtual void InstallQueryCallback_V1( IPartitionQueryCallback *pCallback ) = 0; + virtual void InstallQueryCallback( IPartitionQueryCallback *pCallback ) = 0; virtual void RemoveQueryCallback( IPartitionQueryCallback *pCallback ) = 0; // Gets all entities in a particular volume... @@ -201,8 +205,6 @@ abstract_class ISpatialPartition virtual void RenderObjectsAlongRay( const Ray_t& ray, float flTime ) = 0; virtual void ReportStats( const char *pFileName ) = 0; - - virtual void InstallQueryCallback( IPartitionQueryCallback *pCallback ) = 0; }; #endif diff --git a/public/ispsharedmemory.h b/public/ispsharedmemory.h new file mode 100644 index 000000000..13d6596e1 --- /dev/null +++ b/public/ispsharedmemory.h @@ -0,0 +1,27 @@ +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +// +// Purpose: +// +//===========================================================================// + +#ifndef ISPSHAREDMEMORY_H +#define ISPSHAREDMEMORY_H +#ifdef _WIN32 +#pragma once +#endif + +#include "basetypes.h" +#include "platform.h" + +abstract_class ISPSharedMemory +{ +public: + virtual bool Init( size_t iSize ) = 0; //Initial implementation assumes the size is fixed/hardcoded, returns true if this call actually created the memory, false if it already existed + virtual uint8 * Base( void ) = 0; + virtual size_t Size( void ) = 0; + + virtual void AddRef( void ) = 0; + virtual void Release( void ) = 0; +}; + +#endif diff --git a/public/istudiorender.h b/public/istudiorender.h index e418d7469..20ceeec2b 100644 --- a/public/istudiorender.h +++ b/public/istudiorender.h @@ -20,6 +20,7 @@ #include "materialsystem/imaterialsystem.h" #include "appframework/IAppSystem.h" #include "datacache/imdlcache.h" +#include "tier0/fasttimer.h" #include "studio.h" @@ -42,6 +43,9 @@ struct FlashlightState_t; class VMatrix; namespace OptimizedModel { struct FileHeader_t; } class IPooledVBAllocator; +struct MeshInstanceData_t; +struct ShaderStencilState_t; + // undone: what's the standard for function type naming? typedef void (*StudioRender_Printf_t)( const char *fmt, ... ); @@ -113,7 +117,11 @@ enum STUDIORENDER_DRAW_ITEM_BLINK = 0x100, - STUDIORENDER_SHADOWDEPTHTEXTURE = 0x200 + STUDIORENDER_SHADOWDEPTHTEXTURE = 0x200, + + STUDIORENDER_NO_SKIN = 0x400, + + STUDIORENDER_SKIP_DECALS = 0x800, }; @@ -126,11 +134,7 @@ enum #define VERTEX_TEXCOORD0_2D ( ( (uint64) 2 ) << ( TEX_COORD_SIZE_BIT + ( 3*0 ) ) ) enum MaterialVertexFormat_t { - MATERIAL_VERTEX_FORMAT_MODEL_SKINNED = (VertexFormat_t) VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D | VERTEX_BONEWEIGHT(2) | VERTEX_BONE_INDEX | VERTEX_USERDATA_SIZE(4), - MATERIAL_VERTEX_FORMAT_MODEL_SKINNED_DX7 = (VertexFormat_t) VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D | VERTEX_BONEWEIGHT(2) | VERTEX_BONE_INDEX, - MATERIAL_VERTEX_FORMAT_MODEL = (VertexFormat_t) VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D | VERTEX_USERDATA_SIZE(4), - MATERIAL_VERTEX_FORMAT_MODEL_DX7 = (VertexFormat_t) VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D, - MATERIAL_VERTEX_FORMAT_COLOR = (VertexFormat_t) VERTEX_SPECULAR + MATERIAL_VERTEX_FORMAT_MODEL = (VertexFormat_t) VERTEX_POSITION | VERTEX_COLOR_STREAM_1 | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D | VERTEX_USERDATA_SIZE(4), }; @@ -195,9 +199,64 @@ struct DrawModelInfo_t int m_Lod; ColorMeshInfo_t *m_pColorMeshes; bool m_bStaticLighting; - Vector m_vecAmbientCube[6]; // ambient, and lights that aren't in locallight[] - int m_nLocalLightCount; - LightDesc_t m_LocalLightDescs[4]; + MaterialLightingState_t m_LightingState; +}; + +enum +{ + // This is because we store which flashlights are on which model + // in a 32-bit field (see ModelArrayInstanceData_t::m_nFlashlightUsage) + MAX_FLASHLIGHTS_PER_INSTANCE_DRAW_CALL = 32 +}; + +struct FlashlightInstance_t +{ + IMaterial *m_pDebugMaterial; + FlashlightState_t m_FlashlightState; + VMatrix m_WorldToTexture; + ITexture *m_pFlashlightDepthTexture; +}; + +struct StudioModelArrayInfo2_t +{ + int m_nFlashlightCount; + FlashlightInstance_t *m_pFlashlights; // NOTE: Can have at most MAX_FLASHLIGHTS_PER_INSTANCE_DRAW_CALL of these +}; + +struct StudioModelArrayInfo_t : public StudioModelArrayInfo2_t +{ + studiohdr_t *m_pStudioHdr; + studiohwdata_t *m_pHardwareData; +}; + +struct StudioArrayData_t +{ + studiohdr_t *m_pStudioHdr; + studiohwdata_t *m_pHardwareData; + void *m_pInstanceData; // See StudioShadowArrayInstanceData_t or StudioArrayInstanceData_t + int m_nCount; +}; + +struct StudioShadowArrayInstanceData_t +{ + int m_nLOD; + int m_nBody; + int m_nSkin; + matrix3x4a_t *m_pPoseToWorld; + float *m_pFlexWeights; + float *m_pDelayedFlexWeights; +}; + +struct StudioArrayInstanceData_t : public StudioShadowArrayInstanceData_t +{ + MaterialLightingState_t *m_pLightingState; + MaterialLightingState_t *m_pDecalLightingState; + ITexture *m_pEnvCubemapTexture; + StudioDecalHandle_t m_Decals; + uint32 m_nFlashlightUsage; // Mask indicating which flashlights to use. + ShaderStencilState_t *m_pStencilState; + ColorMeshInfo_t *m_pColorMeshInfo; + Vector4D m_DiffuseModulation; }; struct GetTriangles_Vertex_t @@ -224,14 +283,6 @@ struct GetTriangles_Output_t matrix3x4_t m_PoseToWorld[MAXSTUDIOBONES]; }; - -struct model_array_instance_t -{ - matrix3x4_t modelToWorld; - - // UNDONE: Per instance lighting values? -}; - //----------------------------------------------------------------------------- // Cache Callback Function // implementation can either statically persist data (tools) or lru cache (engine) it. @@ -252,8 +303,6 @@ abstract_class IStudioDataCache : public IAppSystem //----------------------------------------------------------------------------- // Studio render interface //----------------------------------------------------------------------------- -#define STUDIO_RENDER_INTERFACE_VERSION "VStudioRender025" - abstract_class IStudioRender : public IAppSystem { public: @@ -290,15 +339,6 @@ abstract_class IStudioRender : public IAppSystem virtual void SetViewState( const Vector& viewOrigin, const Vector& viewRight, const Vector& viewUp, const Vector& viewPlaneNormal ) = 0; - // Allocates flex weights for use in rendering - // NOTE: Pass in a non-null second parameter to lock delayed flex weights - virtual void LockFlexWeights( int nWeightCount, float **ppFlexWeights, float **ppFlexDelayedWeights = NULL ) = 0; - virtual void UnlockFlexWeights() = 0; - - // Used to allocate bone matrices to be used to pass into DrawModel - virtual matrix3x4_t* LockBoneMatrices( int nBoneCount ) = 0; - virtual void UnlockBoneMatrices() = 0; - // LOD stuff virtual int GetNumLODs( const studiohwdata_t &hardwareData ) const = 0; virtual float GetLODSwitchValue( const studiohwdata_t &hardwareData, int lod ) const = 0; @@ -357,10 +397,21 @@ abstract_class IStudioRender : public IAppSystem // Returns materials used by a particular model virtual int GetMaterialList( studiohdr_t *pStudioHdr, int count, IMaterial** ppMaterials ) = 0; virtual int GetMaterialListFromBodyAndSkin( MDLHandle_t studio, int nSkin, int nBody, int nCountOutputMaterials, IMaterial** ppOutputMaterials ) = 0; + + // no debug modes, just fastest drawing path + virtual void DrawModelArrayStaticProp( const DrawModelInfo_t& drawInfo, int nInstanceCount, const MeshInstanceData_t *pInstanceData, ColorMeshInfo_t **pColorMeshes ) = 0; + // draw an array of models with the same state - virtual void DrawModelArray( const DrawModelInfo_t &drawInfo, int arrayCount, model_array_instance_t *pInstanceData, int instanceStride, int flags = STUDIORENDER_DRAW_ENTIRE_MODEL ) = 0; -}; + virtual void DrawModelArray( const StudioModelArrayInfo_t &drawInfo, int nCount, + StudioArrayInstanceData_t *pInstanceData, int nInstanceStride, int flags = STUDIORENDER_DRAW_ENTIRE_MODEL ) = 0; + + // draw an array of models with the same state + virtual void DrawModelShadowArray( int nCount, StudioArrayData_t *pShadowData, + int nInstanceStride, int flags = STUDIORENDER_DRAW_ENTIRE_MODEL ) = 0; -extern IStudioRender *g_pStudioRender; + // draw an array of models with the same state + virtual void DrawModelArray( const StudioModelArrayInfo2_t &info, int nCount, StudioArrayData_t *pArrayData, + int nInstanceStride, int flags = STUDIORENDER_DRAW_ENTIRE_MODEL ) = 0; +}; #endif // ISTUDIORENDER_H diff --git a/public/jigglebones.cpp b/public/jigglebones.cpp index c9d227f8d..daa249e85 100644 --- a/public/jigglebones.cpp +++ b/public/jigglebones.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -7,6 +7,10 @@ #include "tier1/convar.h" #include "jigglebones.h" +#ifdef CLIENT_DLL +#include "engine/ivdebugoverlay.h" +#include "cdll_client_int.h" +#endif // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -15,28 +19,76 @@ ConVar JiggleBoneDebug( "cl_jiggle_bone_debug", "0", FCVAR_CHEAT, "Display physics-based 'jiggle bone' debugging information" ); ConVar JiggleBoneDebugYawConstraints( "cl_jiggle_bone_debug_yaw_constraints", "0", FCVAR_CHEAT, "Display physics-based 'jiggle bone' debugging information" ); ConVar JiggleBoneDebugPitchConstraints( "cl_jiggle_bone_debug_pitch_constraints", "0", FCVAR_CHEAT, "Display physics-based 'jiggle bone' debugging information" ); +ConVar JiggleBoneInvert( "cl_jiggle_bone_invert", "0", FCVAR_CHEAT ); +ConVar JiggleBoneSanity( "cl_jiggle_bone_sanity", "1", 0, "Prevent jiggle bones from pointing directly away from their target in case of numerical instability." ); +static int s_id = 2; + +#ifdef CLIENT_DLL +char *VarArgs( const char *format, ... ); +#else class CDummyOverlay { public: void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, bool noDepthTest, float duration) {}; + void AddTextOverlay(const Vector &origin, float duration, const char *text) {} }; -CDummyOverlay *debugoverlay = new CDummyOverlay; +SELECTANY CDummyOverlay *debugoverlay = new CDummyOverlay; + +char *VarArgs( const char *format, ... ) +{ + return NULL; +} +#endif //----------------------------------------------------------------------------- -JiggleData * CJiggleBones::GetJiggleData( int bone, float currenttime, const Vector &initBasePos, const Vector &initTipPos ) +JiggleData *CJiggleBones::GetJiggleData( int bone, float currenttime, const Vector &initBasePos, const Vector &initTipPos ) { FOR_EACH_LL( m_jiggleBoneState, it ) { if ( m_jiggleBoneState[it].bone == bone ) { + JiggleData *data = &m_jiggleBoneState[it]; + if ( !IsFinite( data->lastUpdate ) ) + { + Warning( "lastUpdate NaN\n" ); + } + if ( !data->basePos.IsValid() ) + { + Warning( "basePos NaN\n" ); + } + if ( !data->baseLastPos.IsValid() ) + { + Warning( "baseLastPos NaN\n" ); + } + if ( !data->baseVel.IsValid() ) + { + Warning( "baseVel NaN\n" ); + } + if ( !data->baseAccel.IsValid() ) + { + Warning( "baseAccel NaN\n" ); + } + if ( !data->tipPos.IsValid() ) + { + Warning( "tipPos NaN\n" ); + } + if ( !data->tipVel.IsValid() ) + { + Warning( "tipVel NaN\n" ); + } + if ( !data->tipAccel.IsValid() ) + { + Warning( "tipAccel NaN\n" ); + } return &m_jiggleBoneState[it]; } } JiggleData data; data.Init( bone, currenttime, initBasePos, initTipPos ); + data.id = s_id++; int idx = m_jiggleBoneState.AddToHead( data ); if ( idx == m_jiggleBoneState.InvalidIndex() ) @@ -75,6 +127,45 @@ void CJiggleBones::BuildJiggleTransformations( int boneIndex, float currenttime, data->Init( boneIndex, currenttime, goalBasePosition, goalTip ); } + if ( JiggleBoneInvert.GetBool() ) + { + data->basePos = -data->basePos; + data->baseLastPos = -data->baseLastPos; + data->baseVel = -data->baseVel; + data->baseAccel = -data->baseAccel; + data->tipPos = -data->tipPos; + data->tipVel = -data->tipVel; + data->tipAccel = -data->tipAccel; + } + +#ifdef CLIENT_DLL + if ( data->id == JiggleBoneDebug.GetInt() ) + { + int line = 20; + engine->Con_NPrintf( line++, "basePos %f %f %f", data->basePos.x, data->basePos.y, data->basePos.z ); + engine->Con_NPrintf( line++, "baseLastPos %f %f %f", data->baseLastPos.x, data->baseLastPos.y, data->baseLastPos.z ); + engine->Con_NPrintf( line++, "baseVel %f %f %f", data->baseVel.x, data->baseVel.y, data->baseVel.z ); + engine->Con_NPrintf( line++, "baseAccel %f %f %f", data->baseAccel.x, data->baseAccel.y, data->baseAccel.z ); + engine->Con_NPrintf( line++, "tipPos %f %f %f", data->tipPos.x, data->tipPos.y, data->tipPos.z ); + engine->Con_NPrintf( line++, "tipVel %f %f %f", data->tipVel.x, data->tipVel.y, data->tipVel.z ); + engine->Con_NPrintf( line++, "tipAccel %f %f %f", data->tipAccel.x, data->tipAccel.y, data->tipAccel.z ); + } +#endif + + if ( JiggleBoneSanity.GetBool() ) + { + Vector goalDir = goalTip - goalBasePosition; + goalDir.NormalizeInPlace(); + Vector dataDir = data->tipPos - goalBasePosition; + dataDir.NormalizeInPlace(); + + float dot = goalDir.Dot( dataDir ); + if ( dot < -0.9f ) // if we end up pointing almost completely away, just reset + { + data->Init( boneIndex, currenttime, goalBasePosition, goalTip ); + } + } + //Vector bodyVel; //EstimateAbsVelocity( bodyVel ); @@ -106,6 +197,7 @@ void CJiggleBones::BuildJiggleTransformations( int boneIndex, float currenttime, Vector localVel; localVel.x = DotProduct( goalLeft, data->tipVel ); localVel.y = DotProduct( goalUp, data->tipVel ); + localVel.z = 0.0f; // TODO: this was uninitialized, but is being used // yaw spring float yawAccel = jiggleInfo->yawStiffness * localError.x - jiggleInfo->yawDamping * localVel.x; @@ -235,6 +327,7 @@ void CJiggleBones::BuildJiggleTransformations( int boneIndex, float currenttime, // yaw friction - rubbing along limit plane Vector limitVel; + limitVel.x = 0.0f; // TODO: this was uninitialized, and is used when yawBounce is non-zero! limitVel.y = DotProduct( limitUp, data->tipVel ); limitVel.z = DotProduct( limitForward, data->tipVel ); @@ -335,6 +428,7 @@ void CJiggleBones::BuildJiggleTransformations( int boneIndex, float currenttime, // pitch friction - rubbing along limit plane Vector limitVel; + limitVel.x = 0.0f; // TODO: this was uninitialized, but is being used limitVel.y = DotProduct( limitUp, data->tipVel ); limitVel.z = DotProduct( limitForward, data->tipVel ); @@ -510,7 +604,7 @@ void CJiggleBones::BuildJiggleTransformations( int boneIndex, float currenttime, // debug display - if ( JiggleBoneDebug.GetBool() ) + if ( JiggleBoneDebug.GetInt() == 1 || JiggleBoneDebug.GetInt() == data->id ) { float dT = 0.01f; const float axisSize = 5.0f; @@ -518,6 +612,7 @@ void CJiggleBones::BuildJiggleTransformations( int boneIndex, float currenttime, debugoverlay->AddLineOverlay( goalBasePosition, goalBasePosition + axisSize * goalUp, 0, 255, 0, true, dT ); debugoverlay->AddLineOverlay( goalBasePosition, goalBasePosition + axisSize * goalForward, 0, 0, 255, true, dT ); + debugoverlay->AddTextOverlay( goalBasePosition, dT, VarArgs( "%d", data->id ) ); const float sz = 1.0f; diff --git a/public/jigglebones.h b/public/jigglebones.h index f2290b3a0..04c05aa32 100644 --- a/public/jigglebones.h +++ b/public/jigglebones.h @@ -39,6 +39,7 @@ struct JiggleData } int bone; + int id; float lastUpdate; // based on gpGlobals->realtime diff --git a/public/materialsystem/IColorCorrection.h b/public/materialsystem/IColorCorrection.h index 49ed4dc93..c3cc07c56 100644 --- a/public/materialsystem/IColorCorrection.h +++ b/public/materialsystem/IColorCorrection.h @@ -12,13 +12,12 @@ #endif #include "tier1/interface.h" +#include "tier0/basetypes.h" #include "bitmap/imageformat.h" typedef unsigned int ColorCorrectionHandle_t; struct ShaderColorCorrectionInfo_t; -#define COLORCORRECTION_INTERFACE_VERSION "COLORCORRECTION_VERSION_1" - abstract_class IColorCorrectionSystem { public: @@ -36,7 +35,7 @@ abstract_class IColorCorrectionSystem virtual void LockLookup( ColorCorrectionHandle_t handle ) = 0; virtual void UnlockLookup() = 0; - virtual void UnlockLookup( ColorCorrectionHandle_t handle ) = 0; + virtual void UnlockLookup( ColorCorrectionHandle_t handle, bool bDownload = true ) = 0; virtual void SetLookup( RGBX5551_t inColor, color24 outColor ) = 0; virtual void SetLookup( ColorCorrectionHandle_t handle, RGBX5551_t inColor, color24 outColor ) = 0; @@ -68,6 +67,9 @@ abstract_class IColorCorrectionSystem // FIXME: Move this to a private interface only the material system can see? virtual void GetCurrentColorCorrection( ShaderColorCorrectionInfo_t* pInfo ) = 0; + + virtual void OnProceduralRegenComplete( ColorCorrectionHandle_t handle ) = 0; }; #endif + diff --git a/public/materialsystem/IShader.h b/public/materialsystem/IShader.h index 1948cf57a..0b0f829a1 100644 --- a/public/materialsystem/IShader.h +++ b/public/materialsystem/IShader.h @@ -1,10 +1,10 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // // $NoKeywords: $ // -//=============================================================================// +//===========================================================================// #ifndef ISHADER_H #define ISHADER_H @@ -27,6 +27,7 @@ class IShaderDynamicAPI; class IShaderInit; class CBasePerMaterialContextData; + //----------------------------------------------------------------------------- // Shader flags //----------------------------------------------------------------------------- @@ -58,6 +59,44 @@ struct ShaderParamInfo_t }; + +//----------------------------------------------------------------------------- +// shaders can keep per material data in classes descended from this +//----------------------------------------------------------------------------- +class CBasePerMaterialContextData +{ +public: + uint32 m_nVarChangeID; + bool m_bMaterialVarsChanged; // set by mat system when material vars change. shader should rehtink and then clear the var + + FORCEINLINE CBasePerMaterialContextData( void ) + { + m_bMaterialVarsChanged = true; + m_nVarChangeID = 0xffffffff; + } + + // virtual destructor so that derived classes can have their own data to be cleaned up on + // delete of material + virtual ~CBasePerMaterialContextData( void ) + { + } +}; + + +//----------------------------------------------------------------------------- +// shaders can keep per instance data in classes descended from this +//----------------------------------------------------------------------------- +class CBasePerInstanceContextData +{ +public: + // virtual destructor so that derived classes can have their own data + // to be cleaned up on delete of material + virtual ~CBasePerInstanceContextData( void ) + { + } +}; + + //----------------------------------------------------------------------------- // Standard vertex shader constants //----------------------------------------------------------------------------- @@ -70,7 +109,7 @@ enum VERTEX_SHADER_LIGHT_INDEX = 3, VERTEX_SHADER_MODELVIEWPROJ = 4, VERTEX_SHADER_VIEWPROJ = 8, - VERTEX_SHADER_UNUSED = 12, + VERTEX_SHADER_SHADER_SPECIFIC_CONST_12 = 12, VERTEX_SHADER_FLEXSCALE = 13, VERTEX_SHADER_SHADER_SPECIFIC_CONST_10 = 14, VERTEX_SHADER_SHADER_SPECIFIC_CONST_11 = 15, @@ -91,11 +130,15 @@ enum VERTEX_SHADER_SHADER_SPECIFIC_CONST_8 = 56, VERTEX_SHADER_SHADER_SPECIFIC_CONST_9 = 57, VERTEX_SHADER_MODEL = 58, + // + // We reserve up through 217 for the 53 bones supported on DX9 + // VERTEX_SHADER_FLEX_WEIGHTS = 1024, VERTEX_SHADER_MAX_FLEX_WEIGHT_COUNT = 512, }; +#define VERTEX_SHADER_BONE_TRANSFORM( k ) ( VERTEX_SHADER_MODEL + 3 * (k) ) //----------------------------------------------------------------------------- // Standard vertex shader constants @@ -115,6 +158,9 @@ enum VERTEX_SHADER_SHADER_SPECIFIC_BOOL_CONST_6 = 10, VERTEX_SHADER_SHADER_SPECIFIC_BOOL_CONST_7 = 11, }; + + +//----------------------------------------------------------------------------- // The public methods exposed by each shader //----------------------------------------------------------------------------- abstract_class IShader @@ -127,18 +173,15 @@ abstract_class IShader virtual char const* GetFallbackShader( IMaterialVar** params ) const = 0; // Shader parameters - virtual int GetNumParams( ) const = 0; + virtual int GetParamCount( ) const = 0; + virtual const ShaderParamInfo_t& GetParamInfo( int paramIndex ) const = 0; // These functions must be implemented by the shader virtual void InitShaderParams( IMaterialVar** ppParams, const char *pMaterialName ) = 0; virtual void InitShaderInstance( IMaterialVar** ppParams, IShaderInit *pShaderInit, const char *pMaterialName, const char *pTextureGroupName ) = 0; virtual void DrawElements( IMaterialVar **params, int nModulationFlags, - IShaderShadow* pShaderShadow, IShaderDynamicAPI* pShaderAPI, VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr ) = 0; - - virtual char const* GetParamName( int paramIndex ) const = 0; - virtual char const* GetParamHelp( int paramIndex ) const = 0; - virtual ShaderParamType_t GetParamType( int paramIndex ) const = 0; - virtual char const* GetParamDefault( int paramIndex ) const = 0; + IShaderShadow* pShaderShadow, IShaderDynamicAPI* pShaderAPI, + VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr, CBasePerInstanceContextData** pInstanceDataPtr ) = 0; // FIXME: Figure out a better way to do this? virtual int ComputeModulationFlags( IMaterialVar** params, IShaderDynamicAPI* pShaderAPI ) = 0; @@ -146,12 +189,7 @@ abstract_class IShader virtual bool NeedsFullFrameBufferTexture( IMaterialVar **params, bool bCheckSpecificToThisFrame ) const = 0; virtual bool IsTranslucent( IMaterialVar **params ) const = 0; - virtual int GetParamFlags( int paramIndex ) const = 0; - virtual int GetFlags() const = 0; - - // FIXME: Remove GetParamName, etc. above -// virtual const ShaderParamInfo_t& GetParamInfo( int paramIndex ) const = 0; }; @@ -173,7 +211,7 @@ enum PrecompiledShaderType_t enum { // runtime flags - SHADER_DYNAMIC_COMPILE_IS_HLSL = 0x1, + SHADER_IS_ASM = 0x1, SHADER_FAILED_LOAD = 0x2, }; diff --git a/public/materialsystem/MaterialSystemUtil.cpp b/public/materialsystem/MaterialSystemUtil.cpp index 89f2a36d4..c34912e35 100644 --- a/public/materialsystem/MaterialSystemUtil.cpp +++ b/public/materialsystem/MaterialSystemUtil.cpp @@ -31,6 +31,12 @@ CMaterialReference::CMaterialReference( char const* pMaterialName, const char *p } } +const CMaterialReference& CMaterialReference::operator=( const CMaterialReference &ref ) +{ + Init( ref.m_pMaterial ); + return *this; +} + CMaterialReference::~CMaterialReference() { Shutdown(); @@ -89,11 +95,15 @@ void CMaterialReference::Init( CMaterialReference& ref ) //----------------------------------------------------------------------------- // Detach from a material //----------------------------------------------------------------------------- -void CMaterialReference::Shutdown( ) +void CMaterialReference::Shutdown( bool bDeleteIfUnreferenced /*=false*/ ) { if ( m_pMaterial && materials ) { m_pMaterial->DecrementReferenceCount(); + if ( bDeleteIfUnreferenced ) + { + m_pMaterial->DeleteIfUnreferenced(); + } m_pMaterial = NULL; } } @@ -110,22 +120,15 @@ CTextureReference::CTextureReference( ) : m_pTexture(NULL) { } -CTextureReference::CTextureReference( const CTextureReference &ref ) +CTextureReference::CTextureReference( const CTextureReference &ref ) : m_pTexture( NULL ) { - m_pTexture = ref.m_pTexture; - if ( m_pTexture ) - { - m_pTexture->IncrementReferenceCount(); - } + Init( ref.m_pTexture ); } -void CTextureReference::operator=( CTextureReference &ref ) +const CTextureReference& CTextureReference::operator=( CTextureReference &ref ) { - m_pTexture = ref.m_pTexture; - if ( m_pTexture ) - { - m_pTexture->IncrementReferenceCount(); - } + Init( ref.m_pTexture ); + return *this; } CTextureReference::~CTextureReference( ) @@ -148,12 +151,15 @@ void CTextureReference::Init( char const* pTextureName, const char *pTextureGrou void CTextureReference::Init( ITexture* pTexture ) { - Shutdown(); - - m_pTexture = pTexture; - if (m_pTexture) + if ( m_pTexture != pTexture ) { - m_pTexture->IncrementReferenceCount(); + Shutdown(); + + m_pTexture = pTexture; + if (m_pTexture) + { + m_pTexture->IncrementReferenceCount(); + } } } @@ -236,12 +242,12 @@ void CTextureReference::InitRenderTargetTexture( int w, int h, RenderTargetSizeM // The paired system memory texture can be built in an alternate format. //----------------------------------------------------------------------------- #if defined( _X360 ) -void CTextureReference::InitRenderTargetSurface( int width, int height, ImageFormat fmt, bool bSameAsTexture ) +void CTextureReference::InitRenderTargetSurface( int width, int height, ImageFormat fmt, bool bSameAsTexture, RTMultiSampleCount360_t multiSampleCount ) { // texture has to be created first Assert( m_pTexture && m_pTexture->IsRenderTarget() ); - m_pTexture->CreateRenderTargetSurface( width, height, fmt, bSameAsTexture ); + m_pTexture->CreateRenderTargetSurface( width, height, fmt, bSameAsTexture, multiSampleCount ); } #endif diff --git a/public/materialsystem/MaterialSystemUtil.h b/public/materialsystem/MaterialSystemUtil.h index bfd94ed7f..a84e510d5 100644 --- a/public/materialsystem/MaterialSystemUtil.h +++ b/public/materialsystem/MaterialSystemUtil.h @@ -15,12 +15,11 @@ #include "bitmap/imageformat.h" //ImageFormat enum definition #include "materialsystem/imaterialsystem.h" // RenderTargetSizeMode_t and MaterialRenderTargetDepth_t definition - +#include "materialsystem/itexture.h" //----------------------------------------------------------------------------- // Forward declarations //----------------------------------------------------------------------------- class IMaterial; -class ITexture; class KeyValues; class KeyValues; @@ -44,15 +43,21 @@ class CMaterialReference void Init( const char *pMaterialName, const char *pTextureGroupName, KeyValues *pVMTKeyValues ); // Detach from a material - void Shutdown(); + void Shutdown( bool bDeleteIfUnreferenced = false ); bool IsValid() { return m_pMaterial != 0; } // Automatic casts to IMaterial operator IMaterial*() { return m_pMaterial; } operator IMaterial const*() const { return m_pMaterial; } IMaterial* operator->() { return m_pMaterial; } + + // Assignment operator + const CMaterialReference& operator=( const CMaterialReference &ref ); + private: + CMaterialReference( CMaterialReference &ref ) { } + IMaterial* m_pMaterial; }; @@ -74,7 +79,7 @@ class CTextureReference #if defined( _X360 ) // used when RT coupling is disparate (texture is DDR based, surface is EDRAM based) void InitRenderTargetTexture( int width, int height, RenderTargetSizeMode_t sizeMode, ImageFormat fmt, MaterialRenderTargetDepth_t depth, bool bHDR, char *pStrOptionalName = NULL ); - void InitRenderTargetSurface( int width, int height, ImageFormat fmt, bool bSameAsTexture ); + void InitRenderTargetSurface( int width, int height, ImageFormat fmt, bool bSameAsTexture, RTMultiSampleCount360_t multiSampleCount = RT_MULTISAMPLE_NONE ); #endif void Init( ITexture* pTexture ); @@ -88,7 +93,7 @@ class CTextureReference ITexture* operator->() { return m_pTexture; } // Assignment operator - void operator=( CTextureReference &ref ); + const CTextureReference& operator=( CTextureReference &ref ); private: ITexture* m_pTexture; diff --git a/public/materialsystem/idebugtextureinfo.h b/public/materialsystem/idebugtextureinfo.h index 78542536d..eb462a55d 100644 --- a/public/materialsystem/idebugtextureinfo.h +++ b/public/materialsystem/idebugtextureinfo.h @@ -15,7 +15,6 @@ class KeyValues; // This interface is actually exported by the shader API DLL. -#define DEBUG_TEXTURE_INFO_VERSION "DebugTextureInfo001" abstract_class IDebugTextureInfo diff --git a/public/materialsystem/imaterial.h b/public/materialsystem/imaterial.h index 75089735c..49afbd929 100644 --- a/public/materialsystem/imaterial.h +++ b/public/materialsystem/imaterial.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -17,7 +17,7 @@ #include "materialsystem/imaterialsystem.h" //----------------------------------------------------------------------------- -// forward declaraions +// Forward declarations //----------------------------------------------------------------------------- class IMaterialVar; @@ -31,7 +31,7 @@ class Vector; enum VertexFormatFlags_t { // Indicates an uninitialized VertexFormat_t value - VERTEX_FORMAT_INVALID = 0xFFFFFFFFFFFFFFFFLL, + VERTEX_FORMAT_INVALID = 0xFFFFFFFFFFFFFFFFull, VERTEX_POSITION = 0x0001, VERTEX_NORMAL = 0x0002, @@ -48,8 +48,8 @@ enum VertexFormatFlags_t // Indicates we're using bone indices VERTEX_BONE_INDEX = 0x0080, - // Indicates this is a vertex shader - VERTEX_FORMAT_VERTEX_SHADER = 0x0100, + // Indicates this expects a color stream on stream 1 + VERTEX_COLOR_STREAM_1 = 0x0100, // Indicates this format shouldn't be bloated to cache align it // (only used for VertexUsage) @@ -58,8 +58,11 @@ enum VertexFormatFlags_t // Indicates that compressed vertex elements are to be used (see also VertexCompressionType_t) VERTEX_FORMAT_COMPRESSED = 0x400, + // Position or normal (if present) should be 4D not 3D + VERTEX_FORMAT_PAD_POS_NORM = 0x800, + // Update this if you add or remove bits... - VERTEX_LAST_BIT = 10, + VERTEX_LAST_BIT = 11, VERTEX_BONE_WEIGHT_BIT = VERTEX_LAST_BIT + 1, USER_DATA_SIZE_BIT = VERTEX_LAST_BIT + 4, @@ -113,14 +116,9 @@ inline int TexCoordSize( int nTexCoordIndex, VertexFormat_t vertexFormat ) return static_cast ( (vertexFormat >> (TEX_COORD_SIZE_BIT + 3*nTexCoordIndex) ) & 0x7 ); } -inline bool UsesVertexShader( VertexFormat_t vertexFormat ) -{ - return (vertexFormat & VERTEX_FORMAT_VERTEX_SHADER) != 0; -} - inline VertexCompressionType_t CompressionType( VertexFormat_t vertexFormat ) { - // This is trivial now, but we may add multiple flavours of compressed vertex later on + // This is trivial now, but we may add multiple flavors of compressed vertex later on if ( vertexFormat & VERTEX_FORMAT_COMPRESSED ) return VERTEX_COMPRESSION_ON; else @@ -140,112 +138,116 @@ enum VertexElement_t // #!#!#NOTE#!#!# update GetVertexElementSize, VertexElementToDeclType and // CVBAllocTracker (elementTable) when you update this! VERTEX_ELEMENT_POSITION = 0, - VERTEX_ELEMENT_NORMAL = 1, - VERTEX_ELEMENT_COLOR = 2, - VERTEX_ELEMENT_SPECULAR = 3, - VERTEX_ELEMENT_TANGENT_S = 4, - VERTEX_ELEMENT_TANGENT_T = 5, - VERTEX_ELEMENT_WRINKLE = 6, - VERTEX_ELEMENT_BONEINDEX = 7, - VERTEX_ELEMENT_BONEWEIGHTS1 = 8, - VERTEX_ELEMENT_BONEWEIGHTS2 = 9, - VERTEX_ELEMENT_BONEWEIGHTS3 = 10, - VERTEX_ELEMENT_BONEWEIGHTS4 = 11, - VERTEX_ELEMENT_USERDATA1 = 12, - VERTEX_ELEMENT_USERDATA2 = 13, - VERTEX_ELEMENT_USERDATA3 = 14, - VERTEX_ELEMENT_USERDATA4 = 15, - VERTEX_ELEMENT_TEXCOORD1D_0 = 16, - VERTEX_ELEMENT_TEXCOORD1D_1 = 17, - VERTEX_ELEMENT_TEXCOORD1D_2 = 18, - VERTEX_ELEMENT_TEXCOORD1D_3 = 19, - VERTEX_ELEMENT_TEXCOORD1D_4 = 20, - VERTEX_ELEMENT_TEXCOORD1D_5 = 21, - VERTEX_ELEMENT_TEXCOORD1D_6 = 22, - VERTEX_ELEMENT_TEXCOORD1D_7 = 23, - VERTEX_ELEMENT_TEXCOORD2D_0 = 24, - VERTEX_ELEMENT_TEXCOORD2D_1 = 25, - VERTEX_ELEMENT_TEXCOORD2D_2 = 26, - VERTEX_ELEMENT_TEXCOORD2D_3 = 27, - VERTEX_ELEMENT_TEXCOORD2D_4 = 28, - VERTEX_ELEMENT_TEXCOORD2D_5 = 29, - VERTEX_ELEMENT_TEXCOORD2D_6 = 30, - VERTEX_ELEMENT_TEXCOORD2D_7 = 31, - VERTEX_ELEMENT_TEXCOORD3D_0 = 32, - VERTEX_ELEMENT_TEXCOORD3D_1 = 33, - VERTEX_ELEMENT_TEXCOORD3D_2 = 34, - VERTEX_ELEMENT_TEXCOORD3D_3 = 35, - VERTEX_ELEMENT_TEXCOORD3D_4 = 36, - VERTEX_ELEMENT_TEXCOORD3D_5 = 37, - VERTEX_ELEMENT_TEXCOORD3D_6 = 38, - VERTEX_ELEMENT_TEXCOORD3D_7 = 39, - VERTEX_ELEMENT_TEXCOORD4D_0 = 40, - VERTEX_ELEMENT_TEXCOORD4D_1 = 41, - VERTEX_ELEMENT_TEXCOORD4D_2 = 42, - VERTEX_ELEMENT_TEXCOORD4D_3 = 43, - VERTEX_ELEMENT_TEXCOORD4D_4 = 44, - VERTEX_ELEMENT_TEXCOORD4D_5 = 45, - VERTEX_ELEMENT_TEXCOORD4D_6 = 46, - VERTEX_ELEMENT_TEXCOORD4D_7 = 47, - - VERTEX_ELEMENT_NUMELEMENTS = 48 + VERTEX_ELEMENT_POSITION4D = 1, + VERTEX_ELEMENT_NORMAL = 2, + VERTEX_ELEMENT_NORMAL4D = 3, + VERTEX_ELEMENT_COLOR = 4, + VERTEX_ELEMENT_SPECULAR = 5, + VERTEX_ELEMENT_TANGENT_S = 6, + VERTEX_ELEMENT_TANGENT_T = 7, + VERTEX_ELEMENT_WRINKLE = 8, + VERTEX_ELEMENT_BONEINDEX = 9, + VERTEX_ELEMENT_BONEWEIGHTS1 = 10, + VERTEX_ELEMENT_BONEWEIGHTS2 = 11, + VERTEX_ELEMENT_BONEWEIGHTS3 = 12, + VERTEX_ELEMENT_BONEWEIGHTS4 = 13, + VERTEX_ELEMENT_USERDATA1 = 14, + VERTEX_ELEMENT_USERDATA2 = 15, + VERTEX_ELEMENT_USERDATA3 = 16, + VERTEX_ELEMENT_USERDATA4 = 17, + VERTEX_ELEMENT_TEXCOORD1D_0 = 18, + VERTEX_ELEMENT_TEXCOORD1D_1 = 19, + VERTEX_ELEMENT_TEXCOORD1D_2 = 20, + VERTEX_ELEMENT_TEXCOORD1D_3 = 21, + VERTEX_ELEMENT_TEXCOORD1D_4 = 22, + VERTEX_ELEMENT_TEXCOORD1D_5 = 23, + VERTEX_ELEMENT_TEXCOORD1D_6 = 24, + VERTEX_ELEMENT_TEXCOORD1D_7 = 25, + VERTEX_ELEMENT_TEXCOORD2D_0 = 26, + VERTEX_ELEMENT_TEXCOORD2D_1 = 27, + VERTEX_ELEMENT_TEXCOORD2D_2 = 28, + VERTEX_ELEMENT_TEXCOORD2D_3 = 29, + VERTEX_ELEMENT_TEXCOORD2D_4 = 30, + VERTEX_ELEMENT_TEXCOORD2D_5 = 31, + VERTEX_ELEMENT_TEXCOORD2D_6 = 32, + VERTEX_ELEMENT_TEXCOORD2D_7 = 33, + VERTEX_ELEMENT_TEXCOORD3D_0 = 34, + VERTEX_ELEMENT_TEXCOORD3D_1 = 35, + VERTEX_ELEMENT_TEXCOORD3D_2 = 36, + VERTEX_ELEMENT_TEXCOORD3D_3 = 37, + VERTEX_ELEMENT_TEXCOORD3D_4 = 38, + VERTEX_ELEMENT_TEXCOORD3D_5 = 39, + VERTEX_ELEMENT_TEXCOORD3D_6 = 40, + VERTEX_ELEMENT_TEXCOORD3D_7 = 41, + VERTEX_ELEMENT_TEXCOORD4D_0 = 42, + VERTEX_ELEMENT_TEXCOORD4D_1 = 43, + VERTEX_ELEMENT_TEXCOORD4D_2 = 44, + VERTEX_ELEMENT_TEXCOORD4D_3 = 45, + VERTEX_ELEMENT_TEXCOORD4D_4 = 46, + VERTEX_ELEMENT_TEXCOORD4D_5 = 47, + VERTEX_ELEMENT_TEXCOORD4D_6 = 48, + VERTEX_ELEMENT_TEXCOORD4D_7 = 49, + + VERTEX_ELEMENT_NUMELEMENTS = 50 }; inline void Detect_VertexElement_t_Changes( VertexElement_t element ) // GREPs for VertexElement_t will hit this { // Make it harder for someone to change VertexElement_t without noticing that dependent code // (GetVertexElementSize, VertexElementToDeclType, CVBAllocTracker) needs updating - Assert( VERTEX_ELEMENT_NUMELEMENTS == 48 ); + Assert( VERTEX_ELEMENT_NUMELEMENTS == 50 ); switch ( element ) { case VERTEX_ELEMENT_POSITION: Assert( VERTEX_ELEMENT_POSITION == 0 ); break; - case VERTEX_ELEMENT_NORMAL: Assert( VERTEX_ELEMENT_NORMAL == 1 ); break; - case VERTEX_ELEMENT_COLOR: Assert( VERTEX_ELEMENT_COLOR == 2 ); break; - case VERTEX_ELEMENT_SPECULAR: Assert( VERTEX_ELEMENT_SPECULAR == 3 ); break; - case VERTEX_ELEMENT_TANGENT_S: Assert( VERTEX_ELEMENT_TANGENT_S == 4 ); break; - case VERTEX_ELEMENT_TANGENT_T: Assert( VERTEX_ELEMENT_TANGENT_T == 5 ); break; - case VERTEX_ELEMENT_WRINKLE: Assert( VERTEX_ELEMENT_WRINKLE == 6 ); break; - case VERTEX_ELEMENT_BONEINDEX: Assert( VERTEX_ELEMENT_BONEINDEX == 7 ); break; - case VERTEX_ELEMENT_BONEWEIGHTS1: Assert( VERTEX_ELEMENT_BONEWEIGHTS1 == 8 ); break; - case VERTEX_ELEMENT_BONEWEIGHTS2: Assert( VERTEX_ELEMENT_BONEWEIGHTS2 == 9 ); break; - case VERTEX_ELEMENT_BONEWEIGHTS3: Assert( VERTEX_ELEMENT_BONEWEIGHTS3 == 10 ); break; - case VERTEX_ELEMENT_BONEWEIGHTS4: Assert( VERTEX_ELEMENT_BONEWEIGHTS4 == 11 ); break; - case VERTEX_ELEMENT_USERDATA1: Assert( VERTEX_ELEMENT_USERDATA1 == 12 ); break; - case VERTEX_ELEMENT_USERDATA2: Assert( VERTEX_ELEMENT_USERDATA2 == 13 ); break; - case VERTEX_ELEMENT_USERDATA3: Assert( VERTEX_ELEMENT_USERDATA3 == 14 ); break; - case VERTEX_ELEMENT_USERDATA4: Assert( VERTEX_ELEMENT_USERDATA4 == 15 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_0: Assert( VERTEX_ELEMENT_TEXCOORD1D_0 == 16 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_1: Assert( VERTEX_ELEMENT_TEXCOORD1D_1 == 17 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_2: Assert( VERTEX_ELEMENT_TEXCOORD1D_2 == 18 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_3: Assert( VERTEX_ELEMENT_TEXCOORD1D_3 == 19 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_4: Assert( VERTEX_ELEMENT_TEXCOORD1D_4 == 20 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_5: Assert( VERTEX_ELEMENT_TEXCOORD1D_5 == 21 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_6: Assert( VERTEX_ELEMENT_TEXCOORD1D_6 == 22 ); break; - case VERTEX_ELEMENT_TEXCOORD1D_7: Assert( VERTEX_ELEMENT_TEXCOORD1D_7 == 23 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_0: Assert( VERTEX_ELEMENT_TEXCOORD2D_0 == 24 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_1: Assert( VERTEX_ELEMENT_TEXCOORD2D_1 == 25 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_2: Assert( VERTEX_ELEMENT_TEXCOORD2D_2 == 26 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_3: Assert( VERTEX_ELEMENT_TEXCOORD2D_3 == 27 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_4: Assert( VERTEX_ELEMENT_TEXCOORD2D_4 == 28 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_5: Assert( VERTEX_ELEMENT_TEXCOORD2D_5 == 29 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_6: Assert( VERTEX_ELEMENT_TEXCOORD2D_6 == 30 ); break; - case VERTEX_ELEMENT_TEXCOORD2D_7: Assert( VERTEX_ELEMENT_TEXCOORD2D_7 == 31 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_0: Assert( VERTEX_ELEMENT_TEXCOORD3D_0 == 32 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_1: Assert( VERTEX_ELEMENT_TEXCOORD3D_1 == 33 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_2: Assert( VERTEX_ELEMENT_TEXCOORD3D_2 == 34 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_3: Assert( VERTEX_ELEMENT_TEXCOORD3D_3 == 35 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_4: Assert( VERTEX_ELEMENT_TEXCOORD3D_4 == 36 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_5: Assert( VERTEX_ELEMENT_TEXCOORD3D_5 == 37 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_6: Assert( VERTEX_ELEMENT_TEXCOORD3D_6 == 38 ); break; - case VERTEX_ELEMENT_TEXCOORD3D_7: Assert( VERTEX_ELEMENT_TEXCOORD3D_7 == 39 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_0: Assert( VERTEX_ELEMENT_TEXCOORD4D_0 == 40 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_1: Assert( VERTEX_ELEMENT_TEXCOORD4D_1 == 41 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_2: Assert( VERTEX_ELEMENT_TEXCOORD4D_2 == 42 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_3: Assert( VERTEX_ELEMENT_TEXCOORD4D_3 == 43 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_4: Assert( VERTEX_ELEMENT_TEXCOORD4D_4 == 44 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_5: Assert( VERTEX_ELEMENT_TEXCOORD4D_5 == 45 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_6: Assert( VERTEX_ELEMENT_TEXCOORD4D_6 == 46 ); break; - case VERTEX_ELEMENT_TEXCOORD4D_7: Assert( VERTEX_ELEMENT_TEXCOORD4D_7 == 47 ); break; + case VERTEX_ELEMENT_POSITION4D: Assert( VERTEX_ELEMENT_POSITION4D == 1 ); break; + case VERTEX_ELEMENT_NORMAL: Assert( VERTEX_ELEMENT_NORMAL == 2 ); break; + case VERTEX_ELEMENT_NORMAL4D: Assert( VERTEX_ELEMENT_NORMAL4D == 3 ); break; + case VERTEX_ELEMENT_COLOR: Assert( VERTEX_ELEMENT_COLOR == 4 ); break; + case VERTEX_ELEMENT_SPECULAR: Assert( VERTEX_ELEMENT_SPECULAR == 5 ); break; + case VERTEX_ELEMENT_TANGENT_S: Assert( VERTEX_ELEMENT_TANGENT_S == 6 ); break; + case VERTEX_ELEMENT_TANGENT_T: Assert( VERTEX_ELEMENT_TANGENT_T == 7 ); break; + case VERTEX_ELEMENT_WRINKLE: Assert( VERTEX_ELEMENT_WRINKLE == 8 ); break; + case VERTEX_ELEMENT_BONEINDEX: Assert( VERTEX_ELEMENT_BONEINDEX == 9 ); break; + case VERTEX_ELEMENT_BONEWEIGHTS1: Assert( VERTEX_ELEMENT_BONEWEIGHTS1 == 10 ); break; + case VERTEX_ELEMENT_BONEWEIGHTS2: Assert( VERTEX_ELEMENT_BONEWEIGHTS2 == 11 ); break; + case VERTEX_ELEMENT_BONEWEIGHTS3: Assert( VERTEX_ELEMENT_BONEWEIGHTS3 == 12 ); break; + case VERTEX_ELEMENT_BONEWEIGHTS4: Assert( VERTEX_ELEMENT_BONEWEIGHTS4 == 13 ); break; + case VERTEX_ELEMENT_USERDATA1: Assert( VERTEX_ELEMENT_USERDATA1 == 14 ); break; + case VERTEX_ELEMENT_USERDATA2: Assert( VERTEX_ELEMENT_USERDATA2 == 15 ); break; + case VERTEX_ELEMENT_USERDATA3: Assert( VERTEX_ELEMENT_USERDATA3 == 16 ); break; + case VERTEX_ELEMENT_USERDATA4: Assert( VERTEX_ELEMENT_USERDATA4 == 17 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_0: Assert( VERTEX_ELEMENT_TEXCOORD1D_0 == 18 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_1: Assert( VERTEX_ELEMENT_TEXCOORD1D_1 == 19 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_2: Assert( VERTEX_ELEMENT_TEXCOORD1D_2 == 20 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_3: Assert( VERTEX_ELEMENT_TEXCOORD1D_3 == 21 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_4: Assert( VERTEX_ELEMENT_TEXCOORD1D_4 == 22 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_5: Assert( VERTEX_ELEMENT_TEXCOORD1D_5 == 23 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_6: Assert( VERTEX_ELEMENT_TEXCOORD1D_6 == 24 ); break; + case VERTEX_ELEMENT_TEXCOORD1D_7: Assert( VERTEX_ELEMENT_TEXCOORD1D_7 == 25 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_0: Assert( VERTEX_ELEMENT_TEXCOORD2D_0 == 26 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_1: Assert( VERTEX_ELEMENT_TEXCOORD2D_1 == 27 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_2: Assert( VERTEX_ELEMENT_TEXCOORD2D_2 == 28 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_3: Assert( VERTEX_ELEMENT_TEXCOORD2D_3 == 29 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_4: Assert( VERTEX_ELEMENT_TEXCOORD2D_4 == 30 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_5: Assert( VERTEX_ELEMENT_TEXCOORD2D_5 == 31 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_6: Assert( VERTEX_ELEMENT_TEXCOORD2D_6 == 32 ); break; + case VERTEX_ELEMENT_TEXCOORD2D_7: Assert( VERTEX_ELEMENT_TEXCOORD2D_7 == 33 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_0: Assert( VERTEX_ELEMENT_TEXCOORD3D_0 == 34 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_1: Assert( VERTEX_ELEMENT_TEXCOORD3D_1 == 35 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_2: Assert( VERTEX_ELEMENT_TEXCOORD3D_2 == 36 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_3: Assert( VERTEX_ELEMENT_TEXCOORD3D_3 == 37 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_4: Assert( VERTEX_ELEMENT_TEXCOORD3D_4 == 38 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_5: Assert( VERTEX_ELEMENT_TEXCOORD3D_5 == 39 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_6: Assert( VERTEX_ELEMENT_TEXCOORD3D_6 == 40 ); break; + case VERTEX_ELEMENT_TEXCOORD3D_7: Assert( VERTEX_ELEMENT_TEXCOORD3D_7 == 41 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_0: Assert( VERTEX_ELEMENT_TEXCOORD4D_0 == 42 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_1: Assert( VERTEX_ELEMENT_TEXCOORD4D_1 == 43 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_2: Assert( VERTEX_ELEMENT_TEXCOORD4D_2 == 44 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_3: Assert( VERTEX_ELEMENT_TEXCOORD4D_3 == 45 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_4: Assert( VERTEX_ELEMENT_TEXCOORD4D_4 == 46 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_5: Assert( VERTEX_ELEMENT_TEXCOORD4D_5 == 47 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_6: Assert( VERTEX_ELEMENT_TEXCOORD4D_6 == 48 ); break; + case VERTEX_ELEMENT_TEXCOORD4D_7: Assert( VERTEX_ELEMENT_TEXCOORD4D_7 == 49 ); break; default: Assert( 0 ); // Invalid input or VertexElement_t has definitely changed break; @@ -295,7 +297,9 @@ inline int GetVertexElementSize( VertexElement_t element, VertexCompressionType_ switch ( element ) { case VERTEX_ELEMENT_POSITION: return ( 3 * sizeof( float ) ); + case VERTEX_ELEMENT_POSITION4D: return ( 4 * sizeof( float ) ); case VERTEX_ELEMENT_NORMAL: return ( 3 * sizeof( float ) ); + case VERTEX_ELEMENT_NORMAL4D: return ( 4 * sizeof( float ) ); case VERTEX_ELEMENT_COLOR: return ( 4 * sizeof( unsigned char ) ); case VERTEX_ELEMENT_SPECULAR: return ( 4 * sizeof( unsigned char ) ); case VERTEX_ELEMENT_TANGENT_S: return ( 3 * sizeof( float ) ); @@ -366,7 +370,7 @@ enum MaterialVarFlags_t MATERIAL_VAR_SELFILLUM = (1 << 6), MATERIAL_VAR_ADDITIVE = (1 << 7), MATERIAL_VAR_ALPHATEST = (1 << 8), - MATERIAL_VAR_MULTIPASS = (1 << 9), +// MATERIAL_VAR_UNUSED = (1 << 9), MATERIAL_VAR_ZNEARER = (1 << 10), MATERIAL_VAR_MODEL = (1 << 11), MATERIAL_VAR_FLAT = (1 << 12), @@ -374,19 +378,21 @@ enum MaterialVarFlags_t MATERIAL_VAR_NOFOG = (1 << 14), MATERIAL_VAR_IGNOREZ = (1 << 15), MATERIAL_VAR_DECAL = (1 << 16), - MATERIAL_VAR_ENVMAPSPHERE = (1 << 17), - MATERIAL_VAR_NOALPHAMOD = (1 << 18), - MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), + MATERIAL_VAR_ENVMAPSPHERE = (1 << 17), // OBSOLETE +// MATERIAL_VAR_UNUSED = (1 << 18), + MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), // OBSOLETE MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20), MATERIAL_VAR_TRANSLUCENT = (1 << 21), MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22), - MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), + MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), // OBSOLETE MATERIAL_VAR_OPAQUETEXTURE = (1 << 24), - MATERIAL_VAR_ENVMAPMODE = (1 << 25), + MATERIAL_VAR_ENVMAPMODE = (1 << 25), // OBSOLETE MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26), MATERIAL_VAR_HALFLAMBERT = (1 << 27), MATERIAL_VAR_WIREFRAME = (1 << 28), MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29), + MATERIAL_VAR_ALPHA_MODIFIED_BY_PROXY = (1 << 30), + MATERIAL_VAR_VERTEXFOG = (1 << 31), // NOTE: Only add flags here that either should be read from // .vmts or can be set directly from client code. Other, internal @@ -429,6 +435,10 @@ enum MaterialVarFlags2_t MATERIAL_VAR2_USES_VERTEXID = (1 << 17), MATERIAL_VAR2_SUPPORTS_HW_SKINNING = (1 << 18), MATERIAL_VAR2_SUPPORTS_FLASHLIGHT = (1 << 19), + MATERIAL_VAR2_USE_GBUFFER0 = (1 << 20), + MATERIAL_VAR2_USE_GBUFFER1 = (1 << 21), + MATERIAL_VAR2_SELFILLUMMASK = (1 << 22), + MATERIAL_VAR2_SUPPORTS_TESSELLATION = (1 << 23) }; @@ -581,8 +591,8 @@ abstract_class IMaterial virtual float GetAlphaModulation() = 0; virtual void GetColorModulation( float *r, float *g, float *b ) = 0; - // Gets the morph format - virtual MorphFormat_t GetMorphFormat() const = 0; + // Is this translucent given a particular alpha modulation? + virtual bool IsTranslucentUnderModulation( float fAlphaModulation = 1.0f ) const = 0; // fast find that stores the index of the found var in the string table in local cache virtual IMaterialVar * FindVarFast( char const *pVarName, unsigned int *pToken ) = 0; @@ -609,4 +619,45 @@ inline bool IsErrorMaterial( IMaterial *pMat ) } +// +// Vertex stream specifications +// + +struct VertexStreamSpec_t +{ + enum StreamSpec_t + { + STREAM_DEFAULT, // stream 0: with position, normal, etc. + STREAM_SPECULAR1, // stream 1: following specular vhv lighting + STREAM_FLEXDELTA, // stream 2: flex deltas + STREAM_MORPH, // stream 3: morph + STREAM_UNIQUE_A, // unique stream 4 + STREAM_UNIQUE_B, // unique stream 5 + STREAM_UNIQUE_C, // unique stream 6 + STREAM_UNIQUE_D, // unique stream 7 + STREAM_SUBDQUADS, // stream 8: quad buffer for subd's + }; + + enum + { + MAX_UNIQUE_STREAMS = 4 + }; + + VertexFormatFlags_t iVertexDataElement; + StreamSpec_t iStreamSpec; +}; + +inline VertexStreamSpec_t * FindVertexStreamSpec( VertexFormat_t iElement, VertexStreamSpec_t *arrVertexStreamSpec ) +{ + for ( ; arrVertexStreamSpec && + arrVertexStreamSpec->iVertexDataElement != VERTEX_FORMAT_UNKNOWN ; + ++ arrVertexStreamSpec ) + { + if ( arrVertexStreamSpec->iVertexDataElement == iElement ) + return arrVertexStreamSpec; + } + return NULL; +} + + #endif // IMATERIAL_H diff --git a/public/materialsystem/imaterialproxyfactory.h b/public/materialsystem/imaterialproxyfactory.h index ba73a0776..3a6af9ddd 100644 --- a/public/materialsystem/imaterialproxyfactory.h +++ b/public/materialsystem/imaterialproxyfactory.h @@ -20,6 +20,7 @@ abstract_class IMaterialProxyFactory public: virtual IMaterialProxy *CreateProxy( const char *proxyName ) = 0; virtual void DeleteProxy( IMaterialProxy *pProxy ) = 0; + virtual CreateInterfaceFn GetFactory() = 0; }; #endif // IMATERIALPROXYFACTORY_H diff --git a/public/materialsystem/imaterialsystem.h b/public/materialsystem/imaterialsystem.h index 8d863224a..ddbf71d57 100644 --- a/public/materialsystem/imaterialsystem.h +++ b/public/materialsystem/imaterialsystem.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -31,6 +31,10 @@ #include "materialsystem/imaterialsystemhardwareconfig.h" #include "materialsystem/IColorCorrection.h" +#if !defined( _X360 ) +// NOTE: Disable this for l4d2 in general!!! It allocates 4mb of rendertargets and causes Release/Reallocation of rendertargets. +//#define FEATURE_SUBD_SUPPORT +#endif //----------------------------------------------------------------------------- // forward declarations @@ -52,6 +56,13 @@ class IMatRenderContext; class ICallQueue; struct MorphWeight_t; class IFileList; +struct VertexStreamSpec_t; +struct ShaderStencilState_t; +struct MeshInstanceData_t; +class IClientMaterialSystem; +class CPaintMaterial; +class IPaintMapDataManager; +class IPaintMapTextureManager; //----------------------------------------------------------------------------- @@ -59,14 +70,11 @@ class IFileList; //----------------------------------------------------------------------------- typedef uint64 VertexFormat_t; +#define MATERIAL_SYSTEM_INTERFACE_VERSION "VMaterialSystem080" + //----------------------------------------------------------------------------- // important enumeration //----------------------------------------------------------------------------- - -// NOTE NOTE NOTE!!!! If you up this, grep for "NEW_INTERFACE" to see if there is anything -// waiting to be enabled during an interface revision. -#define MATERIAL_SYSTEM_INTERFACE_VERSION "VMaterialSystem079" - enum ShaderParamType_t { SHADER_PARAM_TYPE_TEXTURE, @@ -89,23 +97,19 @@ enum MaterialMatrixMode_t MATERIAL_VIEW = 0, MATERIAL_PROJECTION, - // Texture matrices - MATERIAL_TEXTURE0, - MATERIAL_TEXTURE1, - MATERIAL_TEXTURE2, - MATERIAL_TEXTURE3, - MATERIAL_TEXTURE4, - MATERIAL_TEXTURE5, - MATERIAL_TEXTURE6, - MATERIAL_TEXTURE7, + MATERIAL_MATRIX_UNUSED0, + MATERIAL_MATRIX_UNUSED1, + MATERIAL_MATRIX_UNUSED2, + MATERIAL_MATRIX_UNUSED3, + MATERIAL_MATRIX_UNUSED4, + MATERIAL_MATRIX_UNUSED5, + MATERIAL_MATRIX_UNUSED6, + MATERIAL_MATRIX_UNUSED7, MATERIAL_MODEL, // Total number of matrices NUM_MATRIX_MODES = MATERIAL_MODEL+1, - - // Number of texture transforms - NUM_TEXTURE_TRANSFORMS = MATERIAL_TEXTURE7 - MATERIAL_TEXTURE0 + 1 }; // FIXME: How do I specify the actual number of matrix modes? @@ -122,6 +126,8 @@ enum MaterialPrimitiveType_t MATERIAL_LINE_LOOP, // a single line loop MATERIAL_POLYGON, // this is a *single* polygon MATERIAL_QUADS, + MATERIAL_SUBD_QUADS_EXTRA, // Extraordinary sub-d quads + MATERIAL_SUBD_QUADS_REG, // Regular sub-d quads MATERIAL_INSTANCED_QUADS, // (X360) like MATERIAL_QUADS, but uses vertex instancing // This is used for static meshes that contain multiple types of @@ -130,6 +136,13 @@ enum MaterialPrimitiveType_t MATERIAL_HETEROGENOUS }; +enum TessellationMode_t +{ + TESSELLATION_MODE_DISABLED = 0, + TESSELLATION_MODE_ACC_PATCHES_EXTRA, + TESSELLATION_MODE_ACC_PATCHES_REG +}; + enum MaterialPropertyTypes_t { MATERIAL_PROPERTY_NEEDS_LIGHTMAP = 0, // bool @@ -223,49 +236,27 @@ enum MaterialContextType_t //----------------------------------------------------------------------------- #include "mathlib/lightdesc.h" -#if 0 -enum LightType_t +enum { - MATERIAL_LIGHT_DISABLE = 0, - MATERIAL_LIGHT_POINT, - MATERIAL_LIGHT_DIRECTIONAL, - MATERIAL_LIGHT_SPOT, + MATERIAL_MAX_LIGHT_COUNT = 4, }; -enum LightType_OptimizationFlags_t +struct MaterialLightingState_t { - LIGHTTYPE_OPTIMIZATIONFLAGS_HAS_ATTENUATION0 = 1, - LIGHTTYPE_OPTIMIZATIONFLAGS_HAS_ATTENUATION1 = 2, - LIGHTTYPE_OPTIMIZATIONFLAGS_HAS_ATTENUATION2 = 4, -}; + Vector m_vecAmbientCube[6]; // ambient, and lights that aren't in locallight[] + Vector m_vecLightingOrigin; // The position from which lighting state was computed + int m_nLocalLightCount; + LightDesc_t m_pLocalLightDesc[MATERIAL_MAX_LIGHT_COUNT]; + MaterialLightingState_t &operator=( const MaterialLightingState_t &src ) + { + memcpy( this, &src, sizeof(MaterialLightingState_t) - MATERIAL_MAX_LIGHT_COUNT * sizeof(LightDesc_t) ); + memcpy( m_pLocalLightDesc, &src.m_pLocalLightDesc, src.m_nLocalLightCount * sizeof(LightDesc_t) ); + return *this; + } +}; -struct LightDesc_t -{ - LightType_t m_Type; - Vector m_Color; - Vector m_Position; - Vector m_Direction; - float m_Range; - float m_Falloff; - float m_Attenuation0; - float m_Attenuation1; - float m_Attenuation2; - float m_Theta; - float m_Phi; - // These aren't used by DX8. . used for software lighting. - float m_ThetaDot; - float m_PhiDot; - unsigned int m_Flags; - - - LightDesc_t() {} -private: - // No copy constructors allowed - LightDesc_t(const LightDesc_t& vOther); -}; -#endif #define CREATERENDERTARGETFLAGS_HDR 0x00000001 #define CREATERENDERTARGETFLAGS_AUTOMIPMAP 0x00000002 @@ -275,59 +266,6 @@ struct LightDesc_t #define CREATERENDERTARGETFLAGS_TEMP 0x00000010 // only allocates memory upon first resolve, destroyed at level end -//----------------------------------------------------------------------------- -// allowed stencil operations. These match the d3d operations -//----------------------------------------------------------------------------- -enum StencilOperation_t -{ -#if !defined( _X360 ) - STENCILOPERATION_KEEP = 1, - STENCILOPERATION_ZERO = 2, - STENCILOPERATION_REPLACE = 3, - STENCILOPERATION_INCRSAT = 4, - STENCILOPERATION_DECRSAT = 5, - STENCILOPERATION_INVERT = 6, - STENCILOPERATION_INCR = 7, - STENCILOPERATION_DECR = 8, -#else - STENCILOPERATION_KEEP = D3DSTENCILOP_KEEP, - STENCILOPERATION_ZERO = D3DSTENCILOP_ZERO, - STENCILOPERATION_REPLACE = D3DSTENCILOP_REPLACE, - STENCILOPERATION_INCRSAT = D3DSTENCILOP_INCRSAT, - STENCILOPERATION_DECRSAT = D3DSTENCILOP_DECRSAT, - STENCILOPERATION_INVERT = D3DSTENCILOP_INVERT, - STENCILOPERATION_INCR = D3DSTENCILOP_INCR, - STENCILOPERATION_DECR = D3DSTENCILOP_DECR, -#endif - STENCILOPERATION_FORCE_DWORD = 0x7fffffff -}; - -enum StencilComparisonFunction_t -{ -#if !defined( _X360 ) - STENCILCOMPARISONFUNCTION_NEVER = 1, - STENCILCOMPARISONFUNCTION_LESS = 2, - STENCILCOMPARISONFUNCTION_EQUAL = 3, - STENCILCOMPARISONFUNCTION_LESSEQUAL = 4, - STENCILCOMPARISONFUNCTION_GREATER = 5, - STENCILCOMPARISONFUNCTION_NOTEQUAL = 6, - STENCILCOMPARISONFUNCTION_GREATEREQUAL = 7, - STENCILCOMPARISONFUNCTION_ALWAYS = 8, -#else - STENCILCOMPARISONFUNCTION_NEVER = D3DCMP_NEVER, - STENCILCOMPARISONFUNCTION_LESS = D3DCMP_LESS, - STENCILCOMPARISONFUNCTION_EQUAL = D3DCMP_EQUAL, - STENCILCOMPARISONFUNCTION_LESSEQUAL = D3DCMP_LESSEQUAL, - STENCILCOMPARISONFUNCTION_GREATER = D3DCMP_GREATER, - STENCILCOMPARISONFUNCTION_NOTEQUAL = D3DCMP_NOTEQUAL, - STENCILCOMPARISONFUNCTION_GREATEREQUAL = D3DCMP_GREATEREQUAL, - STENCILCOMPARISONFUNCTION_ALWAYS = D3DCMP_ALWAYS, -#endif - - STENCILCOMPARISONFUNCTION_FORCE_DWORD = 0x7fffffff -}; - - //----------------------------------------------------------------------------- // Enumeration for the various fields capable of being morphed //----------------------------------------------------------------------------- @@ -383,6 +321,7 @@ struct MaterialAdapterInfo_t unsigned int m_SubSysID; unsigned int m_Revision; int m_nDXSupportLevel; // This is the *preferred* dx support level + int m_nMinDXSupportLevel; int m_nMaxDXSupportLevel; unsigned int m_nDriverVersionHigh; unsigned int m_nDriverVersionLow; @@ -400,6 +339,40 @@ struct MaterialVideoMode_t int m_RefreshRate; // 0 == default (ignored for windowed mode) }; + +//-------------------------------------------------------------------------------- +// Uberlight parameters +//-------------------------------------------------------------------------------- +struct UberlightState_t +{ + UberlightState_t() + { + m_fNearEdge = 2.0f; + m_fFarEdge = 100.0f; + m_fCutOn = 10.0f; + m_fCutOff = 650.0f; + m_fShearx = 0.0f; + m_fSheary = 0.0f; + m_fWidth = 0.3f; + m_fWedge = 0.05f; + m_fHeight = 0.3f; + m_fHedge = 0.05f; + m_fRoundness = 0.8f; + } + + float m_fNearEdge; + float m_fFarEdge; + float m_fCutOn; + float m_fCutOff; + float m_fShearx; + float m_fSheary; + float m_fWidth; + float m_fWedge; + float m_fHeight; + float m_fHedge; + float m_fRoundness; +}; + // fixme: should move this into something else. struct FlashlightState_t { @@ -413,12 +386,39 @@ struct FlashlightState_t m_flShadowDepthBias = 0.0005f; m_flShadowJitterSeed = 0.0f; m_flShadowAtten = 0.0f; + m_flAmbientOcclusion = 0.0f; + m_nShadowQuality = 0; + m_bShadowHighRes = false; + m_bScissor = false; m_nLeft = -1; m_nTop = -1; m_nRight = -1; m_nBottom = -1; - m_nShadowQuality = 0; + + m_bUberlight = false; + + m_bVolumetric = false; + m_flNoiseStrength = 0.8f; + m_flFlashlightTime = 0.0f; + m_nNumPlanes = 64; + m_flPlaneOffset = 0.0f; + m_flVolumetricIntensity = 1.0f; + + m_bOrtho = false; + m_fOrthoLeft = -1.0f; + m_fOrthoRight = 1.0f; + m_fOrthoTop = -1.0f; + m_fOrthoBottom = 1.0f; + + m_fBrightnessScale = 1.0f; + m_pSpotlightTexture = NULL; + m_pProjectedMaterial = NULL; + m_bGlobalLight = false; + + m_bSimpleProjection = false; + m_flProjectionSize = 500.0f; + m_flProjectionRotation = 0.0f; } Vector m_vecLightOrigin; @@ -427,12 +427,23 @@ struct FlashlightState_t float m_FarZ; float m_fHorizontalFOVDegrees; float m_fVerticalFOVDegrees; + + bool m_bOrtho; + float m_fOrthoLeft; + float m_fOrthoRight; + float m_fOrthoTop; + float m_fOrthoBottom; + float m_fQuadraticAtten; float m_fLinearAtten; float m_fConstantAtten; + float m_FarZAtten; float m_Color[4]; + float m_fBrightnessScale; ITexture *m_pSpotlightTexture; + IMaterial *m_pProjectedMaterial; int m_nSpotlightTextureFrame; + bool m_bGlobalLight; // Shadow depth mapping parameters bool m_bEnableShadows; @@ -443,14 +454,32 @@ struct FlashlightState_t float m_flShadowDepthBias; float m_flShadowJitterSeed; float m_flShadowAtten; + float m_flAmbientOcclusion; int m_nShadowQuality; + bool m_bShadowHighRes; + + // simple projection + bool m_bSimpleProjection; + float m_flProjectionSize; + float m_flProjectionRotation; + + // Uberlight parameters + bool m_bUberlight; + UberlightState_t m_uberlightState; + + bool m_bVolumetric; + float m_flNoiseStrength; + float m_flFlashlightTime; + int m_nNumPlanes; + float m_flPlaneOffset; + float m_flVolumetricIntensity; // Getters for scissor members - bool DoScissor() { return m_bScissor; } - int GetLeft() { return m_nLeft; } - int GetTop() { return m_nTop; } - int GetRight() { return m_nRight; } - int GetBottom() { return m_nBottom; } + bool DoScissor() const { return m_bScissor; } + int GetLeft() const { return m_nLeft; } + int GetTop() const { return m_nTop; } + int GetRight() const { return m_nRight; } + int GetBottom() const { return m_nBottom; } private: @@ -494,6 +523,7 @@ enum MaterialRenderTargetDepth_t enum RestoreChangeFlags_t { MATERIAL_RESTORE_VERTEX_FORMAT_CHANGED = 0x1, + MATERIAL_RESTORE_RELEASE_MANAGED_RESOURCES = 0x2, }; @@ -511,11 +541,12 @@ enum RenderTargetSizeMode_t RT_SIZE_FULL_FRAME_BUFFER_ROUNDED_UP=6 // Same size as the frame buffer, rounded up if necessary for systems that can't do non-power of two textures. }; -typedef void (*MaterialBufferReleaseFunc_t)( ); +typedef void (*MaterialBufferReleaseFunc_t)( int nChangeFlags ); // see RestoreChangeFlags_t typedef void (*MaterialBufferRestoreFunc_t)( int nChangeFlags ); // see RestoreChangeFlags_t typedef void (*ModeChangeCallbackFunc_t)( void ); +typedef void (*EndFrameCleanupFunc_t)( void ); -typedef int VertexBufferHandle_t; +//typedef int VertexBufferHandle_t; typedef unsigned short MaterialHandle_t; DECLARE_POINTER_HANDLE( OcclusionQueryObjectHandle_t ); @@ -528,6 +559,20 @@ class CShadowMgr; DECLARE_POINTER_HANDLE( MaterialLock_t ); +//----------------------------------------------------------------------------- +// Information about a material texture +//----------------------------------------------------------------------------- + +struct MaterialTextureInfo_t +{ + // Exclude information: + // -1 texture is not subject to exclude-handling + // 0 texture is completely excluded + // >0 texture is clamped according to exclude-instruction + int iExcludeInformation; +}; + + //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- @@ -639,8 +684,6 @@ abstract_class IMaterialSystem : public IAppSystem // Use this to spew information about the 3D layer virtual void SpewDriverInfo() const = 0; - virtual void GetDXLevelDefaults(uint &max_dxlevel,uint &recommended_dxlevel) = 0; - // Get the image format of the back buffer. . useful when creating render targets, etc. virtual void GetBackBufferDimensions( int &width, int &height) const = 0; virtual ImageFormat GetBackBufferFormat() const = 0; @@ -691,6 +734,10 @@ abstract_class IMaterialSystem : public IAppSystem virtual void AddRestoreFunc( MaterialBufferRestoreFunc_t func ) = 0; virtual void RemoveRestoreFunc( MaterialBufferRestoreFunc_t func ) = 0; + // Installs a function to be called when we need to delete objects at the end of the render frame + virtual void AddEndFrameCleanupFunc( EndFrameCleanupFunc_t func ) = 0; + virtual void RemoveEndFrameCleanupFunc( EndFrameCleanupFunc_t func ) = 0; + // Release temporary HW memory... virtual void ResetTempHWMemory( bool bExitingLevel = false ) = 0; @@ -732,7 +779,7 @@ abstract_class IMaterialSystem : public IAppSystem // Used to enable editor materials. Must be called before Init. virtual void EnableEditorMaterials() = 0; - + virtual void EnableGBuffers() = 0; // ----------------------------------------------------------- // Stub mode mode @@ -935,7 +982,7 @@ abstract_class IMaterialSystem : public IAppSystem virtual void ListUsedMaterials( void ) = 0; virtual HXUIFONT OpenTrueTypeFont( const char *pFontname, int tall, int style ) = 0; virtual void CloseTrueTypeFont( HXUIFONT hFont ) = 0; - virtual bool GetTrueTypeFontMetrics( HXUIFONT hFont, XUIFontMetrics *pFontMetrics, XUICharMetrics charMetrics[256] ) = 0; + virtual bool GetTrueTypeFontMetrics( HXUIFONT hFont, wchar_t wchFirst, wchar_t wchLast, XUIFontMetrics *pFontMetrics, XUICharMetrics *pCharMetrics ) = 0; // Render a sequence of characters and extract the data into a buffer // For each character, provide the width+height of the font texture subrect, // an offset to apply when rendering the glyph, and an offset into a buffer to receive the RGBA data @@ -950,7 +997,6 @@ abstract_class IMaterialSystem : public IAppSystem // ----------------------------------------------------------- virtual IMatRenderContext * GetRenderContext() = 0; - virtual bool SupportsShadowDepthTextures( void ) = 0; virtual void BeginUpdateLightmaps( void ) = 0; virtual void EndUpdateLightmaps( void ) = 0; @@ -960,11 +1006,6 @@ abstract_class IMaterialSystem : public IAppSystem virtual MaterialLock_t Lock() = 0; virtual void Unlock( MaterialLock_t ) = 0; - // Vendor-dependent shadow depth texture format - virtual ImageFormat GetShadowDepthTextureFormat() = 0; - - virtual bool SupportsFetch4( void ) = 0; - // Create a custom render context. Cannot be used to create MATERIAL_HARDWARE_CONTEXT virtual IMatRenderContext *CreateRenderContext( MaterialContextType_t type ) = 0; @@ -978,8 +1019,6 @@ abstract_class IMaterialSystem : public IAppSystem // Finds or create a procedural material. virtual IMaterial * FindProceduralMaterial( const char *pMaterialName, const char *pTextureGroupName, KeyValues *pVMTKeyValues ) = 0; - virtual ImageFormat GetNullTextureFormat() = 0; - virtual void AddTextureAlias( const char *pAlias, const char *pRealName ) = 0; virtual void RemoveTextureAlias( const char *pAlias ) = 0; @@ -997,6 +1036,24 @@ abstract_class IMaterialSystem : public IAppSystem // For sv_pure mode. The filesystem figures out which files the client needs to reload to be "pure" ala the server's preferences. virtual void ReloadFilesInList( IFileList *pFilesToReload ) = 0; + + // Get information about the texture for texture management tools + virtual bool GetTextureInformation( char const *szTextureName, MaterialTextureInfo_t &info ) const = 0; + + // call this once the render targets are allocated permanently at the beginning of the game + virtual void FinishRenderTargetAllocation( void ) = 0; + + virtual void ReEnableRenderTargetAllocation_IRealizeIfICallThisAllTexturesWillBeUnloadedAndLoadTimeWillSufferHorribly( void ) = 0; + virtual bool AllowThreading( bool bAllow, int nServiceThread ) = 0; + + virtual bool GetRecommendedVideoConfig( KeyValues *pKeyValues ) = 0; + + virtual IClientMaterialSystem* GetClientMaterialSystemInterface() = 0; + + virtual bool CanDownloadTextures() const = 0; + virtual int GetNumLightmapPages() const = 0; + + virtual IPaintMapTextureManager *RegisterPaintMapDataManager( IPaintMapDataManager *pDataManager ) = 0; //You supply an interface we can query for bits, it gives back an interface you can use to drive updates }; @@ -1035,8 +1092,8 @@ abstract_class IMatRenderContext : public IRefCounted virtual void ReadPixels( int x, int y, int width, int height, unsigned char *data, ImageFormat dstFormat ) = 0; // Sets lighting - virtual void SetAmbientLight( float r, float g, float b ) = 0; - virtual void SetLight( int lightNum, const LightDesc_t& desc ) = 0; + virtual void SetLightingState( const MaterialLightingState_t& state ) = 0; + virtual void SetLights( int nCount, const LightDesc_t *pLights ) = 0; // The faces of the cube are specified in the same order as cubemap textures virtual void SetAmbientLightCube( Vector4D cube[6] ) = 0; @@ -1079,6 +1136,7 @@ abstract_class IMatRenderContext : public IRefCounted // The cull mode virtual void CullMode( MaterialCullMode_t cullMode ) = 0; + virtual void FlipCullMode( void ) = 0; //CW->CCW or CCW->CW, intended for mirror support where the view matrix is flipped horizontally // end matrix api @@ -1105,7 +1163,7 @@ abstract_class IMatRenderContext : public IRefCounted virtual void SetNumBoneWeights( int numBones ) = 0; // Creates/destroys Mesh - virtual IMesh* CreateStaticMesh( VertexFormat_t fmt, const char *pTextureBudgetGroup, IMaterial * pMaterial = NULL ) = 0; + virtual IMesh* CreateStaticMesh( VertexFormat_t fmt, const char *pTextureBudgetGroup, IMaterial * pMaterial = NULL, VertexStreamSpec_t *pStreamSpec = NULL ) = 0; virtual void DestroyStaticMesh( IMesh* mesh ) = 0; // Gets the dynamic mesh associated with the currently bound material @@ -1143,7 +1201,7 @@ abstract_class IMatRenderContext : public IRefCounted virtual void DestroyIndexBuffer( IIndexBuffer * ) = 0; // Do we need to specify the stream here in the case of locking multiple dynamic VBs on different streams? virtual IVertexBuffer *GetDynamicVertexBuffer( int streamID, VertexFormat_t vertexFormat, bool bBuffered = true ) = 0; - virtual IIndexBuffer *GetDynamicIndexBuffer( MaterialIndexFormat_t fmt, bool bBuffered = true ) = 0; + virtual IIndexBuffer *GetDynamicIndexBuffer() = 0; virtual void BindVertexBuffer( int streamID, IVertexBuffer *pVertexBuffer, int nOffsetInBytes, int nFirstVertex, int nVertexCount, VertexFormat_t fmt, int nRepetitions = 1 ) = 0; virtual void BindIndexBuffer( IIndexBuffer *pIndexBuffer, int nOffsetInBytes ) = 0; virtual void Draw( MaterialPrimitiveType_t primitiveType, int firstIndex, int numIndices ) = 0; @@ -1217,9 +1275,6 @@ abstract_class IMatRenderContext : public IRefCounted // Used to make the handle think it's never had a successful query before virtual void ResetOcclusionQueryObject( OcclusionQueryObjectHandle_t ) = 0; - // FIXME: Remove - virtual void Unused3() {} - // Creates/destroys morph data associated w/ a particular material virtual IMorph *CreateMorph( MorphFormat_t format, const char *pDebugName ) = 0; virtual void DestroyMorph( IMorph *pMorph ) = 0; @@ -1230,12 +1285,22 @@ abstract_class IMatRenderContext : public IRefCounted // Sets flexweights for rendering virtual void SetFlexWeights( int nFirstWeight, int nCount, const MorphWeight_t* pWeights ) = 0; - // FIXME: Remove - virtual void Unused4() {}; - virtual void Unused5() {}; - virtual void Unused6() {}; - virtual void Unused7() {}; - virtual void Unused8() {}; + // Allocates temp render data. Renderdata goes out of scope at frame end in multicore + // Renderdata goes out of scope after refcount goes to zero in singlecore. + // Locking/unlocking increases + decreases refcount + virtual void * LockRenderData( int nSizeInBytes ) = 0; + virtual void UnlockRenderData( void *pData ) = 0; + + // Typed version. If specified, pSrcData is copied into the locked memory. + template< class E > E* LockRenderDataTyped( int nCount, const E* pSrcData = NULL ); + + // Temp render data gets immediately freed after it's all unlocked in single core. + // This prevents it from being freed + virtual void AddRefRenderData() = 0; + virtual void ReleaseRenderData() = 0; + + // Returns whether a pointer is render data. NOTE: passing NULL returns true + virtual bool IsRenderData( const void *pData ) const = 0; // Read w/ stretch to a host-memory buffer virtual void ReadPixelsAndStretch( Rect_t *pSrcRect, Rect_t *pDstRect, unsigned char *pBuffer, ImageFormat dstFormat, int nDstStride ) = 0; @@ -1286,6 +1351,9 @@ abstract_class IMatRenderContext : public IRefCounted // Special off-center perspective matrix for DoF, MSAA jitter and poster rendering virtual void PerspectiveOffCenterX( double fovx, double aspect, double zNear, double zFar, double bottom, double top, double left, double right ) = 0; + // Sets the ambient light color + virtual void SetAmbientLightColor( float r, float g, float b ) = 0; + // Rendering parameters control special drawing modes withing the material system, shader // system, shaders, and engine. renderparm.h has their definitions. virtual void SetFloatRenderingParameter(int parm_number, float value) = 0; @@ -1293,14 +1361,7 @@ abstract_class IMatRenderContext : public IRefCounted virtual void SetVectorRenderingParameter(int parm_number, Vector const &value) = 0; // stencil buffer operations. - virtual void SetStencilEnable(bool onoff) = 0; - virtual void SetStencilFailOperation(StencilOperation_t op) = 0; - virtual void SetStencilZFailOperation(StencilOperation_t op) = 0; - virtual void SetStencilPassOperation(StencilOperation_t op) = 0; - virtual void SetStencilCompareFunction(StencilComparisonFunction_t cmpfn) = 0; - virtual void SetStencilReferenceValue(int ref) = 0; - virtual void SetStencilTestMask(uint32 msk) = 0; - virtual void SetStencilWriteMask(uint32 msk) = 0; + virtual void SetStencilState( const ShaderStencilState_t &state ) = 0; virtual void ClearStencilBufferRectangle(int xmin, int ymin, int xmax, int ymax,int value) =0; virtual void SetRenderTargetEx( int nRenderTargetID, ITexture *pTexture ) = 0; @@ -1327,6 +1388,7 @@ abstract_class IMatRenderContext : public IRefCounted virtual IMesh *GetFlexMesh() = 0; virtual void SetFlashlightStateEx( const FlashlightState_t &state, const VMatrix &worldToTexture, ITexture *pFlashlightDepthTexture ) = 0; + virtual void SetFlashlightStateExDeRef( const FlashlightState_t &state, ITexture *pFlashlightDepthTexture ) = 0; // Returns the currently bound local cubemap virtual ITexture *GetLocalCubemap( ) = 0; @@ -1360,19 +1422,11 @@ abstract_class IMatRenderContext : public IRefCounted virtual void GetWorldSpaceCameraPosition( Vector *pCameraPos ) = 0; virtual void GetWorldSpaceCameraVectors( Vector *pVecForward, Vector *pVecRight, Vector *pVecUp ) = 0; - // Tone mapping - virtual void ResetToneMappingScale( float monoscale) = 0; // set scale to monoscale instantly with no chasing - virtual void SetGoalToneMappingScale( float monoscale) = 0; // set scale to monoscale instantly with no chasing - - // call TurnOnToneMapping before drawing the 3d scene to get the proper interpolated brightness - // value set. - virtual void TurnOnToneMapping() = 0; - // Set a linear vector color scale for all 3D rendering. // A value of [1.0f, 1.0f, 1.0f] should match non-tone-mapped rendering. virtual void SetToneMappingScaleLinear( const Vector &scale ) = 0; - virtual Vector GetToneMappingScaleLinear( void ) = 0; + virtual void SetShadowDepthBiasFactors( float fSlopeScaleDepthBias, float fDepthBias ) = 0; // Apply stencil operations to every pixel on the screen without disturbing depth or color buffers @@ -1384,7 +1438,7 @@ abstract_class IMatRenderContext : public IRefCounted // Set scissor rect for rendering virtual void SetScissorRect( const int nLeft, const int nTop, const int nRight, const int nBottom, const bool bEnableScissor ) = 0; - // Methods used to build the morph accumulator that is read from when HW morph CW) + virtual void FlipCulling( bool bFlipCulling ) = 0; + + virtual void SetTextureRenderingParameter(int parm_number, ITexture *pTexture) = 0; + + //only actually sets a bool that can be read in from shaders, doesn't do any of the legwork + virtual void EnableSinglePassFlashlightMode( bool bEnable ) = 0; + + // Draws instances with different meshes + virtual void DrawInstances( int nInstanceCount, const MeshInstanceData_t *pInstance ) = 0; + + // Allows us to override the color/alpha write settings of a material + virtual void OverrideAlphaWriteEnable( bool bOverrideEnable, bool bAlphaWriteEnable ) = 0; + virtual void OverrideColorWriteEnable( bool bOverrideEnable, bool bColorWriteEnable ) = 0; + + virtual void ClearBuffersObeyStencilEx( bool bClearColor, bool bClearAlpha, bool bClearDepth ) = 0; + + // Subdivision surface interface + virtual int GetSubDBufferWidth() = 0; + virtual float* LockSubDBuffer( int nNumRows ) = 0; + virtual void UnlockSubDBuffer() = 0; + + // Update current frame's game time for the shader api. + virtual void UpdateGameTime( float flTime ) = 0; + + virtual void PrintfVA( char *fmt, va_list vargs ) = 0; + virtual void Printf( char *fmt, ... ) = 0; + virtual float Knob( char *knobname, float *setvalue = NULL ) = 0; }; + +template< class E > inline E* IMatRenderContext::LockRenderDataTyped( int nCount, const E* pSrcData ) +{ + int nSizeInBytes = nCount * sizeof(E); + E *pDstData = (E*)LockRenderData( nSizeInBytes ); + if ( pSrcData && pDstData ) + { + memcpy( pDstData, pSrcData, nSizeInBytes ); + } + return pDstData; +} + + +//----------------------------------------------------------------------------- +// Utility class for addreffing/releasing render data (prevents freeing on single core) +//----------------------------------------------------------------------------- +class CMatRenderDataReference +{ +public: + CMatRenderDataReference(); + CMatRenderDataReference( IMatRenderContext* pRenderContext ); + ~CMatRenderDataReference(); + void Lock( IMatRenderContext *pRenderContext ); + void Release(); + +private: + IMatRenderContext *m_pRenderContext; +}; + + +inline CMatRenderDataReference::CMatRenderDataReference() +{ + m_pRenderContext = NULL; +} + +inline CMatRenderDataReference::CMatRenderDataReference( IMatRenderContext* pRenderContext ) +{ + m_pRenderContext = NULL; + Lock( pRenderContext ); +} + +inline CMatRenderDataReference::~CMatRenderDataReference() +{ + Release(); +} + +inline void CMatRenderDataReference::Lock( IMatRenderContext* pRenderContext ) +{ + if ( !m_pRenderContext ) + { + m_pRenderContext = pRenderContext; + m_pRenderContext->AddRefRenderData( ); + } +} + +inline void CMatRenderDataReference::Release() +{ + if ( m_pRenderContext ) + { + m_pRenderContext->ReleaseRenderData( ); + m_pRenderContext = NULL; + } +} + + +//----------------------------------------------------------------------------- +// Utility class for locking/unlocking render data +//----------------------------------------------------------------------------- +template< typename E > +class CMatRenderData +{ +public: + CMatRenderData( IMatRenderContext* pRenderContext ); + CMatRenderData( IMatRenderContext* pRenderContext, int nCount, const E *pSrcData = NULL ); + ~CMatRenderData(); + E* Lock( int nCount, const E* pSrcData = NULL ); + void Release(); + bool IsValid() const; + const E* Base() const; + E* Base(); + const E& operator[]( int i ) const; + E& operator[]( int i ); + +private: + IMatRenderContext* m_pRenderContext; + E *m_pRenderData; + int m_nCount; + bool m_bNeedsUnlock; +}; + +template< typename E > +inline CMatRenderData::CMatRenderData( IMatRenderContext* pRenderContext ) +{ + m_pRenderContext = pRenderContext; + m_nCount = 0; + m_pRenderData = 0; + m_bNeedsUnlock = false; +} + +template< typename E > +inline CMatRenderData::CMatRenderData( IMatRenderContext* pRenderContext, int nCount, const E* pSrcData ) +{ + m_pRenderContext = pRenderContext; + m_nCount = 0; + m_pRenderData = 0; + m_bNeedsUnlock = false; + Lock( nCount, pSrcData ); +} + +template< typename E > +inline CMatRenderData::~CMatRenderData() +{ + Release(); +} + +template< typename E > +inline bool CMatRenderData::IsValid() const +{ + return m_pRenderData != NULL; +} + +template< typename E > +inline E* CMatRenderData::Lock( int nCount, const E* pSrcData ) +{ + m_nCount = nCount; + if ( pSrcData && m_pRenderContext->IsRenderData( pSrcData ) ) + { + // Yes, we're const-casting away, but that should be ok since + // the src data is render data + m_pRenderData = const_cast( pSrcData ); + m_pRenderContext->AddRefRenderData(); + m_bNeedsUnlock = false; + return m_pRenderData; + } + m_pRenderData = m_pRenderContext->LockRenderDataTyped( nCount, pSrcData ); + m_bNeedsUnlock = true; + return m_pRenderData; +} + +template< typename E > +inline void CMatRenderData::Release() +{ + if ( m_pRenderContext && m_pRenderData ) + { + if ( m_bNeedsUnlock ) + { + m_pRenderContext->UnlockRenderData( m_pRenderData ); + } + else + { + m_pRenderContext->ReleaseRenderData(); + } + } + m_pRenderData = NULL; + m_nCount = 0; + m_bNeedsUnlock = false; +} + +template< typename E > +inline E* CMatRenderData::Base() +{ + return m_pRenderData; +} + +template< typename E > +inline const E* CMatRenderData::Base() const +{ + return m_pRenderData; +} + +template< typename E > +inline E& CMatRenderData::operator[]( int i ) +{ + Assert( ( i >= 0 ) && ( i < m_nCount ) ); + return m_pRenderData[i]; +} + +template< typename E > +inline const E& CMatRenderData::operator[]( int i ) const +{ + Assert( ( i >= 0 ) && ( i < m_nCount ) ); + return m_pRenderData[i]; +} + + //----------------------------------------------------------------------------- class CMatRenderContextPtr : public CRefPtr @@ -1511,7 +1784,4 @@ static void DoMatSysQueueMark( IMaterialSystem *pMaterialSystem, const char *psz //----------------------------------------------------------------------------- -extern IMaterialSystem *materials; -extern IMaterialSystem *g_pMaterialSystem; - #endif // IMATERIALSYSTEM_H diff --git a/public/materialsystem/imaterialsystemhardwareconfig.h b/public/materialsystem/imaterialsystemhardwareconfig.h index c4f14e553..50b517420 100644 --- a/public/materialsystem/imaterialsystemhardwareconfig.h +++ b/public/materialsystem/imaterialsystemhardwareconfig.h @@ -15,12 +15,14 @@ #include "tier1/interface.h" +#include "tier2/tier2.h" + +#include "bitmap/imageformat.h" //----------------------------------------------------------------------------- // Material system interface version //----------------------------------------------------------------------------- -#define MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION "MaterialSystemHardwareConfig012" // HDRFIXME NOTE: must match common_ps_fxc.h enum HDRType_t @@ -76,39 +78,19 @@ virtual ret_type method const = 0; class IMaterialSystemHardwareConfig { public: - // on xbox, some methods are inlined to return constants - - DEFCONFIGMETHOD( bool, HasDestAlphaBuffer(), true ); - DEFCONFIGMETHOD( bool, HasStencilBuffer(), true ); virtual int GetFrameBufferColorDepth() const = 0; virtual int GetSamplerCount() const = 0; virtual bool HasSetDeviceGammaRamp() const = 0; - DEFCONFIGMETHOD( bool, SupportsCompressedTextures(), true ); virtual VertexCompressionType_t SupportsCompressedVertices() const = 0; - DEFCONFIGMETHOD( bool, SupportsNormalMapCompression(), true ); - DEFCONFIGMETHOD( bool, SupportsVertexAndPixelShaders(), true ); - DEFCONFIGMETHOD( bool, SupportsPixelShaders_1_4(), true ); - DEFCONFIGMETHOD( bool, SupportsPixelShaders_2_0(), true ); - DEFCONFIGMETHOD( bool, SupportsVertexShaders_2_0(), true ); virtual int MaximumAnisotropicLevel() const = 0; // 0 means no anisotropic filtering virtual int MaxTextureWidth() const = 0; virtual int MaxTextureHeight() const = 0; virtual int TextureMemorySize() const = 0; - virtual bool SupportsOverbright() const = 0; - virtual bool SupportsCubeMaps() const = 0; virtual bool SupportsMipmappedCubemaps() const = 0; - virtual bool SupportsNonPow2Textures() const = 0; - // The number of texture stages represents the number of computations - // we can do in the fixed-function pipeline, it is *not* related to the - // simultaneous number of textures we can use - virtual int GetTextureStageCount() const = 0; virtual int NumVertexShaderConstants() const = 0; virtual int NumPixelShaderConstants() const = 0; virtual int MaxNumLights() const = 0; - virtual bool SupportsHardwareLighting() const = 0; - virtual int MaxBlendMatrices() const = 0; - virtual int MaxBlendMatrixIndices() const = 0; virtual int MaxTextureAspectRatio() const = 0; virtual int MaxVertexShaderBlendMatrices() const = 0; virtual int MaxUserClipPlanes() const = 0; @@ -126,18 +108,9 @@ class IMaterialSystemHardwareConfig DEFCONFIGMETHOD( bool, SupportsHDR(), true ); - virtual bool HasProjectedBumpEnv() const = 0; - virtual bool SupportsSpheremapping() const = 0; virtual bool NeedsAAClamp() const = 0; virtual bool NeedsATICentroidHack() const = 0; - virtual bool SupportsColorOnSecondStream() const = 0; - virtual bool SupportsStaticPlusDynamicLighting() const = 0; - - // Does our card have a hard time with fillrate - // relative to other cards w/ the same dx level? - virtual bool PreferReducedFillrate() const = 0; - // This is the max dx support level supported by the card virtual int GetMaxDXSupportLevel() const = 0; @@ -150,7 +123,7 @@ class IMaterialSystemHardwareConfig virtual bool IsAAEnabled() const = 0; // Is antialiasing being used? // NOTE: Anything after this was added after shipping HL2. - virtual int GetVertexTextureCount() const = 0; + virtual int GetVertexSamplerCount() const = 0; virtual int GetMaxVertexTextureDimension() const = 0; virtual int MaxTextureDepth() const = 0; @@ -158,7 +131,6 @@ class IMaterialSystemHardwareConfig virtual HDRType_t GetHDRType() const = 0; virtual HDRType_t GetHardwareHDRType() const = 0; - DEFCONFIGMETHOD( bool, SupportsPixelShaders_2_b(), true ); virtual bool SupportsStreamOffset() const = 0; virtual int StencilBufferBits() const = 0; @@ -172,13 +144,9 @@ class IMaterialSystemHardwareConfig DEFCONFIGMETHOD( bool, UsesSRGBCorrectBlending(), true ); - virtual bool SupportsShaderModel_3_0() const = 0; virtual bool HasFastVertexTextures() const = 0; virtual int MaxHWMorphBatchCount() const = 0; - // Does the board actually support this? - DEFCONFIGMETHOD( bool, ActuallySupportsPixelShaders_2_b(), true ); - virtual bool SupportsHDRMode( HDRType_t nHDRMode ) const = 0; virtual bool GetHDREnabled( void ) const = 0; @@ -186,6 +154,27 @@ class IMaterialSystemHardwareConfig virtual bool SupportsBorderColor( void ) const = 0; virtual bool SupportsFetch4( void ) const = 0; + + virtual float GetShadowDepthBias() const = 0; + virtual float GetShadowSlopeScaleDepthBias() const = 0; + + virtual bool PreferZPrepass() const = 0; + + virtual bool SuppressPixelShaderCentroidHackFixup() const = 0; + virtual bool PreferTexturesInHWMemory() const = 0; + virtual bool PreferHardwareSync() const = 0; + virtual bool ActualHasFastVertexTextures() const = 0; + + virtual bool SupportsShadowDepthTextures( void ) const = 0; + virtual ImageFormat GetShadowDepthTextureFormat( void ) const = 0; + virtual ImageFormat GetNullTextureFormat( void ) const = 0; + virtual int GetMinDXSupportLevel() const = 0; + virtual bool IsUnsupported() const = 0; + + // Backward compat for stdshaders +#if defined ( STDSHADER_DBG_DLL_EXPORT ) || defined( STDSHADER_DX9_DLL_EXPORT ) + inline bool SupportsPixelShaders_2_b() const { return GetDXSupportLevel() >= 92; } +#endif }; #endif // IMATERIALSYSTEMHARDWARECONFIG_H diff --git a/public/materialsystem/imesh.h b/public/materialsystem/imesh.h index 617bbf824..16fce7b18 100644 --- a/public/materialsystem/imesh.h +++ b/public/materialsystem/imesh.h @@ -18,6 +18,10 @@ #include "tier0/dbg.h" #include "tier2/meshutils.h" +#ifdef OSX + // leaving this disabled while we test out EXT_vertex_array_bgra on 10.6.4 drivers + //#define OPENGL_SWAP_COLORS defined +#endif //----------------------------------------------------------------------------- // forward declarations @@ -26,6 +30,7 @@ class IMaterial; class CMeshBuilder; class IMaterialVar; typedef uint64 VertexFormat_t; +struct ShaderStencilState_t; //----------------------------------------------------------------------------- @@ -157,7 +162,7 @@ struct IndexDesc_t // 1 if the device is active, 0 if the device isn't active. // Faster than doing if checks for null m_pIndices if someone is // trying to write the m_pIndices while the device is inactive. - unsigned char m_nIndexSize; + unsigned int m_nIndexSize; }; @@ -172,19 +177,48 @@ struct MeshDesc_t : public VertexDesc_t, public IndexDesc_t //----------------------------------------------------------------------------- // Standard vertex formats for models //----------------------------------------------------------------------------- -struct ModelVertexDX7_t +struct ModelVertexDX8_t { Vector m_vecPosition; - Vector2D m_flBoneWeights; - unsigned int m_nBoneIndices; Vector m_vecNormal; - unsigned int m_nColor; // ARGB Vector2D m_vecTexCoord; + Vector4D m_vecUserData; }; -struct ModelVertexDX8_t : public ModelVertexDX7_t +//--------------------------------------------------------------------------------------- +// Thin Vertex format for use with ATI tessellator in quad mode +//--------------------------------------------------------------------------------------- +struct QuadTessVertex_t { - Vector4D m_vecUserData; + Vector4D m_vTangent; // last component is Binormal flip and Wrinkle weight + Vector4D m_vUV01; // UV coordinates for points Interior (0), and Parametric V Edge (1) + Vector4D m_vUV23; // UV coordinates for points Parametric U Edge (2), and Corner (3) +}; + +struct MeshBoneRemap_t // see BoneStateChangeHeader_t +{ + DECLARE_BYTESWAP_DATADESC(); + int m_nActualBoneIndex; + int m_nSrcBoneIndex; +}; + +struct MeshInstanceData_t +{ + int m_nIndexOffset; + int m_nIndexCount; + int m_nBoneCount; + MeshBoneRemap_t * m_pBoneRemap; // there are bone count of these, they index into pose to world + matrix3x4_t * m_pPoseToWorld; // transforms for the *entire* model, indexed into by m_pBoneIndex. Potentially more than bone count of these + const ITexture * m_pEnvCubemap; + MaterialLightingState_t *m_pLightingState; + MaterialPrimitiveType_t m_nPrimType; + const IVertexBuffer * m_pVertexBuffer; + int m_nVertexOffsetInBytes; + const IIndexBuffer * m_pIndexBuffer; + const IVertexBuffer * m_pColorBuffer; + int m_nColorVertexOffsetInBytes; + ShaderStencilState_t * m_pStencilState; + Vector4D m_DiffuseModulation; }; @@ -286,7 +320,7 @@ abstract_class IIndexBuffer virtual bool Lock( int nMaxIndexCount, bool bAppend, IndexDesc_t &desc ) = 0; virtual void Unlock( int nWrittenIndexCount, IndexDesc_t &desc ) = 0; - // FIXME: Remove this!! + // FIXME: Remove this!! Here only for backward compat on IMesh // Locks, unlocks the index buffer for modify virtual void ModifyBegin( bool bReadOnly, int nFirstIndex, int nIndexCount, IndexDesc_t& desc ) = 0; virtual void ModifyEnd( IndexDesc_t& desc ) = 0; @@ -296,6 +330,9 @@ abstract_class IIndexBuffer // Ensures the data in the index buffer is valid virtual void ValidateData( int nIndexCount, const IndexDesc_t &desc ) = 0; + + // For backward compat to IMesh + virtual IMesh* GetMesh() = 0; }; @@ -352,6 +389,11 @@ abstract_class IMesh : public IVertexBuffer, public IIndexBuffer virtual void MarkAsDrawn() = 0; + // NOTE: I chose to create this method strictly because it's 2 days to code lock + // and I could use the DrawInstances technique without a larger code change + // Draws the mesh w/ modulation. + virtual void DrawModulated( const Vector4D &diffuseModulation, int nFirstIndex = -1, int nIndexCount = 0 ) = 0; + #if defined( _X360 ) virtual unsigned ComputeMemoryUsed() = 0; #endif @@ -362,6 +404,13 @@ abstract_class IMesh : public IVertexBuffer, public IIndexBuffer #define INVALID_BUFFER_OFFSET 0xFFFFFFFFUL +// flags for advancevertex optimization +#define VTX_HAVEPOS 1 +#define VTX_HAVENORMAL 2 +#define VTX_HAVECOLOR 4 +#define VTX_HAVEALL ( VTX_HAVEPOS | VTX_HAVENORMAL | VTX_HAVECOLOR ) + + //----------------------------------------------------------------------------- // // Helper class used to define vertex buffers @@ -431,7 +480,8 @@ class CVertexBuilder : private VertexDesc_t void SelectVertex( int idx ); // Advances the current vertex and index by one - void AdvanceVertex(); + void AdvanceVertex( void ); + template void AdvanceVertexF( void ); void AdvanceVertices( int nVerts ); int GetCurrentVertex() const; @@ -485,6 +535,8 @@ class CVertexBuilder : private VertexDesc_t void Color3ubv( unsigned char const* rgb ); void Color4ub( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); void Color4ubv( unsigned char const* rgba ); + void Color4Packed( int packedColor ); + int PackColor4( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); // specular color setting void Specular3f( float r, float g, float b ); @@ -522,11 +574,14 @@ class CVertexBuilder : private VertexDesc_t // bone weights void BoneWeight( int idx, float weight ); + void BoneWeights2( float weight1, float weight2 ); + // bone weights (templatized for code which needs to support compressed vertices) template void CompressedBoneWeight3fv( const float * pWeights ); // bone matrix index void BoneMatrix( int idx, int matrixIndex ); + void BoneMatrices4( int matrixIdx0, int matrixIdx1, int matrixIdx2, int matrixIdx3 ); // Generic per-vertex data void UserData( const float* pData ); @@ -536,18 +591,9 @@ class CVertexBuilder : private VertexDesc_t // Fast Vertex! No need to call advance vertex, and no random access allowed. // WARNING - these are low level functions that are intended only for use // in the software vertex skinner. - void FastVertex( const ModelVertexDX7_t &vertex ); - void FastVertexSSE( const ModelVertexDX7_t &vertex ); - - // store 4 dx7 vertices fast. for special sse dx7 pipeline - void Fast4VerticesSSE( - ModelVertexDX7_t const *vtx_a, - ModelVertexDX7_t const *vtx_b, - ModelVertexDX7_t const *vtx_c, - ModelVertexDX7_t const *vtx_d); - void FastVertex( const ModelVertexDX8_t &vertex ); void FastVertexSSE( const ModelVertexDX8_t &vertex ); + void FastQuadVertexSSE( const QuadTessVertex_t &vertex ); // Add number of verts and current vert since FastVertex routines do not update. void FastAdvanceNVertices( int n ); @@ -581,8 +627,8 @@ class CVertexBuilder : private VertexDesc_t // Optimization: Pointer to the current pos, norm, texcoord, and color mutable float *m_pCurrPosition; mutable float *m_pCurrNormal; - mutable float *m_pCurrTexCoord[VERTEX_MAX_TEXTURE_COORDINATES]; mutable unsigned char *m_pCurrColor; + mutable float *m_pCurrTexCoord[VERTEX_MAX_TEXTURE_COORDINATES]; // Total number of vertices appended int m_nTotalVertexCount; @@ -1038,26 +1084,38 @@ inline void CVertexBuilder::SelectVertex( int nIndex ) //----------------------------------------------------------------------------- // Advances vertex after you're done writing to it. //----------------------------------------------------------------------------- -inline void CVertexBuilder::AdvanceVertex() + +template FORCEINLINE void CVertexBuilder::AdvanceVertexF() { if ( ++m_nCurrentVertex > m_nVertexCount ) { m_nVertexCount = m_nCurrentVertex; } - IncrementFloatPointer( m_pCurrPosition, m_VertexSize_Position ); - IncrementFloatPointer( m_pCurrNormal, m_VertexSize_Normal ); + if ( nFlags & VTX_HAVEPOS ) + IncrementFloatPointer( m_pCurrPosition, m_VertexSize_Position ); + if ( nFlags & VTX_HAVENORMAL ) + IncrementFloatPointer( m_pCurrNormal, m_VertexSize_Normal ); + if ( nFlags & VTX_HAVECOLOR ) + m_pCurrColor += m_VertexSize_Color; COMPILE_TIME_ASSERT( VERTEX_MAX_TEXTURE_COORDINATES == 8 ); - IncrementFloatPointer( m_pCurrTexCoord[0], m_VertexSize_TexCoord[0] ); - IncrementFloatPointer( m_pCurrTexCoord[1], m_VertexSize_TexCoord[1] ); - IncrementFloatPointer( m_pCurrTexCoord[2], m_VertexSize_TexCoord[2] ); - IncrementFloatPointer( m_pCurrTexCoord[3], m_VertexSize_TexCoord[3] ); - IncrementFloatPointer( m_pCurrTexCoord[4], m_VertexSize_TexCoord[4] ); - IncrementFloatPointer( m_pCurrTexCoord[5], m_VertexSize_TexCoord[5] ); - IncrementFloatPointer( m_pCurrTexCoord[6], m_VertexSize_TexCoord[6] ); - IncrementFloatPointer( m_pCurrTexCoord[7], m_VertexSize_TexCoord[7] ); - m_pCurrColor += m_VertexSize_Color; + if ( nNumTexCoords > 0 ) + IncrementFloatPointer( m_pCurrTexCoord[0], m_VertexSize_TexCoord[0] ); + if ( nNumTexCoords > 1 ) + IncrementFloatPointer( m_pCurrTexCoord[1], m_VertexSize_TexCoord[1] ); + if ( nNumTexCoords > 2 ) + IncrementFloatPointer( m_pCurrTexCoord[2], m_VertexSize_TexCoord[2] ); + if ( nNumTexCoords > 3 ) + IncrementFloatPointer( m_pCurrTexCoord[3], m_VertexSize_TexCoord[3] ); + if ( nNumTexCoords > 4 ) + IncrementFloatPointer( m_pCurrTexCoord[4], m_VertexSize_TexCoord[4] ); + if ( nNumTexCoords > 5 ) + IncrementFloatPointer( m_pCurrTexCoord[5], m_VertexSize_TexCoord[5] ); + if ( nNumTexCoords > 6 ) + IncrementFloatPointer( m_pCurrTexCoord[6], m_VertexSize_TexCoord[6] ); + if ( nNumTexCoords > 7 ) + IncrementFloatPointer( m_pCurrTexCoord[7], m_VertexSize_TexCoord[7] ); #if ( defined( _DEBUG ) && ( COMPRESSED_NORMALS_TYPE == COMPRESSED_NORMALS_COMBINEDTANGENTS_UBYTE4 ) ) m_bWrittenNormal = false; @@ -1065,6 +1123,12 @@ inline void CVertexBuilder::AdvanceVertex() #endif } +inline void CVertexBuilder::AdvanceVertex() +{ + AdvanceVertexF(); +} + + inline void CVertexBuilder::AdvanceVertices( int nVerts ) { m_nCurrentVertex += nVerts; @@ -1103,11 +1167,7 @@ inline void CVertexBuilder::FastAdvanceNVertices( int n ) m_nVertexCount = m_nCurrentVertex; } - -//----------------------------------------------------------------------------- -// Fast Vertex! No need to call advance vertex, and no random access allowed -//----------------------------------------------------------------------------- -inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex ) +inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex ) { Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed Assert( m_nCurrentVertex < m_nMaxVertexCount ); @@ -1115,7 +1175,6 @@ inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex ) #if defined( _WIN32 ) && !defined( _X360 ) const void *pRead = &vertex; void *pCurrPos = m_pCurrPosition; - __asm { mov esi, pRead @@ -1137,12 +1196,34 @@ inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex ) emms } +#elif defined(GNUC) + const void *pRead = &vertex; + void *pCurrPos = m_pCurrPosition; + __asm__ __volatile__ ( + "movq (%0), %%mm0\n" + "movq 8(%0), %%mm1\n" + "movq 16(%0), %%mm2\n" + "movq 24(%0), %%mm3\n" + "movq 32(%0), %%mm4\n" + "movq 40(%0), %%mm5\n" + "movq 48(%0), %%mm6\n" + "movq 56(%0), %%mm7\n" + "movntq %%mm0, (%1)\n" + "movntq %%mm1, 8(%1)\n" + "movntq %%mm2, 16(%1)\n" + "movntq %%mm3, 24(%1)\n" + "movntq %%mm4, 32(%1)\n" + "movntq %%mm5, 40(%1)\n" + "movntq %%mm6, 48(%1)\n" + "movntq %%mm7, 56(%1)\n" + "emms\n" + :: "r" (pRead), "r" (pCurrPos) : "memory"); #else - Error( "Implement CMeshBuilder::FastVertex(dx7) "); + Error( "Implement CMeshBuilder::FastVertex(dx8)" ); #endif IncrementFloatPointer( m_pCurrPosition, m_VertexSize_Position ); - //m_nVertexCount = ++m_nCurrentVertex; + // m_nVertexCount = ++m_nCurrentVertex; #if ( defined( _DEBUG ) && ( COMPRESSED_NORMALS_TYPE == COMPRESSED_NORMALS_COMBINEDTANGENTS_UBYTE4 ) ) m_bWrittenNormal = false; @@ -1150,7 +1231,7 @@ inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex ) #endif } -inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX7_t &vertex ) +inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex ) { Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed Assert( m_nCurrentVertex < m_nMaxVertexCount ); @@ -1161,126 +1242,31 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX7_t &vertex ) __asm { mov esi, pRead - mov edi, pCurrPos + mov edi, pCurrPos - movaps xmm0, [esi + 0] + movaps xmm0, [esi + 0] movaps xmm1, [esi + 16] movaps xmm2, [esi + 32] movntps [edi + 0], xmm0 - movntps [edi + 16], xmm1 - movntps [edi + 32], xmm2 - } -#else - Error( "Implement CMeshBuilder::FastVertexSSE(dx7)" ); -#endif - - IncrementFloatPointer( m_pCurrPosition, m_VertexSize_Position ); - //m_nVertexCount = ++m_nCurrentVertex; - -#if ( defined( _DEBUG ) && ( COMPRESSED_NORMALS_TYPE == COMPRESSED_NORMALS_COMBINEDTANGENTS_UBYTE4 ) ) - m_bWrittenNormal = false; - m_bWrittenUserData = false; -#endif -} - -inline void CVertexBuilder::Fast4VerticesSSE( - ModelVertexDX7_t const *vtx_a, - ModelVertexDX7_t const *vtx_b, - ModelVertexDX7_t const *vtx_c, - ModelVertexDX7_t const *vtx_d) -{ - Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed - Assert( m_nCurrentVertex < m_nMaxVertexCount-3 ); - -#if defined( _WIN32 ) && !defined( _X360 ) - void *pCurrPos = m_pCurrPosition; - __asm - { - mov esi, vtx_a - mov ebx, vtx_b - - mov edi, pCurrPos - nop - - movaps xmm0, [esi + 0] - movaps xmm1, [esi + 16] - movaps xmm2, [esi + 32] - movaps xmm3, [ebx + 0] - movaps xmm4, [ebx + 16] - movaps xmm5, [ebx + 32] - - mov esi, vtx_c - mov ebx, vtx_d - - movntps [edi + 0], xmm0 - movntps [edi + 16], xmm1 - movntps [edi + 32], xmm2 - movntps [edi + 48], xmm3 - movntps [edi + 64], xmm4 - movntps [edi + 80], xmm5 - - movaps xmm0, [esi + 0] - movaps xmm1, [esi + 16] - movaps xmm2, [esi + 32] - movaps xmm3, [ebx + 0] - movaps xmm4, [ebx + 16] - movaps xmm5, [ebx + 32] - - movntps [edi + 0+96], xmm0 - movntps [edi + 16+96], xmm1 - movntps [edi + 32+96], xmm2 - movntps [edi + 48+96], xmm3 - movntps [edi + 64+96], xmm4 - movntps [edi + 80+96], xmm5 - + movntps [edi + 16], xmm1 + movntps [edi + 32], xmm2 } -#else - Error( "Implement CMeshBuilder::Fast4VerticesSSE\n"); -#endif - IncrementFloatPointer( m_pCurrPosition, 4*m_VertexSize_Position ); - -#if ( defined( _DEBUG ) && ( COMPRESSED_NORMALS_TYPE == COMPRESSED_NORMALS_COMBINEDTANGENTS_UBYTE4 ) ) - m_bWrittenNormal = false; - m_bWrittenUserData = false; -#endif -} - -inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex ) -{ - Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed - Assert( m_nCurrentVertex < m_nMaxVertexCount ); - -#if defined( _WIN32 ) && !defined( _X360 ) +#elif defined(GNUC) const void *pRead = &vertex; void *pCurrPos = m_pCurrPosition; - __asm - { - mov esi, pRead - mov edi, pCurrPos - - movq mm0, [esi + 0] - movq mm1, [esi + 8] - movq mm2, [esi + 16] - movq mm3, [esi + 24] - movq mm4, [esi + 32] - movq mm5, [esi + 40] - movq mm6, [esi + 48] - movq mm7, [esi + 56] - - movntq [edi + 0], mm0 - movntq [edi + 8], mm1 - movntq [edi + 16], mm2 - movntq [edi + 24], mm3 - movntq [edi + 32], mm4 - movntq [edi + 40], mm5 - movntq [edi + 48], mm6 - movntq [edi + 56], mm7 - - emms - } + __asm__ __volatile__ ( + "movaps (%0), %%xmm0\n" + "movaps 16(%0), %%xmm1\n" + "movaps 32(%0), %%xmm2\n" + "movaps 48(%0), %%xmm3\n" + "movntps %%xmm0, (%1)\n" + "movntps %%xmm1, 16(%1)\n" + "movntps %%xmm2, 32(%1)\n" + "movntps %%xmm3, 48(%1)\n" + :: "r" (pRead), "r" (pCurrPos) : "memory"); #else - Error( "Implement CMeshBuilder::FastVertex(dx8)" ); + Error( "Implement CMeshBuilder::FastVertexSSE((dx8)" ); #endif IncrementFloatPointer( m_pCurrPosition, m_VertexSize_Position ); @@ -1292,7 +1278,8 @@ inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex ) #endif } -inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex ) + +inline void CVertexBuilder::FastQuadVertexSSE( const QuadTessVertex_t &vertex ) { Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed Assert( m_nCurrentVertex < m_nMaxVertexCount ); @@ -1303,20 +1290,16 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex ) __asm { mov esi, pRead - mov edi, pCurrPos + mov edi, pCurrPos - movaps xmm0, [esi + 0] + movaps xmm0, [esi + 0] movaps xmm1, [esi + 16] movaps xmm2, [esi + 32] - movaps xmm3, [esi + 48] movntps [edi + 0], xmm0 - movntps [edi + 16], xmm1 - movntps [edi + 32], xmm2 - movntps [edi + 48], xmm3 + movntps [edi + 16], xmm1 + movntps [edi + 32], xmm2 } -#else - Error( "Implement CMeshBuilder::FastVertexSSE((dx8)" ); #endif IncrementFloatPointer( m_pCurrPosition, m_VertexSize_Position ); @@ -1329,6 +1312,7 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex ) } + //----------------------------------------------------------------------------- // Returns the current vertex //----------------------------------------------------------------------------- @@ -1355,22 +1339,6 @@ inline void CVertexBuilder::VertexDX8ToX360( const ModelVertexDX8_t &vertex ) memcpy( pDst, vertex.m_vecPosition.Base(), sizeof( vertex.m_vecPosition ) ); pDst += sizeof( vertex.m_vecPosition ); - if ( m_VertexSize_BoneWeight ) - { - Assert( vertex.m_flBoneWeights[0] >= 0 && vertex.m_flBoneWeights[0] <= 1.0f ); - Assert( vertex.m_flBoneWeights[1] >= 0 && vertex.m_flBoneWeights[1] <= 1.0f ); - Assert( GetVertexElementSize( VERTEX_ELEMENT_BONEWEIGHTS2, VERTEX_COMPRESSION_NONE ) == sizeof( vertex.m_flBoneWeights ) ); - memcpy( pDst, vertex.m_flBoneWeights.Base(), sizeof( vertex.m_flBoneWeights ) ); - pDst += sizeof( vertex.m_flBoneWeights ); - - if ( m_VertexSize_BoneMatrixIndex ) - { - Assert( GetVertexElementSize( VERTEX_ELEMENT_BONEINDEX, VERTEX_COMPRESSION_NONE ) == sizeof( vertex.m_nBoneIndices ) ); - *(unsigned int*)pDst = vertex.m_nBoneIndices; - pDst += sizeof( vertex.m_nBoneIndices ); - } - } - if ( m_VertexSize_Normal ) { Assert( GetVertexElementSize( VERTEX_ELEMENT_NORMAL, VERTEX_COMPRESSION_NONE ) == sizeof( vertex.m_vecNormal ) ); @@ -1378,13 +1346,6 @@ inline void CVertexBuilder::VertexDX8ToX360( const ModelVertexDX8_t &vertex ) pDst += sizeof( vertex.m_vecNormal ); } - if ( m_VertexSize_Color ) - { - Assert( GetVertexElementSize( VERTEX_ELEMENT_COLOR, VERTEX_COMPRESSION_NONE ) == sizeof( vertex.m_nColor ) ); - *(unsigned int*)pDst = vertex.m_nColor; - pDst += sizeof( vertex.m_nColor ); - } - if ( m_VertexSize_TexCoord[0] ) { Assert( GetVertexElementSize( VERTEX_ELEMENT_TEXCOORD2D_0, VERTEX_COMPRESSION_NONE ) == sizeof( vertex.m_vecTexCoord ) ); @@ -1716,10 +1677,18 @@ inline void CVertexBuilder::Color4fv( const float *rgba ) //----------------------------------------------------------------------------- // Faster versions of color //----------------------------------------------------------------------------- + +// note that on the OSX target (OpenGL) whenever there is vertex data being written as bytes - they need to be written in R,G,B,A memory order + inline void CVertexBuilder::Color3ub( unsigned char r, unsigned char g, unsigned char b ) { Assert( m_pColor && m_pCurrColor ); - int col = b | (g << 8) | (r << 16) | 0xFF000000; + #ifdef OPENGL_SWAP_COLORS + int col = r | (g << 8) | (b << 16) | 0xFF000000; // r, g, b, a in memory + #else + int col = b | (g << 8) | (r << 16) | 0xFF000000; + #endif + *(int*)m_pCurrColor = col; } @@ -1727,15 +1696,24 @@ inline void CVertexBuilder::Color3ubv( unsigned char const* rgb ) { Assert(rgb); Assert( m_pColor && m_pCurrColor ); + #ifdef OPENGL_SWAP_COLORS + int col = rgb[0] | (rgb[1] << 8) | (rgb[2] << 16) | 0xFF000000; // r, g, b, a in memory + #else + int col = rgb[2] | (rgb[1] << 8) | (rgb[0] << 16) | 0xFF000000; + #endif - int col = rgb[2] | (rgb[1] << 8) | (rgb[0] << 16) | 0xFF000000; *(int*)m_pCurrColor = col; } inline void CVertexBuilder::Color4ub( unsigned char r, unsigned char g, unsigned char b, unsigned char a ) { Assert( m_pColor && m_pCurrColor ); - int col = b | (g << 8) | (r << 16) | (a << 24); + #ifdef OPENGL_SWAP_COLORS + int col = r | (g << 8) | (b << 16) | (a << 24); // r, g, b, a in memory + #else + int col = b | (g << 8) | (r << 16) | (a << 24); + #endif + *(int*)m_pCurrColor = col; } @@ -1743,10 +1721,25 @@ inline void CVertexBuilder::Color4ubv( unsigned char const* rgba ) { Assert( rgba ); Assert( m_pColor && m_pCurrColor ); - int col = rgba[2] | (rgba[1] << 8) | (rgba[0] << 16) | (rgba[3] << 24); + #ifdef OPENGL_SWAP_COLORS + int col = rgba[0] | (rgba[1] << 8) | (rgba[2] << 16) | (rgba[3] << 24); // r, g, b, a in memory + #else + int col = rgba[2] | (rgba[1] << 8) | (rgba[0] << 16) | (rgba[3] << 24); + #endif *(int*)m_pCurrColor = col; } +FORCEINLINE void CVertexBuilder::Color4Packed( int packedColor ) +{ + *(int*)m_pCurrColor = packedColor; +} + +FORCEINLINE int CVertexBuilder::PackColor4( unsigned char r, unsigned char g, unsigned char b, unsigned char a ) +{ + return b | (g << 8) | (r << 16) | (a << 24); +} + + inline void CVertexBuilder::Specular3f( float r, float g, float b ) { Assert( m_pSpecular ); @@ -1801,7 +1794,13 @@ inline void CVertexBuilder::Specular3ub( unsigned char r, unsigned char g, unsig { Assert( m_pSpecular ); unsigned char *pSpecular = &m_pSpecular[m_nCurrentVertex * m_VertexSize_Specular]; - int col = b | (g << 8) | (r << 16) | 0xFF000000; + + #ifdef OPENGL_SWAP_COLORS + int col = r | (g << 8) | (b << 16) | 0xFF000000; // r, g, b, a in memory + #else + int col = b | (g << 8) | (r << 16) | 0xFF000000; + #endif + *(int*)pSpecular = col; } @@ -1809,7 +1808,13 @@ inline void CVertexBuilder::Specular3ubv( unsigned char const *c ) { Assert( m_pSpecular ); unsigned char *pSpecular = &m_pSpecular[m_nCurrentVertex * m_VertexSize_Specular]; - int col = c[2] | (c[1] << 8) | (c[0] << 16) | 0xFF000000; + + #ifdef OPENGL_SWAP_COLORS + int col = c[0] | (c[1] << 8) | (c[2] << 16) | 0xFF000000; // r, g, b, a in memory + #else + int col = c[2] | (c[1] << 8) | (c[0] << 16) | 0xFF000000; + #endif + *(int*)pSpecular = col; } @@ -1817,7 +1822,13 @@ inline void CVertexBuilder::Specular4ub( unsigned char r, unsigned char g, unsig { Assert( m_pSpecular ); unsigned char *pSpecular = &m_pSpecular[m_nCurrentVertex * m_VertexSize_Specular]; - int col = b | (g << 8) | (r << 16) | (a << 24); + + #ifdef OPENGL_SWAP_COLORS + int col = r | (g << 8) | (b << 16) | (a << 24); // r, g, b, a in memory + #else + int col = b | (g << 8) | (r << 16) | (a << 24); + #endif + *(int*)pSpecular = col; } @@ -1825,7 +1836,13 @@ inline void CVertexBuilder::Specular4ubv( unsigned char const *c ) { Assert( m_pSpecular ); unsigned char *pSpecular = &m_pSpecular[m_nCurrentVertex * m_VertexSize_Specular]; - int col = c[2] | (c[1] << 8) | (c[0] << 16) | (c[3] << 24); + + #ifdef OPENGL_SWAP_COLORS + int col = c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24); + #else + int col = c[2] | (c[1] << 8) | (c[0] << 16) | (c[3] << 24); + #endif + *(int*)pSpecular = col; } @@ -2016,6 +2033,19 @@ inline void CVertexBuilder::BoneWeight( int idx, float weight ) } } +inline void CVertexBuilder::BoneWeights2( float weight1, float weight2 ) +{ + Assert( m_pBoneWeight ); + Assert( IsFinite( weight1 ) && IsFinite( weight2 ) ); + AssertOnce( m_NumBoneWeights == 2 ); + + // This test is here because we store N-1 bone weights (the Nth is computed in + // the vertex shader as "1 - C", where C is the sum of the (N-1) other weights) + float* pBoneWeight = OffsetFloatPointer( m_pBoneWeight, m_nCurrentVertex, m_VertexSize_BoneWeight ); + pBoneWeight[0] = weight1; + pBoneWeight[1] = weight2; +} + inline void CVertexBuilder::BoneMatrix( int idx, int matrixIdx ) { Assert( m_pBoneMatrixIndex ); @@ -2043,6 +2073,38 @@ inline void CVertexBuilder::BoneMatrix( int idx, int matrixIdx ) #endif } +inline void CVertexBuilder::BoneMatrices4( int matrixIdx0, int matrixIdx1, int matrixIdx2, int matrixIdx3 ) +{ + Assert( m_pBoneMatrixIndex ); + + // garymcthack + Assert( matrixIdx0 != BONE_MATRIX_INDEX_INVALID ); + Assert( matrixIdx1 != BONE_MATRIX_INDEX_INVALID ); + Assert( matrixIdx2 != BONE_MATRIX_INDEX_INVALID ); + Assert( matrixIdx3 != BONE_MATRIX_INDEX_INVALID ); + +#ifndef NEW_SKINNING + int nVal; + if ( IsX360() ) + { + // store sequentially as wzyx order, gpu delivers as xyzw + nVal = matrixIdx3 | ( matrixIdx2 << 8 ) | ( matrixIdx1 << 16 ) | ( matrixIdx0 << 24 ); + } + else + { + nVal = matrixIdx0 | ( matrixIdx1 << 8 ) | ( matrixIdx2 << 16 ) | ( matrixIdx3 << 24 ); + } + int* pBoneMatrix = (int*)( &m_pBoneMatrixIndex[m_nCurrentVertex * m_VertexSize_BoneMatrixIndex] ); + *pBoneMatrix = nVal; +#else + float* pBoneMatrix = &m_pBoneMatrixIndex[m_nCurrentVertex * m_VertexSize_BoneMatrixIndex]; + pBoneMatrix[0] = matrixIdx0; + pBoneMatrix[1] = matrixIdx1; + pBoneMatrix[2] = matrixIdx2; + pBoneMatrix[3] = matrixIdx3; +#endif +} + //----------------------------------------------------------------------------- // Templatized bone weight setting methods which support compressed vertices //----------------------------------------------------------------------------- @@ -2256,6 +2318,12 @@ class CIndexBuilder : private IndexDesc_t void AttachBeginModify( IMesh* pMesh, int nFirstIndex, int nIndexCount, const MeshDesc_t &desc ); void AttachEndModify(); + void FastTriangle( int startVert ); + void FastQuad( int startVert ); + void FastPolygon( int startVert, int numTriangles ); + void FastPolygonList( int startVert, int *pVertexCount, int polygonCount ); + void FastIndexList( const unsigned short *pIndexList, int startVert, int indexCount ); + private: // The mesh we're modifying IIndexBuffer *m_pIndexBuffer; @@ -2344,6 +2412,7 @@ inline bool CIndexBuilder::Lock( int nMaxIndexCount, int nIndexOffset, bool bApp m_bModify = false; m_nIndexOffset = nIndexOffset; m_nMaxIndexCount = nMaxIndexCount; + m_nIndexCount = 0; bool bFirstLock = ( m_nBufferOffset == INVALID_BUFFER_OFFSET ); if ( bFirstLock ) { @@ -2662,6 +2731,99 @@ inline void CIndexBuilder::FastIndex( unsigned short nIndex ) m_nIndexCount = m_nCurrentIndex; } +FORCEINLINE void CIndexBuilder::FastTriangle( int startVert ) +{ + startVert += m_nIndexOffset; + unsigned short *pIndices = &m_pIndices[m_nCurrentIndex]; + *pIndices++ = startVert++; + *pIndices++ = startVert++; + *pIndices++ = startVert; + AdvanceIndices(3); +} + +FORCEINLINE void CIndexBuilder::FastQuad( int startVert ) +{ + startVert += m_nIndexOffset; + unsigned short *pIndices = &m_pIndices[m_nCurrentIndex]; + *pIndices++ = startVert++; + *pIndices++ = startVert++; + *pIndices++ = startVert; + + *pIndices++ = startVert - 2; + *pIndices++ = startVert++; + *pIndices++ = startVert; + AdvanceIndices(6); +} + +inline void CIndexBuilder::FastPolygon( int startVert, int triangleCount ) +{ + unsigned short *pIndex = &m_pIndices[m_nCurrentIndex]; + startVert += m_nIndexOffset; + if ( !IsX360() ) + { + // NOTE: IndexSize is 1 or 0 (0 for alt-tab) + // This prevents us from writing into bogus memory + Assert( m_nIndexSize == 0 || m_nIndexSize == 1 ); + triangleCount *= m_nIndexSize; + } + for ( int v = 0; v < triangleCount; ++v ) + { + *pIndex++ = startVert; + *pIndex++ = startVert + v + 1; + *pIndex++ = startVert + v + 2; + } + AdvanceIndices(triangleCount*3); +} + +inline void CIndexBuilder::FastPolygonList( int startVert, int *pVertexCount, int polygonCount ) +{ + unsigned short *pIndex = &m_pIndices[m_nCurrentIndex]; + startVert += m_nIndexOffset; + int indexOut = 0; + + if ( !IsX360() ) + { + // NOTE: IndexSize is 1 or 0 (0 for alt-tab) + // This prevents us from writing into bogus memory + Assert( m_nIndexSize == 0 || m_nIndexSize == 1 ); + polygonCount *= m_nIndexSize; + } + + for ( int i = 0; i < polygonCount; i++ ) + { + int vertexCount = pVertexCount[i]; + int triangleCount = vertexCount-2; + for ( int v = 0; v < triangleCount; ++v ) + { + *pIndex++ = startVert; + *pIndex++ = startVert + v + 1; + *pIndex++ = startVert + v + 2; + } + startVert += vertexCount; + indexOut += triangleCount * 3; + } + AdvanceIndices(indexOut); +} + +inline void CIndexBuilder::FastIndexList( const unsigned short *pIndexList, int startVert, int indexCount ) +{ + unsigned short *pIndexOut = &m_pIndices[m_nCurrentIndex]; + startVert += m_nIndexOffset; + if ( !IsX360() ) + { + // NOTE: IndexSize is 1 or 0 (0 for alt-tab) + // This prevents us from writing into bogus memory + Assert( m_nIndexSize == 0 || m_nIndexSize == 1 ); + indexCount *= m_nIndexSize; + } + for ( int i = 0; i < indexCount; ++i ) + { + pIndexOut[i] = startVert + pIndexList[i]; + } + AdvanceIndices(indexCount); +} + + //----------------------------------------------------------------------------- // NOTE: This version is the one you really want to achieve write-combining; // Write combining only works if you write in 4 bytes chunks. @@ -2721,6 +2883,8 @@ inline void CIndexBuilder::GenerateIndices( MaterialPrimitiveType_t primitiveTyp case MATERIAL_POINTS: Assert(0); // Shouldn't get here (this primtype is unindexed) break; + case MATERIAL_SUBD_QUADS_EXTRA: + case MATERIAL_SUBD_QUADS_REG: default: GenerateSequentialIndexBuffer( pIndices, nIndexCount, m_nIndexOffset ); break; @@ -2743,6 +2907,8 @@ class CMeshBuilder : public MeshDesc_t CMeshBuilder(); ~CMeshBuilder() { Assert(!m_pMesh); } // if this fires you did a Begin() without an End() + operator CIndexBuilder&() { return m_IndexBuilder; } + // This must be called before Begin, if a vertex buffer with a compressed format is to be used void SetCompressionType( VertexCompressionType_t compressionType ); @@ -2799,6 +2965,7 @@ class CMeshBuilder : public MeshDesc_t // Advances the current vertex and index by one void AdvanceVertex(); + template void AdvanceVertexF(); void AdvanceVertices( int nVerts ); void AdvanceIndex(); void AdvanceIndices( int nIndices ); @@ -2856,6 +3023,8 @@ class CMeshBuilder : public MeshDesc_t void Color3ubv( unsigned char const* rgb ); void Color4ub( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); void Color4ubv( unsigned char const* rgba ); + void Color4Packed( int packedColor ); + int PackColor4( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); // specular color setting void Specular3f( float r, float g, float b ); @@ -2893,11 +3062,14 @@ class CMeshBuilder : public MeshDesc_t // bone weights void BoneWeight( int idx, float weight ); + void BoneWeights2( float weight1, float weight2 ); + // bone weights (templatized for code which needs to support compressed vertices) template void CompressedBoneWeight3fv( const float * pWeights ); // bone matrix index void BoneMatrix( int idx, int matrixIndex ); + void BoneMatrices4( int matrixIdx0, int matrixIdx1, int matrixIdx2, int matrixIdx3 ); // Generic per-vertex data void UserData( const float *pData ); @@ -2913,22 +3085,14 @@ class CMeshBuilder : public MeshDesc_t // Fast Index! No need to call advance index, and no random access allowed void FastIndex( unsigned short index ); + void FastQuad( int index ); // Fast Vertex! No need to call advance vertex, and no random access allowed. // WARNING - these are low level functions that are intended only for use // in the software vertex skinner. - void FastVertex( const ModelVertexDX7_t &vertex ); - void FastVertexSSE( const ModelVertexDX7_t &vertex ); - - // store 4 dx7 vertices fast. for special sse dx7 pipeline - void Fast4VerticesSSE( - ModelVertexDX7_t const *vtx_a, - ModelVertexDX7_t const *vtx_b, - ModelVertexDX7_t const *vtx_c, - ModelVertexDX7_t const *vtx_d); - void FastVertex( const ModelVertexDX8_t &vertex ); void FastVertexSSE( const ModelVertexDX8_t &vertex ); + void FastQuadVertexSSE( const QuadTessVertex_t &vertex ); // Add number of verts and current vert since FastVertexxx routines do not update. void FastAdvanceNVertices(int n); @@ -2937,6 +3101,18 @@ class CMeshBuilder : public MeshDesc_t void VertexDX8ToX360( const ModelVertexDX8_t &vertex ); #endif + // this low level function gets you a pointer to the vertex output data. It is dangerous - any + // caller using it must understand the vertex layout that it is building. It is for optimized + // meshbuilding loops like particle drawing that use special shaders. After writing to the output + // data, you shuodl call FastAdvanceNVertices + FORCEINLINE void *GetVertexDataPtr( int nWhatSizeIThinkItIs ) + { + if ( m_VertexBuilder.m_VertexSize_Position != nWhatSizeIThinkItIs ) + return NULL; + return m_VertexBuilder.m_pCurrPosition; + } + + private: // Computes number of verts and indices void ComputeNumVertsAndIndices( int *pMaxVertices, int *pMaxIndices, @@ -3079,6 +3255,7 @@ inline int CMeshBuilder::IndicesFromVertices( MaterialPrimitiveType_t type, int //----------------------------------------------------------------------------- inline void CMeshBuilder::SetCompressionType( VertexCompressionType_t vertexCompressionType ) { + m_CompressionType = vertexCompressionType; m_VertexBuilder.SetCompressionType( vertexCompressionType ); } @@ -3289,6 +3466,10 @@ FORCEINLINE void CMeshBuilder::SelectIndex( int idx ) //----------------------------------------------------------------------------- // Advances the current vertex and index by one //----------------------------------------------------------------------------- +template FORCEINLINE void CMeshBuilder::AdvanceVertexF() +{ + m_VertexBuilder.AdvanceVertexF(); +} FORCEINLINE void CMeshBuilder::AdvanceVertex() { m_VertexBuilder.AdvanceVertex(); @@ -3332,38 +3513,38 @@ inline void CMeshBuilder::DrawQuad( IMesh* pMesh, const float* v1, const float* Position3fv (v1); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); Position3fv (v2); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); Position3fv (v4); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); Position3fv (v3); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); } else { Begin( pMesh, MATERIAL_LINE_LOOP, 4 ); Position3fv (v1); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); Position3fv (v2); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); Position3fv (v3); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); Position3fv (v4); Color4ubv( pColor ); - AdvanceVertex(); + AdvanceVertexF(); } End(); @@ -3476,6 +3657,11 @@ FORCEINLINE void CMeshBuilder::FastIndex2( unsigned short nIndex1, unsigned shor m_IndexBuilder.FastIndex2( nIndex1, nIndex2 ); } +FORCEINLINE void CMeshBuilder::FastQuad( int nIndex ) +{ + m_IndexBuilder.FastQuad( nIndex ); +} + //----------------------------------------------------------------------------- // For use with the FastVertex methods, advances the current vertex by N //----------------------------------------------------------------------------- @@ -3488,32 +3674,21 @@ FORCEINLINE void CMeshBuilder::FastAdvanceNVertices( int nVertexCount ) //----------------------------------------------------------------------------- // Fast Vertex! No need to call advance vertex, and no random access allowed //----------------------------------------------------------------------------- -FORCEINLINE void CMeshBuilder::FastVertex( const ModelVertexDX7_t &vertex ) +FORCEINLINE void CMeshBuilder::FastVertex( const ModelVertexDX8_t &vertex ) { m_VertexBuilder.FastVertex( vertex ); } -FORCEINLINE void CMeshBuilder::FastVertexSSE( const ModelVertexDX7_t &vertex ) +FORCEINLINE void CMeshBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex ) { m_VertexBuilder.FastVertexSSE( vertex ); } -FORCEINLINE void CMeshBuilder::Fast4VerticesSSE( - const ModelVertexDX7_t *vtx_a, const ModelVertexDX7_t *vtx_b, - const ModelVertexDX7_t *vtx_c, const ModelVertexDX7_t *vtx_d ) +FORCEINLINE void CMeshBuilder::FastQuadVertexSSE( const QuadTessVertex_t &vertex ) { - m_VertexBuilder.Fast4VerticesSSE( vtx_a, vtx_b, vtx_c, vtx_d ); + m_VertexBuilder.FastQuadVertexSSE( vertex ); } -FORCEINLINE void CMeshBuilder::FastVertex( const ModelVertexDX8_t &vertex ) -{ - m_VertexBuilder.FastVertex( vertex ); -} - -FORCEINLINE void CMeshBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex ) -{ - m_VertexBuilder.FastVertexSSE( vertex ); -} //----------------------------------------------------------------------------- // Copies a vertex into the x360 format @@ -3598,6 +3773,16 @@ FORCEINLINE void CMeshBuilder::Color4ubv( unsigned char const* rgba ) m_VertexBuilder.Color4ubv( rgba ); } +FORCEINLINE void CMeshBuilder::Color4Packed( int packedColor ) +{ + m_VertexBuilder.Color4Packed(packedColor); +} + +FORCEINLINE int CMeshBuilder::PackColor4( unsigned char r, unsigned char g, unsigned char b, unsigned char a ) +{ + return m_VertexBuilder.PackColor4(r,g,b,a); +} + FORCEINLINE void CMeshBuilder::Specular3f( float r, float g, float b ) { m_VertexBuilder.Specular3f( r, g, b ); @@ -3713,6 +3898,11 @@ FORCEINLINE void CMeshBuilder::BoneWeight( int nIndex, float flWeight ) m_VertexBuilder.BoneWeight( nIndex, flWeight ); } +FORCEINLINE void CMeshBuilder::BoneWeights2( float weight1, float weight2 ) +{ + m_VertexBuilder.BoneWeights2( weight1, weight2 ); +} + template FORCEINLINE void CMeshBuilder::CompressedBoneWeight3fv( const float * pWeights ) { m_VertexBuilder.CompressedBoneWeight3fv( pWeights ); @@ -3723,6 +3913,11 @@ FORCEINLINE void CMeshBuilder::BoneMatrix( int nIndex, int nMatrixIdx ) m_VertexBuilder.BoneMatrix( nIndex, nMatrixIdx ); } +FORCEINLINE void CMeshBuilder::BoneMatrices4( int matrixIdx0, int matrixIdx1, int matrixIdx2, int matrixIdx3 ) +{ + m_VertexBuilder.BoneMatrices4( matrixIdx0, matrixIdx1, matrixIdx2, matrixIdx3 ); +} + FORCEINLINE void CMeshBuilder::UserData( const float* pData ) { m_VertexBuilder.UserData( pData ); diff --git a/public/materialsystem/itexture.h b/public/materialsystem/itexture.h index 6db2bb873..025b3e073 100644 --- a/public/materialsystem/itexture.h +++ b/public/materialsystem/itexture.h @@ -20,6 +20,16 @@ class IVTFTexture; class ITexture; struct Rect_t; +#ifdef _X360 +enum RTMultiSampleCount360_t +{ + RT_MULTISAMPLE_NONE = 0, + RT_MULTISAMPLE_2_SAMPLES = 2, + RT_MULTISAMPLE_4_SAMPLES = 4, + RT_MULTISAMPLE_MATCH_BACKBUFFER +}; +#endif + //----------------------------------------------------------------------------- // This will get called on procedural textures to re-fill the textures // with the appropriate bit pattern. Calling Download() will also @@ -72,7 +82,7 @@ abstract_class ITexture inline void Release() { DecrementReferenceCount(); } // Used to modify the texture bits (procedural textures only) - virtual void SetTextureRegenerator( ITextureRegenerator *pTextureRegen ) = 0; + virtual void SetTextureRegenerator( ITextureRegenerator *pTextureRegen, bool releaseExisting = true ) = 0; // Reconstruct the texture bits in HW memory @@ -94,7 +104,6 @@ abstract_class ITexture virtual int GetActualDepth() const = 0; virtual ImageFormat GetImageFormat() const = 0; - virtual NormalDecodeMode_t GetNormalDecodeMode() const = 0; // Various information about the texture virtual bool IsRenderTarget() const = 0; @@ -106,7 +115,7 @@ abstract_class ITexture #if defined( _X360 ) virtual bool ClearTexture( int r, int g, int b, int a ) = 0; - virtual bool CreateRenderTargetSurface( int width, int height, ImageFormat format, bool bSameAsTexture ) = 0; + virtual bool CreateRenderTargetSurface( int width, int height, ImageFormat format, bool bSameAsTexture, RTMultiSampleCount360_t multiSampleCount = RT_MULTISAMPLE_NONE ) = 0; #endif // swap everything except the name with another texture @@ -117,6 +126,9 @@ abstract_class ITexture // Force LOD override (automatically downloads the texture) virtual void ForceLODOverride( int iNumLodsOverrideUpOrDown ) = 0; + + // Force exclude override (automatically downloads the texture) + virtual void ForceExcludeOverride( int iExcludeOverride ) = 0; }; diff --git a/public/materialsystem/ivballoctracker.h b/public/materialsystem/ivballoctracker.h index 5200931d7..e907a5831 100644 --- a/public/materialsystem/ivballoctracker.h +++ b/public/materialsystem/ivballoctracker.h @@ -18,7 +18,6 @@ #endif // This interface is actually exported by the shader API DLL. -#define VB_ALLOC_TRACKER_INTERFACE_VERSION "VBAllocTracker001" // Interface to the VB mem alloc tracker abstract_class IVBAllocTracker @@ -32,4 +31,4 @@ abstract_class IVBAllocTracker virtual void TrackMeshAllocations( const char * allocatorName ) = 0; }; -#endif IVBALLOCTRACKER_H +#endif // IVBALLOCTRACKER_H diff --git a/public/materialsystem/materialsystem_config.h b/public/materialsystem/materialsystem_config.h index 2cf58597c..12aaac056 100644 --- a/public/materialsystem/materialsystem_config.h +++ b/public/materialsystem/materialsystem_config.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -13,7 +13,7 @@ #include "materialsystem/imaterialsystem.h" -#define MATERIALSYSTEM_CONFIG_VERSION "VMaterialSystemConfig002" +#define MATERIALSYSTEM_CONFIG_VERSION "VMaterialSystemConfig004" enum MaterialSystem_Config_Flags_t { @@ -21,17 +21,16 @@ enum MaterialSystem_Config_Flags_t MATSYS_VIDCFG_FLAGS_RESIZING = ( 1 << 1 ), MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC = ( 1 << 3 ), MATSYS_VIDCFG_FLAGS_STENCIL = ( 1 << 4 ), - MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR = ( 1 << 5 ), - MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC = ( 1 << 6 ), MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR = ( 1 << 7 ), MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP = ( 1 << 8 ), MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING = ( 1 << 9 ), MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL = ( 1 << 10 ), - MATSYS_VIDCFG_FLAGS_REDUCE_FILLRATE = ( 1 << 11 ), MATSYS_VIDCFG_FLAGS_ENABLE_HDR = ( 1 << 12 ), MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE = ( 1 << 13 ), MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION = ( 1 << 14 ), MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS = ( 1 << 15 ), + MATSYS_VIDCFG_FLAGS_DISABLE_PHONG = ( 1 << 16 ), + MATSYS_VIDCFG_FLAGS_NO_WINDOW_BORDER = ( 1 << 17 ), }; struct MaterialSystemHardwareIdentifier_t @@ -44,16 +43,14 @@ struct MaterialSystemHardwareIdentifier_t struct MaterialSystem_Config_t { bool Windowed() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_WINDOWED ) != 0; } + bool NoWindowBorder() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_NO_WINDOW_BORDER ) != 0; } bool Resizing() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_RESIZING ) != 0; } bool WaitForVSync() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC ) == 0; } bool Stencil() const { return (m_Flags & MATSYS_VIDCFG_FLAGS_STENCIL ) != 0; } - bool ForceTrilinear() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR ) != 0; } - bool ForceHWSync() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC ) != 0; } bool UseSpecular() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR ) == 0; } bool UseBumpmapping() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP ) == 0; } bool UseParallaxMapping() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING ) != 0; } bool UseZPrefill() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL ) != 0; } - bool ReduceFillrate() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_REDUCE_FILLRATE ) != 0; } bool HDREnabled() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_ENABLE_HDR ) != 0; } bool LimitWindowedSize() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE ) != 0; } bool ScaleToOutputResolution() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION ) != 0; } @@ -61,6 +58,7 @@ struct MaterialSystem_Config_t bool ShadowDepthTexture() const { return m_bShadowDepthTexture; } bool MotionBlur() const { return m_bMotionBlur; } bool SupportFlashlight() const { return m_bSupportFlashlight; } + bool UsePhong() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_PHONG ) == 0; } void SetFlag( unsigned int flag, bool val ) { @@ -82,6 +80,7 @@ struct MaterialSystem_Config_t float m_fGammaTVExponent; bool m_bGammaTVEnabled; + bool m_bWantTripleBuffered; // We only get triple buffering if fullscreen and vsync'd int m_nAASamples; int m_nForceAnisotropicLevel; int skipMipLevels; @@ -112,21 +111,6 @@ struct MaterialSystem_Config_t bool bShowSpecular; // This is the fast version that doesn't require reloading materials bool bShowDiffuse; // This is the fast version that doesn't require reloading materials - // misc - int m_nReserved; // Currently unused - - // No depth bias - float m_SlopeScaleDepthBias_Normal; - float m_DepthBias_Normal; - - // Depth bias for rendering decals closer to the camera - float m_SlopeScaleDepthBias_Decal; - float m_DepthBias_Decal; - - // Depth bias for biasing shadow depth map rendering away from the camera - float m_SlopeScaleDepthBias_ShadowMap; - float m_DepthBias_ShadowMap; - uint m_WindowedSizeLimitWidth; uint m_WindowedSizeLimitHeight; int m_nAAQuality; @@ -134,22 +118,24 @@ struct MaterialSystem_Config_t bool m_bMotionBlur; bool m_bSupportFlashlight; + bool m_bPaintInGame; + bool m_bPaintInMap; + + MaterialSystem_Config_t() { memset( this, 0, sizeof( *this ) ); // video config defaults SetFlag( MATSYS_VIDCFG_FLAGS_WINDOWED, false ); + SetFlag( MATSYS_VIDCFG_FLAGS_NO_WINDOW_BORDER, false ); SetFlag( MATSYS_VIDCFG_FLAGS_RESIZING, false ); SetFlag( MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC, true ); SetFlag( MATSYS_VIDCFG_FLAGS_STENCIL, false ); - SetFlag( MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR, true ); - SetFlag( MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC, true ); SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR, false ); SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP, false ); SetFlag( MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING, true ); SetFlag( MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL, false ); - SetFlag( MATSYS_VIDCFG_FLAGS_REDUCE_FILLRATE, false ); SetFlag( MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE, false ); SetFlag( MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION, false ); SetFlag( MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS, false ); @@ -170,6 +156,7 @@ struct MaterialSystem_Config_t m_fGammaTVExponent = 2.5; m_bGammaTVEnabled = IsX360(); + m_bWantTripleBuffered = false; m_nAASamples = 1; m_bShadowDepthTexture = false; m_bMotionBlur = false; @@ -200,14 +187,12 @@ struct MaterialSystem_Config_t proxiesTestMode = 0; m_bFastNoBump = false; m_bSuppressRendering = false; - m_SlopeScaleDepthBias_Decal = -0.5f; - m_SlopeScaleDepthBias_Normal = 0.0f; - m_SlopeScaleDepthBias_ShadowMap = 0.5f; - m_DepthBias_Decal = -262144; - m_DepthBias_Normal = 0.0f; - m_DepthBias_ShadowMap = 262144; m_WindowedSizeLimitWidth = 1280; m_WindowedSizeLimitHeight = 1024; + + // PAINT + m_bPaintInGame = false; + m_bPaintInMap = false; } }; diff --git a/public/mathlib/mathlib.h b/public/mathlib/mathlib.h index 7b24b1ad0..c464197e9 100644 --- a/public/mathlib/mathlib.h +++ b/public/mathlib/mathlib.h @@ -108,6 +108,8 @@ void GeneratePerspectiveFrustum( const Vector& origin, const Vector &forward, co bool R_CullBox( const Vector& mins, const Vector& maxs, const Frustum_t &frustum ); bool R_CullBoxSkipNear( const Vector& mins, const Vector& maxs, const Frustum_t &frustum ); +class matrix3x4a_t; + struct matrix3x4_t { matrix3x4_t() {} @@ -160,6 +162,25 @@ struct matrix3x4_t float m_flMatVal[3][4]; }; +class ALIGN16 matrix3x4a_t : public matrix3x4_t +{ +public: + /* + matrix3x4a_t() { if (((size_t)Base()) % 16 != 0) { Error( "matrix3x4a_t missaligned" ); } } + */ + matrix3x4a_t& operator=( const matrix3x4_t& src ) { memcpy( Base(), src.Base(), sizeof( float ) * 3 * 4 ); return *this; }; + + matrix3x4a_t() {} + matrix3x4a_t( + float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23 ) + { + m_flMatVal[0][0] = m00; m_flMatVal[0][1] = m01; m_flMatVal[0][2] = m02; m_flMatVal[0][3] = m03; + m_flMatVal[1][0] = m10; m_flMatVal[1][1] = m11; m_flMatVal[1][2] = m12; m_flMatVal[1][3] = m13; + m_flMatVal[2][0] = m20; m_flMatVal[2][1] = m21; m_flMatVal[2][2] = m22; m_flMatVal[2][3] = m23; + } +}; #ifndef M_PI #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h @@ -2066,7 +2087,21 @@ void RGBtoHSV( const Vector &rgb, Vector &hsv ); //----------------------------------------------------------------------------- void HSVtoRGB( const Vector &hsv, Vector &rgb ); +//----------------------------------------------------------------------------- +// For testing float equality +//----------------------------------------------------------------------------- + +inline bool CloseEnough( float a, float b, float epsilon = EQUAL_EPSILON ) +{ + return fabs( a - b ) <= epsilon; +} +inline bool CloseEnough( const Vector &a, const Vector &b, float epsilon = EQUAL_EPSILON ) +{ + return fabs( a.x - b.x ) <= epsilon && + fabs( a.y - b.y ) <= epsilon && + fabs( a.z - b.z ) <= epsilon; +} #endif // MATH_BASE_H diff --git a/public/model_types.h b/public/model_types.h index 50d69be99..d0c233d2b 100644 --- a/public/model_types.h +++ b/public/model_types.h @@ -1,11 +1,11 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // // $Workfile: $ // $Date: $ // $NoKeywords: $ -//=============================================================================// +//===========================================================================// #if !defined( MODEL_TYPES_H ) #define MODEL_TYPES_H #ifdef _WIN32 @@ -22,6 +22,9 @@ #define STUDIO_ITEM_BLINK 0x00000040 #define STUDIO_NOSHADOWS 0x00000080 #define STUDIO_WIREFRAME_VCOLLIDE 0x00000100 +#define STUDIO_NOLIGHTING_OR_CUBEMAP 0x00000200 +#define STUDIO_SKIP_FLEXES 0x00000400 +#define STUDIO_DONOTMODIFYSTENCILSTATE 0x00000800 // TERROR // Not a studio flag, but used to flag model as a non-sorting brush model #define STUDIO_TRANSPARENCY 0x80000000 @@ -29,6 +32,10 @@ // Not a studio flag, but used to flag model as using shadow depth material override #define STUDIO_SHADOWDEPTHTEXTURE 0x40000000 +// Not a studio flag, but used to flag model as doing custom rendering into shadow texture +#define STUDIO_SHADOWTEXTURE 0x20000000 + +#define STUDIO_SKIP_DECALS 0x10000000 enum modtype_t { diff --git a/public/mouthinfo.h b/public/mouthinfo.h index 891fc3be2..571cd6726 100644 --- a/public/mouthinfo.h +++ b/public/mouthinfo.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -18,6 +18,7 @@ class CAudioSource; +#pragma pack(push,4) class CVoiceData { public: @@ -77,7 +78,7 @@ class CMouthInfo public: CMouthInfo( void ) { m_nVoiceSources = 0; m_needsEnvelope = false; } - virtual ~CMouthInfo( void ) { ClearVoiceSources(); } + ~CMouthInfo( void ) { ClearVoiceSources(); } int GetNumVoiceSources( void ); CVoiceData *GetVoiceSource( int number ); @@ -101,10 +102,12 @@ class CMouthInfo MAX_VOICE_DATA = 4 }; - CVoiceData m_VoiceSources[ MAX_VOICE_DATA ]; short m_nVoiceSources; - short m_needsEnvelope; + short m_needsEnvelope; + CVoiceData m_VoiceSources[ MAX_VOICE_DATA ]; }; +#pragma pack(pop) + inline bool CMouthInfo::IsActive( void ) { @@ -166,7 +169,11 @@ inline void CMouthInfo::RemoveSourceByIndex( int index ) if ( index < 0 || index >= m_nVoiceSources ) return; - m_VoiceSources[ index ] = m_VoiceSources[ --m_nVoiceSources ]; + --m_nVoiceSources; + if ( m_nVoiceSources > 0 ) + { + m_VoiceSources[ index ] = m_VoiceSources[ m_nVoiceSources ]; + } } inline CVoiceData *CMouthInfo::AddSource( CAudioSource *source, bool bIgnorePhonemes ) @@ -191,4 +198,4 @@ inline CVoiceData *CMouthInfo::AddSource( CAudioSource *source, bool bIgnorePhon return data; } -#endif // MOUTHINFO_H +#endif // MOUTHINFO_H \ No newline at end of file diff --git a/public/networkvar.h b/public/networkvar.h index cc04351d7..8a68654ca 100644 --- a/public/networkvar.h +++ b/public/networkvar.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -22,17 +22,60 @@ #pragma warning( disable : 4284 ) // warning C4284: return type for 'CNetworkVarT::operator ->' is 'int *' (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation) #endif -#define MyOffsetOf( type, var ) ( (int)&((type*)0)->var ) +#ifdef GNUC +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + +#define MyOffsetOf( type, var ) offsetof( type, var ) #ifdef _DEBUG + #undef new extern bool g_bUseNetworkVars; - #define CHECK_USENETWORKVARS if(g_bUseNetworkVars) + #define CHECK_USENETWORKVARS #else #define CHECK_USENETWORKVARS // don't check for g_bUseNetworkVars #endif +// network vars use memcmp when fields are set. To ensure proper behavior your +// object's memory should be initialized to zero. This happens for entities automatically +// use this for other classes. +class CMemZeroOnNew +{ +public: + void *operator new( size_t nSize ) + { + void *pMem = MemAlloc_Alloc( nSize ); + V_memset( pMem, 0, nSize ); + return pMem; + } + + void* operator new( size_t nSize, int nBlockUse, const char *pFileName, int nLine ) + { + void *pMem = MemAlloc_Alloc( nSize, pFileName, nLine ); + V_memset( pMem, 0, nSize ); + return pMem; + } + + void operator delete(void *pData) + { + if ( pData ) + { + MemAlloc_Free(pData); + } + } + + void operator delete( void* pData, int nBlockUse, const char *pFileName, int nLine ) + { + if ( pData ) + { + MemAlloc_Free(pData, pFileName, nLine ); + } + } +}; + + inline int InternalCheckDeclareClass( const char *pClassName, const char *pClassNameMatch, void *pTestPtr, void *pBasePtr ) { // This makes sure that casting from ThisClass to BaseClass works right. You'll get a compiler error if it doesn't @@ -167,6 +210,7 @@ static inline void DispatchNetworkStateChanged( T *pObj, void *pVar ) template< class T > NetworkVar_##name& operator=( const T &val ) { *((type*)this) = val; return *this; } \ public: \ void CopyFrom( const type &src ) { *((type *)this) = src; NetworkStateChanged(); } \ + type & GetForModify( void ) { NetworkStateChanged(); return *((type *)this); } \ virtual void NetworkStateChanged() \ { \ DispatchNetworkStateChanged( (ThisClass_##name*)( ((char*)this) - GetOffset_##name() ) ); \ @@ -184,21 +228,26 @@ template< class Type, class Changer > class CNetworkVarBase { public: - template< class C > - const Type& operator=( const C &val ) - { - return Set( ( const Type )val ); + CNetworkVarBase() + { } - - template< class C > - const Type& operator=( const CNetworkVarBase< C, Changer > &val ) - { - return Set( ( const Type )val.m_Value ); + + FORCEINLINE explicit CNetworkVarBase( Type val ) + : m_Value( val ) + { + NetworkStateChanged(); } - - const Type& Set( const Type &val ) + + FORCEINLINE const Type& SetDirect( const Type &val ) + { + NetworkStateChanged(); + m_Value = val; + return m_Value; + } + + FORCEINLINE const Type& Set( const Type &val ) { - if ( memcmp( &m_Value, &val, sizeof(Type) ) ) + if ( m_Value != val ) { NetworkStateChanged(); m_Value = val; @@ -206,66 +255,78 @@ class CNetworkVarBase return m_Value; } - Type& GetForModify() + template< class C > + FORCEINLINE const Type& operator=( const C &val ) + { + return Set( ( const Type )val ); + } + + template< class C > + FORCEINLINE const Type& operator=( const CNetworkVarBase< C, Changer > &val ) + { + return Set( ( const Type )val.m_Value ); + } + + FORCEINLINE Type& GetForModify() { NetworkStateChanged(); return m_Value; } template< class C > - const Type& operator+=( const C &val ) + FORCEINLINE const Type& operator+=( const C &val ) { return Set( m_Value + ( const Type )val ); } template< class C > - const Type& operator-=( const C &val ) + FORCEINLINE const Type& operator-=( const C &val ) { return Set( m_Value - ( const Type )val ); } template< class C > - const Type& operator/=( const C &val ) + FORCEINLINE const Type& operator/=( const C &val ) { return Set( m_Value / ( const Type )val ); } template< class C > - const Type& operator*=( const C &val ) + FORCEINLINE const Type& operator*=( const C &val ) { return Set( m_Value * ( const Type )val ); } template< class C > - const Type& operator^=( const C &val ) + FORCEINLINE const Type& operator^=( const C &val ) { return Set( m_Value ^ ( const Type )val ); } template< class C > - const Type& operator|=( const C &val ) + FORCEINLINE const Type& operator|=( const C &val ) { return Set( m_Value | ( const Type )val ); } - const Type& operator++() + FORCEINLINE const Type& operator++() { return (*this += 1); } - Type operator--() + FORCEINLINE Type operator--() { return (*this -= 1); } - Type operator++( int ) // postfix version.. + FORCEINLINE Type operator++( int ) // postfix version.. { Type val = m_Value; (*this += 1); return val; } - Type operator--( int ) // postfix version.. + FORCEINLINE Type operator--( int ) // postfix version.. { Type val = m_Value; (*this -= 1); @@ -276,22 +337,22 @@ class CNetworkVarBase // CNetworkVarBase = 0x1 // (it warns about converting from an int to an unsigned char). template< class C > - const Type& operator&=( const C &val ) + FORCEINLINE const Type& operator&=( const C &val ) { return Set( m_Value & ( const Type )val ); } - operator const Type&() const + FORCEINLINE operator const Type&() const { return m_Value; } - const Type& Get() const + FORCEINLINE const Type& Get() const { return m_Value; } - const Type* operator->() const + FORCEINLINE const Type* operator->() const { return &m_Value; } @@ -299,16 +360,16 @@ class CNetworkVarBase Type m_Value; protected: - inline void NetworkStateChanged() + FORCEINLINE void NetworkStateChanged() { Changer::NetworkStateChanged( this ); } }; - template< class Type, class Changer > class CNetworkColor32Base : public CNetworkVarBase< Type, Changer > { + typedef CNetworkVarBase< Type, Changer > base; public: inline void Init( byte rVal, byte gVal, byte bVal ) { @@ -331,17 +392,17 @@ class CNetworkColor32Base : public CNetworkVarBase< Type, Changer > const Type& operator=( const CNetworkColor32Base &val ) { - return CNetworkVarBase::Set( val.m_Value ); + return base::Set( val.m_Value ); } - inline byte GetR() const { return CNetworkColor32Base::m_Value.r; } - inline byte GetG() const { return CNetworkColor32Base::m_Value.g; } - inline byte GetB() const { return CNetworkColor32Base::m_Value.b; } - inline byte GetA() const { return CNetworkColor32Base::m_Value.a; } - inline void SetR( byte val ) { SetVal( CNetworkColor32Base::m_Value.r, val ); } - inline void SetG( byte val ) { SetVal( CNetworkColor32Base::m_Value.g, val ); } - inline void SetB( byte val ) { SetVal( CNetworkColor32Base::m_Value.b, val ); } - inline void SetA( byte val ) { SetVal( CNetworkColor32Base::m_Value.a, val ); } + inline byte GetR() const { return this->m_Value.r; } + inline byte GetG() const { return this->m_Value.g; } + inline byte GetB() const { return this->m_Value.b; } + inline byte GetA() const { return this->m_Value.a; } + inline void SetR( byte val ) { SetVal( this->m_Value.r, val ); } + inline void SetG( byte val ) { SetVal( this->m_Value.g, val ); } + inline void SetB( byte val ) { SetVal( this->m_Value.b, val ); } + inline void SetA( byte val ) { SetVal( this->m_Value.a, val ); } protected: inline void SetVal( byte &out, const byte &in ) @@ -359,76 +420,75 @@ class CNetworkColor32Base : public CNetworkVarBase< Type, Changer > template< class Type, class Changer > class CNetworkVectorBase : public CNetworkVarBase< Type, Changer > { + typedef CNetworkVarBase< Type, Changer > base; public: - inline void Init( float ix=0, float iy=0, float iz=0 ) + FORCEINLINE void Init( float ix=0, float iy=0, float iz=0 ) { - SetX( ix ); - SetY( iy ); - SetZ( iz ); + base::Set( Type( ix, iy, iz ) ); } - const Type& operator=( const Type &val ) + FORCEINLINE const Type& operator=( const Type &val ) { - return CNetworkVarBase< Type, Changer >::Set( val ); + return base::Set( val ); } - const Type& operator=( const CNetworkVectorBase &val ) + FORCEINLINE const Type& operator=( const CNetworkVectorBase &val ) { - return CNetworkVarBase::Set( val.m_Value ); + return base::Set( val.m_Value ); } - inline float GetX() const { return CNetworkVectorBase::m_Value.x; } - inline float GetY() const { return CNetworkVectorBase::m_Value.y; } - inline float GetZ() const { return CNetworkVectorBase::m_Value.z; } - inline float operator[]( int i ) const { return CNetworkVectorBase::m_Value[i]; } + FORCEINLINE float GetX() const { return this->m_Value.x; } + FORCEINLINE float GetY() const { return this->m_Value.y; } + FORCEINLINE float GetZ() const { return this->m_Value.z; } + FORCEINLINE float operator[]( int i ) const { return this->m_Value[i]; } - inline void SetX( float val ) { DetectChange( CNetworkVectorBase::m_Value.x, val ); } - inline void SetY( float val ) { DetectChange( CNetworkVectorBase::m_Value.y, val ); } - inline void SetZ( float val ) { DetectChange( CNetworkVectorBase::m_Value.z, val ); } - inline void Set( int i, float val ) { DetectChange( CNetworkVectorBase::m_Value[i], val ); } + FORCEINLINE void SetX( float val ) { DetectChange( this->m_Value.x, val ); } + FORCEINLINE void SetY( float val ) { DetectChange( this->m_Value.y, val ); } + FORCEINLINE void SetZ( float val ) { DetectChange( this->m_Value.z, val ); } + FORCEINLINE void Set( int i, float val ) { DetectChange( this->m_Value[i], val ); } - bool operator==( const Type &val ) const + FORCEINLINE bool operator==( const Type &val ) const { - return CNetworkVectorBase::m_Value == (Type)val; + return this->m_Value == (Type)val; } - bool operator!=( const Type &val ) const + FORCEINLINE bool operator!=( const Type &val ) const { - return CNetworkVectorBase::m_Value != (Type)val; + return this->m_Value != (Type)val; } - const Type operator+( const Type &val ) const + FORCEINLINE const Type operator+( const Type &val ) const { - return CNetworkVectorBase::m_Value + val; + return this->m_Value + val; } - const Type operator-( const Type &val ) const + FORCEINLINE const Type operator-( const Type &val ) const { - return CNetworkVectorBase::m_Value - val; + return this->m_Value - val; } - const Type operator*( const Type &val ) const + FORCEINLINE const Type operator*( const Type &val ) const { - return CNetworkVectorBase::m_Value * val; + return this->m_Value * val; } - const Type& operator*=( float val ) + FORCEINLINE const Type& operator*=( float val ) { - return CNetworkVarBase< Type, Changer >::Set( CNetworkVectorBase::m_Value * val ); + return base::Set( this->m_Value * val ); } - const Type operator*( float val ) const + FORCEINLINE const Type operator*( float val ) const { - return CNetworkVectorBase::m_Value * val; + return this->m_Value * val; } - const Type operator/( const Type &val ) const + FORCEINLINE const Type operator/( const Type &val ) const { - return CNetworkVectorBase::m_Value / val; + return this->m_Value / val; } private: - inline void DetectChange( float &out, float in ) + FORCEINLINE void DetectChange( float &out, float in ) { if ( out != in ) { @@ -443,75 +503,73 @@ class CNetworkVectorBase : public CNetworkVarBase< Type, Changer > template< class Type, class Changer > class CNetworkQuaternionBase : public CNetworkVarBase< Type, Changer > { + typedef CNetworkVarBase< Type, Changer > base; public: inline void Init( float ix=0, float iy=0, float iz=0, float iw = 0 ) { - SetX( ix ); - SetY( iy ); - SetZ( iz ); - SetZ( iw ); + base::Set( Quaternion( ix, iy, iz, iw ) ); } const Type& operator=( const Type &val ) { - return CNetworkVarBase< Type, Changer >::Set( val ); + return Set( val ); } const Type& operator=( const CNetworkQuaternionBase &val ) { - return CNetworkVarBase::Set( val.m_Value ); + return Set( val.m_Value ); } - inline float GetX() const { return CNetworkQuaternionBase::m_Value.x; } - inline float GetY() const { return CNetworkQuaternionBase::m_Value.y; } - inline float GetZ() const { return CNetworkQuaternionBase::m_Value.z; } - inline float GetW() const { return CNetworkQuaternionBase::m_Value.w; } - inline float operator[]( int i ) const { return CNetworkQuaternionBase::m_Value[i]; } + inline float GetX() const { return this->m_Value.x; } + inline float GetY() const { return this->m_Value.y; } + inline float GetZ() const { return this->m_Value.z; } + inline float GetW() const { return this->m_Value.w; } + inline float operator[]( int i ) const { return this->m_Value[i]; } - inline void SetX( float val ) { DetectChange( CNetworkQuaternionBase::m_Value.x, val ); } - inline void SetY( float val ) { DetectChange( CNetworkQuaternionBase::m_Value.y, val ); } - inline void SetZ( float val ) { DetectChange( CNetworkQuaternionBase::m_Value.z, val ); } - inline void SetW( float val ) { DetectChange( CNetworkQuaternionBase::m_Value.w, val ); } - inline void Set( int i, float val ) { DetectChange( CNetworkQuaternionBase::m_Value[i], val ); } + inline void SetX( float val ) { DetectChange( this->m_Value.x, val ); } + inline void SetY( float val ) { DetectChange( this->m_Value.y, val ); } + inline void SetZ( float val ) { DetectChange( this->m_Value.z, val ); } + inline void SetW( float val ) { DetectChange( this->m_Value.w, val ); } + inline void Set( int i, float val ) { DetectChange( this->m_Value[i], val ); } bool operator==( const Type &val ) const { - return CNetworkQuaternionBase::m_Value == (Type)val; + return this->m_Value == (Type)val; } bool operator!=( const Type &val ) const { - return CNetworkQuaternionBase::m_Value != (Type)val; + return this->m_Value != (Type)val; } const Type operator+( const Type &val ) const { - return CNetworkQuaternionBase::m_Value + val; + return this->m_Value + val; } const Type operator-( const Type &val ) const { - return CNetworkQuaternionBase::m_Value - val; + return this->m_Value - val; } const Type operator*( const Type &val ) const { - return CNetworkQuaternionBase::m_Value * val; + return this->m_Value * val; } const Type& operator*=( float val ) { - return CNetworkQuaternionBase< Type, Changer >::Set( CNetworkQuaternionBase::m_Value * val ); + return Set( this->m_Value * val ); } const Type operator*( float val ) const { - return CNetworkQuaternionBase::m_Value * val; + return this->m_Value * val; } const Type operator/( const Type &val ) const { - return CNetworkQuaternionBase::m_Value / val; + return this->m_Value / val; } private: @@ -531,6 +589,7 @@ class CNetworkQuaternionBase : public CNetworkVarBase< Type, Changer > template< class Type, class Changer > class CNetworkHandleBase : public CNetworkVarBase< CBaseHandle, Changer > { + typedef CNetworkVarBase< CBaseHandle, Changer > base; public: const Type* operator=( const Type *val ) { @@ -545,12 +604,12 @@ class CNetworkQuaternionBase : public CNetworkVarBase< Type, Changer > bool operator !() const { - return !CNetworkHandleBase::m_Value.Get(); + return !this->m_Value.Get(); } operator Type*() const { - return static_cast< Type* >( CNetworkHandleBase::m_Value.Get() ); + return static_cast< Type* >( this->m_Value.Get() ); } const Type* Set( const Type *val ) @@ -699,8 +758,7 @@ class CNetworkQuaternionBase : public CNetworkVarBase< Type, Changer > class NetworkVar_##name \ { \ public: \ - template friend int ServerClassInit(T *); \ - template friend datamap_t *DataMapInit(T *); \ + template friend int ServerClassInit(T *); \ const type& operator[]( int i ) const \ { \ return Get( i ); \ @@ -730,12 +788,12 @@ class CNetworkQuaternionBase : public CNetworkVarBase< Type, Changer > } \ const type* Base() const { return m_Value; } \ int Count() const { return count; } \ + type m_Value[count]; \ protected: \ inline void NetworkStateChanged( int index ) \ { \ CHECK_USENETWORKVARS ((ThisClass*)(((char*)this) - MyOffsetOf(ThisClass,name)))->stateChangedFn( &m_Value[index] ); \ } \ - type m_Value[count]; \ }; \ NetworkVar_##name name; diff --git a/public/optimize.h b/public/optimize.h index b7c857cfc..9536f2066 100644 --- a/public/optimize.h +++ b/public/optimize.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -14,9 +14,6 @@ #include "studio.h" - -// NOTE: You can change this without affecting the vtx file format. -#define MAX_NUM_BONES_PER_TRI ( MAX_NUM_BONES_PER_VERT * 3 ) #define MAX_NUM_BONES_PER_STRIP 512 #define OPTIMIZED_MODEL_FILE_VERSION 7 @@ -51,44 +48,47 @@ struct Vertex_t char boneID[MAX_NUM_BONES_PER_VERT]; }; -enum StripHeaderFlags_t { - STRIP_IS_TRILIST = 0x01, - STRIP_IS_TRISTRIP = 0x02 +// We don't do actual strips anymore, only triangle lists and subd quad lists +enum StripHeaderFlags_t +{ + STRIP_IS_TRILIST = 0x01, + STRIP_IS_QUADLIST_REG = 0x02, // Regular sub-d quads + STRIP_IS_QUADLIST_EXTRA = 0x04 // Extraordinary sub-d quads }; -// a strip is a piece of a stripgroup that is divided by bones -// (and potentially tristrips if we remove some degenerates.) +// A strip is a piece of a stripgroup that is divided by bones struct StripHeader_t { DECLARE_BYTESWAP_DATADESC(); - // indexOffset offsets into the mesh's index array. - int numIndices; + int numIndices; // indexOffset offsets into the mesh's index array int indexOffset; - // vertexOffset offsets into the mesh's vert array. - int numVerts; + int numVerts; // vertexOffset offsets into the mesh's vert array int vertOffset; - // use this to enable/disable skinning. - // May decide (in optimize.cpp) to put all with 1 bone in a different strip + // Use this to enable/disable skinning. + // May decide (in optimize.cpp) to put all with 1 bone in a different strip // than those that need skinning. - short numBones; + short numBones; unsigned char flags; int numBoneStateChanges; int boneStateChangeOffset; - inline BoneStateChangeHeader_t *pBoneStateChange( int i ) const - { - return (BoneStateChangeHeader_t *)(((byte *)this) + boneStateChangeOffset) + i; + inline BoneStateChangeHeader_t *pBoneStateChange( int i ) const + { + return (BoneStateChangeHeader_t *)(((byte *)this) + boneStateChangeOffset) + i; }; + + // These go last on purpose! + int numTopologyIndices; + int topologyOffset; }; -enum StripGroupFlags_t +enum StripGroupFlags_t { - STRIPGROUP_IS_FLEXED = 0x01, - STRIPGROUP_IS_HWSKINNED = 0x02, - STRIPGROUP_IS_DELTA_FLEXED = 0x04, + STRIPGROUP_IS_HWSKINNED = 0x02, + STRIPGROUP_IS_DELTA_FLEXED = 0x04, STRIPGROUP_SUPPRESS_HW_MORPH = 0x08, // NOTE: This is a temporary flag used at run time. }; @@ -121,6 +121,13 @@ struct StripGroupHeader_t }; unsigned char flags; + + int numTopologyIndices; + int topologyOffset; + inline unsigned short *pTopologyIndex( int i ) const + { + return (unsigned short *)(((byte *)this) + topologyOffset) + i; + }; }; enum MeshFlags_t { @@ -222,7 +229,7 @@ struct FileHeader_t // hardware params that affect how the model is to be optimized. int vertCacheSize; unsigned short maxBonesPerStrip; - unsigned short maxBonesPerTri; + unsigned short maxBonesPerFace; int maxBonesPerVert; // must match checkSum in the .mdl diff --git a/public/posedebugger.cpp b/public/posedebugger.cpp index f937eabb6..52c997a9d 100644 --- a/public/posedebugger.cpp +++ b/public/posedebugger.cpp @@ -392,6 +392,12 @@ void CPoseDebuggerImpl::StartBlending( IClientNetworkable *pEntity, const CStudi // if ( !pVMdl ) // return; + if ( !ThreadInMainThread() ) + { + ExecuteOnce( "Turn of threading when using pose debugger\n" ); + return; + } + // If we are starting a new model then finalize the previous one if ( pStudioHdr != m_pLastModel && m_pLastModel ) { @@ -470,6 +476,11 @@ void CPoseDebuggerImpl::AccumulatePose( const CStudioHdr *pStudioHdr, CIKContext // if ( !pVMdl ) // return; + if ( !ThreadInMainThread() ) + { + return; + } + studiohdr_t const *pRMdl = pStudioHdr->GetRenderHdr(); if ( !pRMdl || !pRMdl->numincludemodels ) @@ -495,12 +506,12 @@ void CPoseDebuggerImpl::AccumulatePose( const CStudioHdr *pStudioHdr, CIKContext // Actual processing // - mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( sequence ); + mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( sequence ); if ( sequence >= pStudioHdr->GetNumSeq() ) { sequence = 0; - seqdesc = pStudioHdr->pSeqdesc( sequence ); + seqdesc = ((CStudioHdr *)pStudioHdr)->pSeqdesc( sequence ); } enum @@ -546,9 +557,9 @@ void CPoseDebuggerImpl::AccumulatePose( const CStudioHdr *pStudioHdr, CIKContext 7, pOldTxt ? pOldTxt->m_flTimeAlive : 0.f, 5, - cycle * ( pStudioHdr->pAnimdesc( seqdesc.anim( 0, 0 ) ).numframes - 1 ), + cycle * ( ((CStudioHdr *)pStudioHdr)->pAnimdesc( seqdesc.anim( 0, 0 ) ).numframes - 1 ), 3, - pStudioHdr->pAnimdesc( seqdesc.anim( 0, 0 ) ).numframes, + ((CStudioHdr *)pStudioHdr)->pAnimdesc( seqdesc.anim( 0, 0 ) ).numframes, widthPercent, flWeight * 100.0f ); diff --git a/public/raytrace.h b/public/raytrace.h index 6959b1972..d4d77daf4 100644 --- a/public/raytrace.h +++ b/public/raytrace.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -120,7 +121,10 @@ struct CacheOptimizedTriangle // computing intersections. int ClassifyAgainstAxisSplit(int split_plane, float split_value); // PLANECHECK_xxx below - + + // Debug - take a triangle that has been converted to intersection format and extract the vertices + // from by intersecting the planes + void ExtractVerticesFromIntersectionFormat( Vector &v0, Vector &v1, Vector &v2 ) const; }; #define PLANECHECK_POSITIVE 1 @@ -203,7 +207,7 @@ struct RayTracingSingleResult struct RayTracingResult { FourVectors surface_normal; // surface normal at intersection - ALIGN16 int32 HitIds[4]; // -1=no hit. otherwise, triangle index + ALIGN16 int32 HitIds[4] ALIGN16_POST; // -1=no hit. otherwise, triangle index fltx4 HitDistance; // distance to intersection }; @@ -252,6 +256,16 @@ class ITransparentTriangleCallback virtual bool VisitTriangle_ShouldContinue( const TriIntersectData_t &triangle, const FourRays &rays, fltx4 *hitMask, fltx4 *b0, fltx4 *b1, fltx4 *b2, int32 hitID ) = 0; }; +enum RTECullMode_t +{ + RTE_CULL_NONE = 0, + RTE_CULL_FRONT, + RTE_CULL_BACK +}; + +// serialization flag bits and defines +#define RT_ENV_SERIALIZE_COLORS 1 + class RayTracingEnvironment { public: @@ -274,6 +288,12 @@ class RayTracingEnvironment Flags=0; } +#if !( defined ( _DEBUG ) && defined ( HAMMER_RAYTRACE ) ) + inline void* operator new( size_t size ) { MEM_ALLOC_CREDIT_( "RayTracingEnvironment" ); return MemAlloc_AllocAligned( size, 16 ); } + inline void* operator new( size_t size, int nBlockUse, const char *pFileName, int nLine ) { MEM_ALLOC_CREDIT_( "RayTracingEnvironment" ); return MemAlloc_AllocAligned( size, 16 ); } + inline void operator delete( void* p ) { MemAlloc_FreeAligned( p ); } + inline void operator delete( void* p, int nBlockUse, const char *pFileName, int nLine ) { MemAlloc_FreeAligned( p ); } +#endif // call AddTriangle to set up the world void AddTriangle(int32 id, const Vector &v1, const Vector &v2, const Vector &v3, @@ -296,18 +316,23 @@ class RayTracingEnvironment // SetupAccelerationStructure to prepare for tracing void SetupAccelerationStructure(void); - // lowest level intersection routine - fire 4 rays through the scene. all 4 rays must pass the // Check() function, and t extents must be initialized. skipid can be set to exclude a // particular id (such as the origin surface). This function finds the closest intersection. + template + void Trace4Rays(const FourRays &rays, fltx4 TMin, fltx4 TMax,int DirectionSignMask, + RayTracingResult *rslt_out, + int32 skip_id=-1, ITransparentTriangleCallback *pCallback = NULL ); + + // wrapper for the low level trace4 rays routine void Trace4Rays(const FourRays &rays, fltx4 TMin, fltx4 TMax,int DirectionSignMask, RayTracingResult *rslt_out, - int32 skip_id=-1, ITransparentTriangleCallback *pCallback = NULL); + int32 skip_id=-1, ITransparentTriangleCallback *pCallback = NULL, RTECullMode_t cullMode = RTE_CULL_NONE ); // higher level intersection routine that handles computing the mask and handling rays which do not match in direciton sign void Trace4Rays(const FourRays &rays, fltx4 TMin, fltx4 TMax, RayTracingResult *rslt_out, - int32 skip_id=-1, ITransparentTriangleCallback *pCallback = NULL); + int32 skip_id=-1, ITransparentTriangleCallback *pCallback = NULL, RTECullMode_t cullMode = RTE_CULL_NONE ); // compute virtual light sources to model inter-reflection void ComputeVirtualLightSources(void); @@ -332,13 +357,14 @@ class RayTracingEnvironment /// the rays by direction, tracing them 4 at a time, and de-interleaving the results. void AddToRayStream(RayStream &s, - Vector const &start,Vector const &end,RayTracingSingleResult *rslt_out); + Vector const &start,Vector const &end,RayTracingSingleResult *rslt_out, + RTECullMode_t cullMode = RTE_CULL_NONE); - inline void RayTracingEnvironment::FlushStreamEntry(RayStream &s,int msk); + inline void FlushStreamEntry(RayStream &s, int msk, RTECullMode_t cullMode = RTE_CULL_NONE); /// call this when you are done. handles all cleanup. After this is called, all rslt ptrs /// previously passed to AddToRaySteam will have been filled in. - void FinishRayStream(RayStream &s); + void FinishRayStream(RayStream &s, RTECullMode_t cullMode = RTE_CULL_NONE); int MakeLeafNode(int first_tri, int last_tri); @@ -382,6 +408,11 @@ class RayTracingEnvironment return TriangleColors[triID]; } + // (un)serialization + size_t GetSerializationNumBytes( uint32 nSerializationFlags = 0 ) const; + void Serialize( CUtlBuffer &outbuf, uint32 nSerializationFlags = 0 ) const; + void UnSerialize( CUtlBuffer &inbuf ); + }; diff --git a/public/server_class.h b/public/server_class.h index 4ca7501f8..adc747a1c 100644 --- a/public/server_class.h +++ b/public/server_class.h @@ -43,8 +43,10 @@ class ServerClass ServerClass *p1 = g_pServerClassHead; ServerClass *p2 = p1->m_pNext; - // use _stricmp because Q_stricmp isn't hooked up properly yet - if ( _stricmp( p1->GetName(), pNetworkName ) > 0) + // Comment from Alfred on 7/2/2004 6:43:24 PM in CL 91253, //ValveGames/main/src/public/server_class.h#18: + // ---> use _stricmp because Q_stricmp isn't hooked up properly yet + // [Sergiy, 10/19/2009] hooking up V_stricmp + if ( V_stricmp( p1->GetName(), pNetworkName ) > 0) { m_pNext = g_pServerClassHead; g_pServerClassHead = this; @@ -53,7 +55,7 @@ class ServerClass while( p1 ) { - if ( p2 == NULL || _stricmp( p2->GetName(), pNetworkName ) > 0) + if ( p2 == NULL || V_stricmp( p2->GetName(), pNetworkName ) > 0) { m_pNext = p2; p1->m_pNext = this; diff --git a/public/shake.h b/public/shake.h index 69a0c0fb9..1951ad8e2 100644 --- a/public/shake.h +++ b/public/shake.h @@ -14,16 +14,6 @@ // // Commands for the screen shake effect. -// - -struct ScreenShake_t -{ - int command; - float amplitude; - float frequency; - float duration; -}; - enum ShakeCommand_t { SHAKE_START = 0, // Starts the screen shake for all players within the radius. @@ -34,12 +24,42 @@ enum ShakeCommand_t SHAKE_START_NORUMBLE, // Starts a shake that does NOT rumble the controller. }; +// This structure must have a working copy/assignment constructor. +// At the time of this writing, the implicit one works properly. + +struct ScreenShake_t +{ + ShakeCommand_t command; + float amplitude; + float frequency; + float duration; + Vector direction; + + inline ScreenShake_t() : direction(0,0,0) {}; + inline ScreenShake_t( ShakeCommand_t _command, float _amplitude, float _frequency, + float _duration, const Vector &_direction ); +}; + // // Screen shake message. // extern int gmsgShake; + +// +// Commands for the screen tilt effect. +// + +struct ScreenTilt_t +{ + int command; + bool easeInOut; + QAngle angle; + float duration; + float time; +}; + // Fade in/out extern int gmsgFade; @@ -60,4 +80,12 @@ struct ScreenFade_t }; +// inline funcs: + +inline ScreenShake_t::ScreenShake_t( ShakeCommand_t _command, float _amplitude, float _frequency, + float _duration, const Vector &_direction ) : + command(_command), amplitude(_amplitude), frequency(_frequency), + duration(_duration), direction(_direction) +{} + #endif // SHAKE_H diff --git a/public/soundchars.h b/public/soundchars.h index 554325b02..6a7f80182 100644 --- a/public/soundchars.h +++ b/public/soundchars.h @@ -19,14 +19,17 @@ #define CHAR_DISTVARIANT '^' // as one of 1st 2 chars in name, indicates distance variant encoded stereo wav (left is close, right is far) #define CHAR_OMNI '@' // as one of 1st 2 chars in name, indicates non-directional wav (default mono or stereo) #define CHAR_SPATIALSTEREO ')' // as one of 1st 2 chars in name, indicates spatialized stereo wav +#define CHAR_DIRSTEREO '(' // as one of 1st 2 chars in name, indicates directional stereo wav (like doppler) #define CHAR_FAST_PITCH '}' // as one of 1st 2 chars in name, forces low quality, non-interpolated pitch shift +#define CHAR_SUBTITLED '$' // as one of 1st 2 chars in name, indicates the subtitles are forced inline bool IsSoundChar(char c) { bool b; - b = (c == CHAR_STREAM || c == CHAR_USERVOX || c == CHAR_SENTENCE || c == CHAR_DRYMIX || c == CHAR_OMNI ); - b = b || (c == CHAR_DOPPLER || c == CHAR_DIRECTIONAL || c == CHAR_DISTVARIANT || c == CHAR_SPATIALSTEREO || c == CHAR_FAST_PITCH ); + b = ( c == CHAR_STREAM || c == CHAR_USERVOX || c == CHAR_SENTENCE || c == CHAR_DRYMIX || c == CHAR_OMNI || c== CHAR_DIRSTEREO ); + b = b || ( c == CHAR_DOPPLER || c == CHAR_DIRECTIONAL || c == CHAR_DISTVARIANT || c == CHAR_SPATIALSTEREO || c == CHAR_FAST_PITCH ); + b = b || ( c == CHAR_SUBTITLED ); return b; } diff --git a/public/soundflags.h b/public/soundflags.h index eb8ff3d2e..5d7b386fb 100644 --- a/public/soundflags.h +++ b/public/soundflags.h @@ -27,6 +27,10 @@ enum CHAN_STREAM = 5, // allocate stream channel from the static or dynamic area CHAN_STATIC = 6, // allocate channel from the static area CHAN_VOICE_BASE = 7, // allocate channel for network voice data +}; + +enum +{ CHAN_USER_BASE = (CHAN_VOICE_BASE+128) // Anything >= this number is allocated to game code. }; @@ -102,7 +106,7 @@ enum soundlevel_t #define ATTN_TO_SNDLVL( a ) (soundlevel_t)(int)((a) ? (50 + 20 / ((float)a)) : 0 ) -#define SNDLVL_TO_ATTN( a ) ((a > 50) ? (20.0f / (float)(a - 50)) : 4.0 ) +#define SNDLVL_TO_ATTN( a ) ( (a > 50) ? (20.0f / (float)(a - 50)) : ( (a == 0) ? (0.0f) : (4.0f) ) ) // This is a limit due to network encoding. // It encodes attenuation * 64 in 8 bits, so the maximum is (255 / 64) diff --git a/public/soundinfo.h b/public/soundinfo.h index d53608d64..4073febd8 100644 --- a/public/soundinfo.h +++ b/public/soundinfo.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -67,26 +67,31 @@ // This means any negative sound delay greater than -100ms will get encoded at full precision #define SOUND_DELAY_OFFSET (0.100f) +#pragma pack(4) +// the full float time for now. +#define SEND_SOUND_TIME 1 + //----------------------------------------------------------------------------- struct SoundInfo_t { - int nSequenceNumber; - int nEntityIndex; - int nChannel; - const char *pszName; // UNDONE: Make this a FilenameHandle_t to avoid bugs with arrays of these Vector vOrigin; Vector vDirection; + Vector vListenerOrigin; + const char *pszName; // UNDONE: Make this a FilenameHandle_t to avoid bugs with arrays of these float fVolume; - soundlevel_t Soundlevel; - bool bLooping; + float fDelay; + float fTickTime; // delay is encoded relative to this tick, fix up if packet is delayed + int nSequenceNumber; + int nEntityIndex; + int nChannel; int nPitch; - Vector vListenerOrigin; int nFlags; int nSoundNum; - float fDelay; + int nSpeakerEntity; + soundlevel_t Soundlevel; bool bIsSentence; bool bIsAmbient; - int nSpeakerEntity; + bool bLooping; //--------------------------------- @@ -114,6 +119,7 @@ struct SoundInfo_t void SetDefault() { fDelay = DEFAULT_SOUND_PACKET_DELAY; + fTickTime = 0; fVolume = DEFAULT_SOUND_PACKET_VOLUME; Soundlevel = SNDLVL_NORM; nPitch = DEFAULT_SOUND_PACKET_PITCH; @@ -150,7 +156,7 @@ struct SoundInfo_t } // this cries for Send/RecvTables: - void WriteDelta( SoundInfo_t *delta, bf_write &buffer) + void WriteDelta( SoundInfo_t *delta, bf_write &buffer, float finalTickTime ) { if ( nEntityIndex == delta->nEntityIndex ) { @@ -215,7 +221,12 @@ struct SoundInfo_t WRITE_DELTA_UINT( nPitch, 8 ); - if ( fDelay == delta->fDelay ) + float delayValue = fDelay; + if ( (nFlags & SND_DELAY) && fTickTime != finalTickTime ) + { + delayValue += fTickTime - finalTickTime; + } + if ( delayValue == delta->fDelay ) { buffer.WriteOneBit( 0 ); } @@ -223,12 +234,15 @@ struct SoundInfo_t { buffer.WriteOneBit( 1 ); +#if SEND_SOUND_TIME + buffer.WriteFloat( delayValue ); +#else // skipahead works in 10 ms increments // bias results so that we only incur the precision loss on relatively large skipaheads - fDelay += SOUND_DELAY_OFFSET; + delayValue += SOUND_DELAY_OFFSET; // Convert to msecs - int iDelay = fDelay * 1000.0f; + int iDelay = delayValue * 1000.0f; iDelay = clamp( iDelay, (int)(-10 * MAX_SOUND_DELAY_MSEC), (int)(MAX_SOUND_DELAY_MSEC) ); @@ -238,6 +252,7 @@ struct SoundInfo_t } buffer.WriteSBitLong( iDelay , MAX_SOUND_DELAY_MSEC_ENCODE_BITS ); +#endif } // don't transmit sounds with high precision @@ -318,6 +333,9 @@ struct SoundInfo_t if ( buffer.ReadOneBit() != 0 ) { +#if SEND_SOUND_TIME + fDelay = buffer.ReadFloat(); +#else // Up to 4096 msec delay fDelay = (float)buffer.ReadSBitLong( MAX_SOUND_DELAY_MSEC_ENCODE_BITS ) / 1000.0f; ; @@ -327,6 +345,7 @@ struct SoundInfo_t } // bias results so that we only incur the precision loss on relatively large skipaheads fDelay -= SOUND_DELAY_OFFSET; +#endif } else { @@ -364,5 +383,6 @@ struct SpatializationInfo_t QAngle *pAngles; float *pflRadius; }; +#pragma pack() #endif // SOUNDINFO_H diff --git a/public/steam/isteamapplist.h b/public/steam/isteamapplist.h new file mode 100644 index 000000000..e6726c1ac --- /dev/null +++ b/public/steam/isteamapplist.h @@ -0,0 +1,63 @@ +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to app data in Steam +// +//============================================================================= + +#ifndef ISTEAMAPPLIST_H +#define ISTEAMAPPLIST_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" +#include "steamtypes.h" + +//----------------------------------------------------------------------------- +// Purpose: This is a restricted interface that can only be used by previously approved apps, +// contact your Steam Account Manager if you believe you need access to this API. +// This interface lets you detect installed apps for the local Steam client, useful for debugging tools +// to offer lists of apps to debug via Steam. +//----------------------------------------------------------------------------- +class ISteamAppList +{ +public: + virtual uint32 GetNumInstalledApps() = 0; + virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0; + + virtual int GetAppName( AppId_t nAppID, char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found + virtual int GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) = 0; // returns -1 if no dir was found + + virtual int GetAppBuildId( AppId_t nAppID ) = 0; // return the buildid of this app, may change at any time based on backend updates to the game +}; + +#define STEAMAPPLIST_INTERFACE_VERSION "STEAMAPPLIST_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +//--------------------------------------------------------------------------------- +// Purpose: Sent when a new app is installed +//--------------------------------------------------------------------------------- +DEFINE_CALLBACK( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 ); + CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +END_DEFINE_CALLBACK_1() + + +//--------------------------------------------------------------------------------- +// Purpose: Sent when an app is uninstalled +//--------------------------------------------------------------------------------- +DEFINE_CALLBACK( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 ); + CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +END_DEFINE_CALLBACK_1() + + +#pragma pack( pop ) +#endif // ISTEAMAPPLIST_H diff --git a/public/steam/isteamapps.h b/public/steam/isteamapps.h index 4a8a2c156..070058360 100644 --- a/public/steam/isteamapps.h +++ b/public/steam/isteamapps.h @@ -1,39 +1,154 @@ -//====== Copyright © 1996-2007, Valve Corporation, All rights reserved. ======= -// -// Purpose: interface to app data in Steam -// -//============================================================================= - -#ifndef ISTEAMAPPS_H -#define ISTEAMAPPS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "steam/isteamapps.h" - -//----------------------------------------------------------------------------- -// Purpose: interface to app data -//----------------------------------------------------------------------------- -class ISteamApps -{ -public: - // returns 0 if the key does not exist - // this may be true on first call, since the app data may not be cached locally yet - // If you expect it to exists wait for the AppDataChanged_t after the first failure and ask again - virtual int GetAppData( uint32 nAppID, const char *pchKey, char *pchValue, int cchValueMax ) = 0; -}; - -#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION001" - -//----------------------------------------------------------------------------- -// Purpose: called when new information about an app has arrived -//----------------------------------------------------------------------------- -struct AppDataChanged_t -{ - enum { k_iCallback = k_iSteamAppsCallbacks + 1 }; - uint32 m_nAppID; - bool m_bWebDataChanged; -}; - -#endif // ISTEAMAPPS_H +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to app data in Steam +// +//============================================================================= + +#ifndef ISTEAMAPPS_H +#define ISTEAMAPPS_H +#ifdef _WIN32 +#pragma once +#endif + +const int k_cubAppProofOfPurchaseKeyMax = 64; // max bytes of a legacy cd key we support + + +//----------------------------------------------------------------------------- +// Purpose: interface to app data +//----------------------------------------------------------------------------- +class ISteamApps +{ +public: + virtual bool BIsSubscribed() = 0; + virtual bool BIsLowViolence() = 0; + virtual bool BIsCybercafe() = 0; + virtual bool BIsVACBanned() = 0; + virtual const char *GetCurrentGameLanguage() = 0; + virtual const char *GetAvailableGameLanguages() = 0; + + // only use this member if you need to check ownership of another game related to yours, a demo for example + virtual bool BIsSubscribedApp( AppId_t appID ) = 0; + + // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed + virtual bool BIsDlcInstalled( AppId_t appID ) = 0; + + // returns the Unix time of the purchase of the app + virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0; + + // Checks if the user is subscribed to the current app through a free weekend + // This function will return false for users who have a retail or other type of license + // Before using, please ask your Valve technical contact how to package and secure your free weekened + virtual bool BIsSubscribedFromFreeWeekend() = 0; + + // Returns the number of DLC pieces for the running app + virtual int GetDLCCount() = 0; + + // Returns metadata for DLC by index, of range [0, GetDLCCount()] + virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0; + + // Install/Uninstall control for optional DLC + virtual void InstallDLC( AppId_t nAppID ) = 0; + virtual void UninstallDLC( AppId_t nAppID ) = 0; + + // Request cd-key for yourself or owned DLC. If you are interested in this + // data then make sure you provide us with a list of valid keys to be distributed + // to users when they purchase the game, before the game ships. + // You'll receive an AppProofOfPurchaseKeyResponse_t callback when + // the key is available (which may be immediately). + virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0; + + virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch + virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing + virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order + + // returns current app install folder for AppID, returns folder name length + virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0; + virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned) + + virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed + + // Returns the associated launch param if the game is run via steam://run///?param1=value1;param2=value2;param3=value3 etc. + // Parameter names starting with the character '@' are reserved for internal use and will always return and empty string. + // Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game, + // but it is advised that you not param names beginning with an underscore for your own features. + virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0; + + // get download progress for optional DLC + virtual bool GetDlcDownloadProgress( AppId_t nAppID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0; + + // return the buildid of this app, may change at any time based on backend updates to the game + virtual int GetAppBuildId() = 0; +#ifdef _PS3 + // Result returned in a RegisterActivationCodeResponse_t callresult + virtual SteamAPICall_t RegisterActivationCode( const char *pchActivationCode ) = 0; +#endif +}; + +#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION007" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif +//----------------------------------------------------------------------------- +// Purpose: posted after the user gains ownership of DLC & that DLC is installed +//----------------------------------------------------------------------------- +struct DlcInstalled_t +{ + enum { k_iCallback = k_iSteamAppsCallbacks + 5 }; + AppId_t m_nAppID; // AppID of the DLC +}; + + +//----------------------------------------------------------------------------- +// Purpose: possible results when registering an activation code +//----------------------------------------------------------------------------- +enum ERegisterActivationCodeResult +{ + k_ERegisterActivationCodeResultOK = 0, + k_ERegisterActivationCodeResultFail = 1, + k_ERegisterActivationCodeResultAlreadyRegistered = 2, + k_ERegisterActivationCodeResultTimeout = 3, + k_ERegisterActivationCodeAlreadyOwned = 4, +}; + + +//----------------------------------------------------------------------------- +// Purpose: response to RegisterActivationCode() +//----------------------------------------------------------------------------- +struct RegisterActivationCodeResponse_t +{ + enum { k_iCallback = k_iSteamAppsCallbacks + 8 }; + ERegisterActivationCodeResult m_eResult; + uint32 m_unPackageRegistered; // package that was registered. Only set on success +}; + +//----------------------------------------------------------------------------- +// Purpose: response to RegisterActivationCode() +//----------------------------------------------------------------------------- +struct AppProofOfPurchaseKeyResponse_t +{ + enum { k_iCallback = k_iSteamAppsCallbacks + 13 }; + EResult m_eResult; + uint32 m_nAppID; + char m_rgchKey[ k_cubAppProofOfPurchaseKeyMax ]; +}; + +//--------------------------------------------------------------------------------- +// Purpose: posted after the user gains executes a steam url with query parameters +// such as steam://run///?param1=value1;param2=value2;param3=value3; etc +// while the game is already running. The new params can be queried +// with GetLaunchQueryParam. +//--------------------------------------------------------------------------------- +struct NewLaunchQueryParameters_t +{ + enum { k_iCallback = k_iSteamAppsCallbacks + 14 }; +}; + + +#pragma pack( pop ) +#endif // ISTEAMAPPS_H diff --git a/public/steam/isteamappticket.h b/public/steam/isteamappticket.h new file mode 100644 index 000000000..2e39eb0b4 --- /dev/null +++ b/public/steam/isteamappticket.h @@ -0,0 +1,28 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: a private, but well versioned, interface to get at critical bits +// of a steam3 appticket - consumed by the simple drm wrapper to let it +// ask about ownership with greater confidence. +// +//============================================================================= + +#ifndef ISTEAMAPPTICKET_H +#define ISTEAMAPPTICKET_H +#pragma once + +//----------------------------------------------------------------------------- +// Purpose: hand out a reasonable "future proof" view of an app ownership ticket +// the raw (signed) buffer, and indices into that buffer where the appid and +// steamid are located. the sizes of the appid and steamid are implicit in +// (each version of) the interface - currently uin32 appid and uint64 steamid +//----------------------------------------------------------------------------- +class ISteamAppTicket +{ +public: + virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature ) = 0; +}; + +#define STEAMAPPTICKET_INTERFACE_VERSION "STEAMAPPTICKET_INTERFACE_VERSION001" + + +#endif // ISTEAMAPPTICKET_H diff --git a/public/steam/isteamclient.h b/public/steam/isteamclient.h index 6c98bcc81..796d72d69 100644 --- a/public/steam/isteamclient.h +++ b/public/steam/isteamclient.h @@ -1,137 +1,503 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: -// -//============================================================================= - -#ifndef ISTEAMCLIENT_H -#define ISTEAMCLIENT_H -#ifdef _WIN32 -#pragma once -#endif - -#include "steamtypes.h" -#include "steamclientpublic.h" - -// handle to a communication pipe to the Steam client -typedef int32 HSteamPipe; -// handle to single instance of a steam user -typedef int32 HSteamUser; - -#ifndef DLL_EXPORT -#define DLL_EXPORT -#endif - -// interface predec -class ISteamUser; -class ISteamGameServer; -class ISteamFriends; -class ISteamUtils; -class ISteamMatchmaking; -class ISteamContentServer; -class ISteamMasterServerUpdater; -class ISteamMatchmakingServers; -class ISteam2Bridge; -class ISteamUserStats; -class ISteamApps; - -//----------------------------------------------------------------------------- -// Purpose: Interface to creating a new steam instance, or to -// connect to an existing steam instance, whether it's in a -// different process or is local -//----------------------------------------------------------------------------- -class ISteamClient -{ -public: - // Creates a communication pipe to the Steam client - virtual HSteamPipe CreateSteamPipe() = 0; - - // Releases a previously created communications pipe - virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0; - - // connects to an existing global user, failing if none exists - // used by the game to coordinate with the steamUI - virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0; - - // used by game servers, create a steam user that won't be shared with anyone else - virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe ) = 0; - - // removes an allocated user - virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0; - - // retrieves the ISteamUser interface associated with the handle - virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // retrieves the ISteamGameServer interface associated with the handle - virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // set the local IP and Port to bind to - // this must be set before CreateLocalUser() - virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0; - - // returns the ISteamFriends interface - virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamUtils interface - virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamMatchmaking interface - virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamContentServer interface - virtual ISteamContentServer *GetISteamContentServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamMasterServerUpdater interface - virtual ISteamMasterServerUpdater *GetISteamMasterServerUpdater( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamMatchmakingServers interface - virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteam2Bridge interface - virtual ISteam2Bridge *GetISteam2Bridge( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - virtual void RunFrame() = 0; - - // returns the number of IPC calls made since the last time this function was called - // Used for perf debugging so you can understand how many IPC calls your game makes per frame - // Every IPC call is at minimum a thread context switch if not a process one so you want to rate - // control how often you do them. - virtual uint32 GetIPCCallCount() = 0; - - // returns the ISteamUserStats interface - virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns apps interface - virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; -}; - -#define STEAMCLIENT_INTERFACE_VERSION "SteamClient007" - -//----------------------------------------------------------------------------- -// Purpose: Base values for callback identifiers, each callback must -// have a unique ID. -//----------------------------------------------------------------------------- -enum { k_iSteamUserCallbacks = 100 }; -enum { k_iSteamGameServerCallbacks = 200 }; -enum { k_iSteamFriendsCallbacks = 300 }; -enum { k_iSteamBillingCallbacks = 400 }; -enum { k_iSteamMatchmakingCallbacks = 500 }; -enum { k_iSteamContentServerCallbacks = 600 }; -enum { k_iSteamUtilsCallbacks = 700 }; -enum { k_iClientFriendsCallbacks = 800 }; -enum { k_iClientUserCallbacks = 900 }; -enum { k_iSteamAppsCallbacks = 1000 }; -enum { k_iSteamUserStatsCallbacks = 1100 }; - -// For GoldSRC we need a C API as the C++ ABI changed from the GoldSRC compiler -// (GCC 2.95.3) to the Source/Steam3 one (GCC 3.4.1) -// C functions we export for the C API, maps to ISteamClient functions -DLL_EXPORT HSteamPipe Steam_CreateSteamPipe(); -DLL_EXPORT bool Steam_BReleaseSteamPipe( HSteamPipe hSteamPipe ); -DLL_EXPORT HSteamUser Steam_CreateLocalUser( HSteamPipe *phSteamPipe ); -DLL_EXPORT HSteamUser Steam_ConnectToGlobalUser( HSteamPipe hSteamPipe ); -DLL_EXPORT void Steam_ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ); -DLL_EXPORT void Steam_SetLocalIPBinding( uint32 unIP, uint16 usLocalPort ); - - -#endif // ISTEAMCLIENT_H +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: Main interface for loading and accessing Steamworks API's from the +// Steam client. +// For most uses, this code is wrapped inside of SteamAPI_Init() +//============================================================================= + +#ifndef ISTEAMCLIENT_H +#define ISTEAMCLIENT_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steamtypes.h" +#include "steamclientpublic.h" + +// Define compile time assert macros to let us validate the structure sizes. +#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1]; + +#ifndef REFERENCE +#define REFERENCE(arg) ((void)arg) +#endif + +#if defined(__linux__) || defined(__APPLE__) +// The 32-bit version of gcc has the alignment requirement for uint64 and double set to +// 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned. +// The 64-bit version of gcc has the alignment requirement for these types set to +// 8 meaning that unless we use #pragma pack(4) our structures will get bigger. +// The 64-bit structure packing has to match the 32-bit structure packing for each platform. +#define VALVE_CALLBACK_PACK_SMALL +#else +#define VALVE_CALLBACK_PACK_LARGE +#endif + +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error ??? +#endif + +typedef struct ValvePackingSentinel_t +{ + uint32 m_u32; + uint64 m_u64; + uint16 m_u16; + double m_d; +} ValvePackingSentinel_t; + +#pragma pack( pop ) + + +#if defined(VALVE_CALLBACK_PACK_SMALL) +VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 24 ) +#elif defined(VALVE_CALLBACK_PACK_LARGE) +VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 32 ) +#else +#error ??? +#endif + + +// handle to a communication pipe to the Steam client +typedef int32 HSteamPipe; +// handle to single instance of a steam user +typedef int32 HSteamUser; +// function prototype +#if defined( POSIX ) +#define __cdecl +#endif +extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *); +extern "C" typedef void( *SteamAPI_PostAPIResultInProcess_t )(SteamAPICall_t callHandle, void *, uint32 unCallbackSize, int iCallbackNum); +extern "C" typedef uint32 ( *SteamAPI_CheckCallbackRegistered_t )( int iCallbackNum ); +#if defined( __SNC__ ) + #pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor +#endif + +// interface predec +class ISteamUser; +class ISteamGameServer; +class ISteamFriends; +class ISteamUtils; +class ISteamMatchmaking; +class ISteamContentServer; +class ISteamMatchmakingServers; +class ISteamUserStats; +class ISteamApps; +class ISteamNetworking; +class ISteamRemoteStorage; +class ISteamScreenshots; +class ISteamMusic; +class ISteamMusicRemote; +class ISteamGameServerStats; +class ISteamPS3OverlayRender; +class ISteamHTTP; +class ISteamUnifiedMessages; +class ISteamController; +class ISteamUGC; +class ISteamAppList; +class ISteamHTMLSurface; +class ISteamInventory; +class ISteamVideo; + +//----------------------------------------------------------------------------- +// Purpose: Interface to creating a new steam instance, or to +// connect to an existing steam instance, whether it's in a +// different process or is local. +// +// For most scenarios this is all handled automatically via SteamAPI_Init(). +// You'll only need to use these interfaces if you have a more complex versioning scheme, +// where you want to get different versions of the same interface in different dll's in your project. +//----------------------------------------------------------------------------- +class ISteamClient +{ +public: + // Creates a communication pipe to the Steam client + virtual HSteamPipe CreateSteamPipe() = 0; + + // Releases a previously created communications pipe + virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0; + + // connects to an existing global user, failing if none exists + // used by the game to coordinate with the steamUI + virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0; + + // used by game servers, create a steam user that won't be shared with anyone else + virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) = 0; + + // removes an allocated user + virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0; + + // retrieves the ISteamUser interface associated with the handle + virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // retrieves the ISteamGameServer interface associated with the handle + virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // set the local IP and Port to bind to + // this must be set before CreateLocalUser() + virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0; + + // returns the ISteamFriends interface + virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns the ISteamUtils interface + virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns the ISteamMatchmaking interface + virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns the ISteamMatchmakingServers interface + virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns the a generic interface + virtual void *GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns the ISteamUserStats interface + virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns the ISteamGameServerStats interface + virtual ISteamGameServerStats *GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns apps interface + virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // networking + virtual ISteamNetworking *GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // remote storage + virtual ISteamRemoteStorage *GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // user screenshots + virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // this needs to be called every frame to process matchmaking results + // redundant if you're already calling SteamAPI_RunCallbacks() + virtual void RunFrame() = 0; + + // returns the number of IPC calls made since the last time this function was called + // Used for perf debugging so you can understand how many IPC calls your game makes per frame + // Every IPC call is at minimum a thread context switch if not a process one so you want to rate + // control how often you do them. + virtual uint32 GetIPCCallCount() = 0; + + // API warning handling + // 'int' is the severity; 0 for msg, 1 for warning + // 'const char *' is the text of the message + // callbacks will occur directly after the API function is called that generated the warning or message + virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0; + + // Trigger global shutdown for the DLL + virtual bool BShutdownIfAllPipesClosed() = 0; + +#ifdef _PS3 + virtual ISteamPS3OverlayRender *GetISteamPS3OverlayRender() = 0; +#endif + + // Expose HTTP interface + virtual ISteamHTTP *GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Exposes the ISteamUnifiedMessages interface + virtual ISteamUnifiedMessages *GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Exposes the ISteamController interface + virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Exposes the ISteamUGC interface + virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns app list interface, only available on specially registered apps + virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Music Player + virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Music Player Remote + virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0; + + // html page display + virtual ISteamHTMLSurface *GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0; + + // Helper functions for internal Steam usage + virtual void Set_SteamAPI_CPostAPIResultInProcess( SteamAPI_PostAPIResultInProcess_t func ) = 0; + virtual void Remove_SteamAPI_CPostAPIResultInProcess( SteamAPI_PostAPIResultInProcess_t func ) = 0; + virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess( SteamAPI_CheckCallbackRegistered_t func ) = 0; + + // inventory + virtual ISteamInventory *GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Video + virtual ISteamVideo *GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; +}; + + +#define STEAMCLIENT_INTERFACE_VERSION "SteamClient017" + +//----------------------------------------------------------------------------- +// Purpose: Base values for callback identifiers, each callback must +// have a unique ID. +//----------------------------------------------------------------------------- +enum { k_iSteamUserCallbacks = 100 }; +enum { k_iSteamGameServerCallbacks = 200 }; +enum { k_iSteamFriendsCallbacks = 300 }; +enum { k_iSteamBillingCallbacks = 400 }; +enum { k_iSteamMatchmakingCallbacks = 500 }; +enum { k_iSteamContentServerCallbacks = 600 }; +enum { k_iSteamUtilsCallbacks = 700 }; +enum { k_iClientFriendsCallbacks = 800 }; +enum { k_iClientUserCallbacks = 900 }; +enum { k_iSteamAppsCallbacks = 1000 }; +enum { k_iSteamUserStatsCallbacks = 1100 }; +enum { k_iSteamNetworkingCallbacks = 1200 }; +enum { k_iClientRemoteStorageCallbacks = 1300 }; +enum { k_iClientDepotBuilderCallbacks = 1400 }; +enum { k_iSteamGameServerItemsCallbacks = 1500 }; +enum { k_iClientUtilsCallbacks = 1600 }; +enum { k_iSteamGameCoordinatorCallbacks = 1700 }; +enum { k_iSteamGameServerStatsCallbacks = 1800 }; +enum { k_iSteam2AsyncCallbacks = 1900 }; +enum { k_iSteamGameStatsCallbacks = 2000 }; +enum { k_iClientHTTPCallbacks = 2100 }; +enum { k_iClientScreenshotsCallbacks = 2200 }; +enum { k_iSteamScreenshotsCallbacks = 2300 }; +enum { k_iClientAudioCallbacks = 2400 }; +enum { k_iClientUnifiedMessagesCallbacks = 2500 }; +enum { k_iSteamStreamLauncherCallbacks = 2600 }; +enum { k_iClientControllerCallbacks = 2700 }; +enum { k_iSteamControllerCallbacks = 2800 }; +enum { k_iClientParentalSettingsCallbacks = 2900 }; +enum { k_iClientDeviceAuthCallbacks = 3000 }; +enum { k_iClientNetworkDeviceManagerCallbacks = 3100 }; +enum { k_iClientMusicCallbacks = 3200 }; +enum { k_iClientRemoteClientManagerCallbacks = 3300 }; +enum { k_iClientUGCCallbacks = 3400 }; +enum { k_iSteamStreamClientCallbacks = 3500 }; +enum { k_IClientProductBuilderCallbacks = 3600 }; +enum { k_iClientShortcutsCallbacks = 3700 }; +enum { k_iClientRemoteControlManagerCallbacks = 3800 }; +enum { k_iSteamAppListCallbacks = 3900 }; +enum { k_iSteamMusicCallbacks = 4000 }; +enum { k_iSteamMusicRemoteCallbacks = 4100 }; +enum { k_iClientVRCallbacks = 4200 }; +enum { k_iClientReservedCallbacks = 4300 }; +enum { k_iSteamReservedCallbacks = 4400 }; +enum { k_iSteamHTMLSurfaceCallbacks = 4500 }; +enum { k_iClientVideoCallbacks = 4600 }; +enum { k_iClientInventoryCallbacks = 4700 }; + +//----------------------------------------------------------------------------- +// The CALLBACK macros are for client side callback logging enabled with +// log_callback +// Do not change any of these. +//----------------------------------------------------------------------------- + +struct SteamCallback_t +{ +public: + SteamCallback_t() {} +}; + +#define DEFINE_CALLBACK( callbackname, callbackid ) \ +struct callbackname : SteamCallback_t { \ + enum { k_iCallback = callbackid }; \ + static callbackname *GetNullPointer() { return 0; } \ + static const char *GetCallbackName() { return #callbackname; } \ + static uint32 GetCallbackID() { return callbackname::k_iCallback; } + +#define CALLBACK_MEMBER( varidx, vartype, varname ) \ + public: vartype varname ; \ + static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \ + varOffset = (unsigned int)(size_t)&GetNullPointer()->varname; \ + varSize = sizeof( vartype ); \ + varCount = 1; \ + *pszName = #varname; *pszType = #vartype; } + +#define CALLBACK_ARRAY( varidx, vartype, varname, varcount ) \ + public: vartype varname [ varcount ]; \ + static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \ + varOffset = (unsigned int)(size_t)&GetNullPointer()->varname[0]; \ + varSize = sizeof( vartype ); \ + varCount = varcount; \ + *pszName = #varname; *pszType = #vartype; } + + +#define END_CALLBACK_INTERNAL_BEGIN( numvars ) \ + static uint32 GetNumMemberVariables() { return numvars; } \ + static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \ + switch ( index ) { default : return false; + + +#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true; + +#define END_CALLBACK_INTERNAL_END() }; } }; + +#define END_DEFINE_CALLBACK_0() \ + static uint32 GetNumMemberVariables() { return 0; } \ + static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { REFERENCE( pszType ); REFERENCE( pszName ); REFERENCE( varCount ); REFERENCE( varSize ); REFERENCE( varOffset ); REFERENCE( index ); return false; } \ + }; + + +#define END_DEFINE_CALLBACK_1() \ + END_CALLBACK_INTERNAL_BEGIN( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_2() \ + END_CALLBACK_INTERNAL_BEGIN( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_3() \ + END_CALLBACK_INTERNAL_BEGIN( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_4() \ + END_CALLBACK_INTERNAL_BEGIN( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_5() \ + END_CALLBACK_INTERNAL_BEGIN( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_END() + + +#define END_DEFINE_CALLBACK_6() \ + END_CALLBACK_INTERNAL_BEGIN( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_7() \ + END_CALLBACK_INTERNAL_BEGIN( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_8() \ + END_CALLBACK_INTERNAL_BEGIN( 8 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_9() \ + END_CALLBACK_INTERNAL_BEGIN( 9 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_10() \ + END_CALLBACK_INTERNAL_BEGIN( 10 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_SWITCH( 9 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_11() \ + END_CALLBACK_INTERNAL_BEGIN( 11 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_SWITCH( 9 ) \ + END_CALLBACK_INTERNAL_SWITCH( 10 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_12() \ + END_CALLBACK_INTERNAL_BEGIN( 12 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_SWITCH( 9 ) \ + END_CALLBACK_INTERNAL_SWITCH( 10 ) \ + END_CALLBACK_INTERNAL_SWITCH( 11 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_13() \ + END_CALLBACK_INTERNAL_BEGIN( 13 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_SWITCH( 9 ) \ + END_CALLBACK_INTERNAL_SWITCH( 10 ) \ + END_CALLBACK_INTERNAL_SWITCH( 11 ) \ + END_CALLBACK_INTERNAL_SWITCH( 12 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_14() \ + END_CALLBACK_INTERNAL_BEGIN( 14 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_SWITCH( 9 ) \ + END_CALLBACK_INTERNAL_SWITCH( 10 ) \ + END_CALLBACK_INTERNAL_SWITCH( 11 ) \ + END_CALLBACK_INTERNAL_SWITCH( 12 ) \ + END_CALLBACK_INTERNAL_SWITCH( 13 ) \ + END_CALLBACK_INTERNAL_END() + +#endif // ISTEAMCLIENT_H diff --git a/public/steam/isteamcontroller.h b/public/steam/isteamcontroller.h new file mode 100644 index 000000000..a973696c1 --- /dev/null +++ b/public/steam/isteamcontroller.h @@ -0,0 +1,210 @@ +//====== Copyright 1996-2013, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to valve controller +// +//============================================================================= + +#ifndef ISTEAMCONTROLLER_H +#define ISTEAMCONTROLLER_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +#define STEAM_CONTROLLER_MAX_COUNT 16 + +#define STEAM_CONTROLLER_MAX_ANALOG_ACTIONS 16 + +#define STEAM_CONTROLLER_MAX_DIGITAL_ACTIONS 32 + +#define STEAM_CONTROLLER_MAX_ORIGINS 8 + +// When sending an option to a specific controller handle, you can send to all controllers via this command +#define STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS UINT64_MAX + +#define STEAM_CONTROLLER_MIN_ANALOG_ACTION_DATA -1.0f +#define STEAM_CONTROLLER_MAX_ANALOG_ACTION_DATA 1.0f + +enum ESteamControllerPad +{ + k_ESteamControllerPad_Left, + k_ESteamControllerPad_Right +}; + +enum EControllerSource +{ + k_EControllerSource_None, + k_EControllerSource_LeftTrackpad, + k_EControllerSource_RightTrackpad, + k_EControllerSource_Joystick, + k_EControllerSource_ABXY, + k_EControllerSource_Switch, + k_EControllerSource_LeftTrigger, + k_EControllerSource_RightTrigger, + k_EControllerSource_Gyro +}; + +enum EControllerSourceMode +{ + k_EControllerSourceMode_None, + k_EControllerSourceMode_Dpad, + k_EControllerSourceMode_Buttons, + k_EControllerSourceMode_FourButtons, + k_EControllerSourceMode_AbsoluteMouse, + k_EControllerSourceMode_RelativeMouse, + k_EControllerSourceMode_JoystickMove, + k_EControllerSourceMode_JoystickCamera, + k_EControllerSourceMode_ScrollWheel, + k_EControllerSourceMode_Trigger, + k_EControllerSourceMode_TouchMenu +}; + +enum EControllerActionOrigin +{ + k_EControllerActionOrigin_None, + k_EControllerActionOrigin_A, + k_EControllerActionOrigin_B, + k_EControllerActionOrigin_X, + k_EControllerActionOrigin_Y, + k_EControllerActionOrigin_LeftBumper, + k_EControllerActionOrigin_RightBumper, + k_EControllerActionOrigin_LeftGrip, + k_EControllerActionOrigin_RightGrip, + k_EControllerActionOrigin_Start, + k_EControllerActionOrigin_Back, + k_EControllerActionOrigin_LeftPad_Touch, + k_EControllerActionOrigin_LeftPad_Swipe, + k_EControllerActionOrigin_LeftPad_Click, + k_EControllerActionOrigin_LeftPad_DPadNorth, + k_EControllerActionOrigin_LeftPad_DPadSouth, + k_EControllerActionOrigin_LeftPad_DPadWest, + k_EControllerActionOrigin_LeftPad_DPadEast, + k_EControllerActionOrigin_RightPad_Touch, + k_EControllerActionOrigin_RightPad_Swipe, + k_EControllerActionOrigin_RightPad_Click, + k_EControllerActionOrigin_RightPad_DPadNorth, + k_EControllerActionOrigin_RightPad_DPadSouth, + k_EControllerActionOrigin_RightPad_DPadWest, + k_EControllerActionOrigin_RightPad_DPadEast, + k_EControllerActionOrigin_LeftTrigger_Pull, + k_EControllerActionOrigin_LeftTrigger_Click, + k_EControllerActionOrigin_RightTrigger_Pull, + k_EControllerActionOrigin_RightTrigger_Click, + k_EControllerActionOrigin_LeftStick_Move, + k_EControllerActionOrigin_LeftStick_Click, + k_EControllerActionOrigin_LeftStick_DPadNorth, + k_EControllerActionOrigin_LeftStick_DPadSouth, + k_EControllerActionOrigin_LeftStick_DPadWest, + k_EControllerActionOrigin_LeftStick_DPadEast, + k_EControllerActionOrigin_Gyro_Move, + k_EControllerActionOrigin_Gyro_Pitch, + k_EControllerActionOrigin_Gyro_Yaw, + k_EControllerActionOrigin_Gyro_Roll, + + k_EControllerActionOrigin_Count +}; + +// ControllerHandle_t is used to refer to a specific controller. +// This handle will consistently identify a controller, even if it is disconnected and re-connected +typedef uint64 ControllerHandle_t; + + +// These handles are used to refer to a specific in-game action or action set +// All action handles should be queried during initialization for performance reasons +typedef uint64 ControllerActionSetHandle_t; +typedef uint64 ControllerDigitalActionHandle_t; +typedef uint64 ControllerAnalogActionHandle_t; + +#pragma pack( push, 1 ) + +struct ControllerAnalogActionData_t +{ + // Type of data coming from this action, this will match what got specified in the action set + EControllerSourceMode eMode; + + // The current state of this action; will be delta updates for mouse actions + float x, y; + + // Whether or not this action is currently available to be bound in the active action set + bool bActive; +}; + +struct ControllerDigitalActionData_t +{ + // The current state of this action; will be true if currently pressed + bool bState; + + // Whether or not this action is currently available to be bound in the active action set + bool bActive; +}; + +#pragma pack( pop ) + + +//----------------------------------------------------------------------------- +// Purpose: Native Steam controller support API +//----------------------------------------------------------------------------- +class ISteamController +{ +public: + + // Init and Shutdown must be called when starting/ending use of this interface + virtual bool Init() = 0; + virtual bool Shutdown() = 0; + + // Pump callback/callresult events + // Note: SteamAPI_RunCallbacks will do this for you, so you should never need to call this directly. + virtual void RunFrame() = 0; + + // Enumerate currently connected controllers + // handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles + // Returns the number of handles written to handlesOut + virtual int GetConnectedControllers( ControllerHandle_t *handlesOut ) = 0; + + // Invokes the Steam overlay and brings up the binding screen + // Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode + virtual bool ShowBindingPanel( ControllerHandle_t controllerHandle ) = 0; + + // ACTION SETS + // Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls. + virtual ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0; + + // Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive') + // This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in + // your state loops, instead of trying to place it in all of your state transitions. + virtual void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) = 0; + virtual ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) = 0; + + // ACTIONS + // Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls. + virtual ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0; + + // Returns the current state of the supplied digital game action + virtual ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) = 0; + + // Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action. + // originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles + virtual int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin *originsOut ) = 0; + + // Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls. + virtual ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) = 0; + + // Returns the current state of these supplied analog game action + virtual ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) = 0; + + // Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action. + // originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles + virtual int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin *originsOut ) = 0; + + + + virtual void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) = 0; + + // Trigger a haptic pulse on a controller + virtual void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; +}; + +#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController003" + +#endif // ISTEAMCONTROLLER_H diff --git a/public/steam/isteamfriends.h b/public/steam/isteamfriends.h index d326ef875..7a8504673 100644 --- a/public/steam/isteamfriends.h +++ b/public/steam/isteamfriends.h @@ -1,168 +1,629 @@ - -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: interface to friends data in Steam -// -//============================================================================= - -#ifndef ISTEAMFRIENDS_H -#define ISTEAMFRIENDS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -//----------------------------------------------------------------------------- -// Purpose: set of relationships to other users -//----------------------------------------------------------------------------- -// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE -enum EFriendRelationship -{ - k_EFriendRelationshipNone = 0, - k_EFriendRelationshipBlocked = 1, - k_EFriendRelationshipRequestRecipient = 2, - k_EFriendRelationshipFriend = 3, - k_EFriendRelationshipRequestInitiator = 4, -}; - - -//----------------------------------------------------------------------------- -// Purpose: list of states a friend can be in -//----------------------------------------------------------------------------- -enum EPersonaState -{ - k_EPersonaStateOffline = 0, // friend is not currently logged on - k_EPersonaStateOnline = 1, // friend is logged on - k_EPersonaStateBusy = 2, // user is on, but busy - k_EPersonaStateAway = 3, // auto-away feature - k_EPersonaStateSnooze = 4, // auto-away for a long time - k_EPersonaStateMax, -}; - - -// for enumerating friends list -enum k_EFriendFlags -{ - k_EFriendFlagNone = 0x00, - k_EFriendFlagBlocked = 0x01, - k_EFriendFlagFriendshipRequested = 0x02, - k_EFriendFlagImmediate = 0x04, // "regular" friend - k_EFriendFlagClanMember = 0x08, - k_EFriendFlagOnGameServer = 0x10, - // k_EFriendFlagHasPlayedWith = 0x20, - // k_EFriendFlagFriendOfFriend = 0x40, - k_EFriendFlagRequestingFriendship = 0x80, - k_EFriendFlagRequestingInfo = 0x100, - k_EFriendFlagAll = 0xFFFF, -}; - - -enum { k_cchPersonaNameMax = 128 }; - -// size limit on chat room or member metadata -const uint32 k_cubChatMetadataMax = 4096; - -//----------------------------------------------------------------------------- -// Purpose: interface to friends -//----------------------------------------------------------------------------- -class ISteamFriends -{ -public: - // returns the local players name - guaranteed to not be NULL. - virtual const char *GetPersonaName() = 0; - // sets the player name, stores it on the server and publishes the changes to all friends who are online - virtual void SetPersonaName( const char *pchPersonaName ) = 0; - // gets the friend status of the current user - virtual EPersonaState GetPersonaState() = 0; - - // friend iteration - virtual int GetFriendCount( int iFriendFlags ) = 0; - virtual CSteamID GetFriendByIndex( int iFriend, int iFriendFlags ) = 0; - - // gets the relationship to a user - virtual EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend ) = 0; - // returns true if the specified user is considered a friend (can see our online status) - virtual EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) = 0; - // returns the name of a friend - guaranteed to not be NULL. - virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0; - // gets the avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set - virtual int GetFriendAvatar( CSteamID steamIDFriend ) = 0; - // returns true if the friend is actually in a game - virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, uint64 *pulGameID, uint32 *punGameIP, uint16 *pusGamePort, uint16 *pusQueryPort ) = 0; - // accesses old friends names - returns an empty string when their are no more items in the history - virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0; - - // returns true if the specified user is considered a friend - virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0; - - // clan functions - virtual int GetClanCount() = 0; - virtual CSteamID GetClanByIndex( int iClan ) = 0; - virtual const char *GetClanName( CSteamID steamIDClan ) = 0; - - // iterators for any source - virtual int GetFriendCountFromSource( CSteamID steamIDSource ) = 0; - virtual CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend ) = 0; - virtual bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource ) = 0; - - // User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI) - virtual void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) = 0; - - // activates the game overlay, with an optional dialog to open ("Friends", "Community", "Players", "Settings") - virtual void ActivateGameOverlay( const char *pchDialog ) = 0; -}; - -#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends003" - -//----------------------------------------------------------------------------- -// Purpose: called when a friends' status changes -//----------------------------------------------------------------------------- -struct PersonaStateChange_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 4 }; - - uint64 m_ulSteamID; // steamID of the friend who changed - int m_nChangeFlags; // what's changed -}; - - -// used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user -// these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend -enum EPersonaChange -{ - k_EPersonaChangeName = 0x001, - k_EPersonaChangeStatus = 0x002, - k_EPersonaChangeComeOnline = 0x004, - k_EPersonaChangeGoneOffline = 0x008, - k_EPersonaChangeGamePlayed = 0x010, - k_EPersonaChangeGameServer = 0x020, - k_EPersonaChangeAvatar = 0x040, - k_EPersonaChangeJoinedSource= 0x080, - k_EPersonaChangeLeftSource = 0x100, - k_EPersonaChangeRelationshipChanged = 0x200, - k_EPersonaChangeNameFirstSet = 0x400, -}; - - -//----------------------------------------------------------------------------- -// Purpose: posted when game overlay activates or deactivates -//----------------------------------------------------------------------------- -struct GameOverlayActivated_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 31 }; - uint8 m_bActive; // true if it's just been activated, false otherwise -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the user tries to join a different game server from their friends list -//----------------------------------------------------------------------------- -struct GameServerChangeRequested_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 32 }; - char m_rgchServer[64]; // server address ("127.0.0.1:27015", "tf2.valvesoftware.com") - char m_rgchPassword[64]; // server password, if any -}; - -#endif // ISTEAMFRIENDS_H +//====== Copyright (C) 1996-2008, Valve Corporation, All rights reserved. ===== +// +// Purpose: interface to both friends list data and general information about users +// +//============================================================================= + +#ifndef ISTEAMFRIENDS_H +#define ISTEAMFRIENDS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" +#include "steamclientpublic.h" + + +//----------------------------------------------------------------------------- +// Purpose: set of relationships to other users +//----------------------------------------------------------------------------- +enum EFriendRelationship +{ + k_EFriendRelationshipNone = 0, + k_EFriendRelationshipBlocked = 1, // this doesn't get stored; the user has just done an Ignore on an friendship invite + k_EFriendRelationshipRequestRecipient = 2, + k_EFriendRelationshipFriend = 3, + k_EFriendRelationshipRequestInitiator = 4, + k_EFriendRelationshipIgnored = 5, // this is stored; the user has explicit blocked this other user from comments/chat/etc + k_EFriendRelationshipIgnoredFriend = 6, + k_EFriendRelationshipSuggested = 7, + + // keep this updated + k_EFriendRelationshipMax = 8, +}; + +// maximum length of friend group name (not including terminating nul!) +const int k_cchMaxFriendsGroupName = 64; + +// maximum number of groups a single user is allowed +const int k_cFriendsGroupLimit = 100; + +// friends group identifier type +typedef int16 FriendsGroupID_t; + +// invalid friends group identifier constant +const FriendsGroupID_t k_FriendsGroupID_Invalid = -1; + +const int k_cEnumerateFollowersMax = 50; + + +//----------------------------------------------------------------------------- +// Purpose: list of states a friend can be in +//----------------------------------------------------------------------------- +enum EPersonaState +{ + k_EPersonaStateOffline = 0, // friend is not currently logged on + k_EPersonaStateOnline = 1, // friend is logged on + k_EPersonaStateBusy = 2, // user is on, but busy + k_EPersonaStateAway = 3, // auto-away feature + k_EPersonaStateSnooze = 4, // auto-away for a long time + k_EPersonaStateLookingToTrade = 5, // Online, trading + k_EPersonaStateLookingToPlay = 6, // Online, wanting to play + k_EPersonaStateMax, +}; + + +//----------------------------------------------------------------------------- +// Purpose: flags for enumerating friends list, or quickly checking a the relationship between users +//----------------------------------------------------------------------------- +enum EFriendFlags +{ + k_EFriendFlagNone = 0x00, + k_EFriendFlagBlocked = 0x01, + k_EFriendFlagFriendshipRequested = 0x02, + k_EFriendFlagImmediate = 0x04, // "regular" friend + k_EFriendFlagClanMember = 0x08, + k_EFriendFlagOnGameServer = 0x10, + // k_EFriendFlagHasPlayedWith = 0x20, // not currently used + // k_EFriendFlagFriendOfFriend = 0x40, // not currently used + k_EFriendFlagRequestingFriendship = 0x80, + k_EFriendFlagRequestingInfo = 0x100, + k_EFriendFlagIgnored = 0x200, + k_EFriendFlagIgnoredFriend = 0x400, + k_EFriendFlagSuggested = 0x800, + k_EFriendFlagAll = 0xFFFF, +}; + + +// friend game played information +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif +struct FriendGameInfo_t +{ + CGameID m_gameID; + uint32 m_unGameIP; + uint16 m_usGamePort; + uint16 m_usQueryPort; + CSteamID m_steamIDLobby; +}; +#pragma pack( pop ) + +// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16. +// The UTF-8 version has to be very generous to accomodate characters that get large when encoded +// in UTF-8. +enum +{ + k_cchPersonaNameMax = 128, + k_cwchPersonaNameMax = 32, +}; + +//----------------------------------------------------------------------------- +// Purpose: user restriction flags +//----------------------------------------------------------------------------- +enum EUserRestriction +{ + k_nUserRestrictionNone = 0, // no known chat/content restriction + k_nUserRestrictionUnknown = 1, // we don't know yet (user offline) + k_nUserRestrictionAnyChat = 2, // user is not allowed to (or can't) send/recv any chat + k_nUserRestrictionVoiceChat = 4, // user is not allowed to (or can't) send/recv voice chat + k_nUserRestrictionGroupChat = 8, // user is not allowed to (or can't) send/recv group chat + k_nUserRestrictionRating = 16, // user is too young according to rating in current region + k_nUserRestrictionGameInvites = 32, // user cannot send or recv game invites (e.g. mobile) + k_nUserRestrictionTrading = 64, // user cannot participate in trading (console, mobile) +}; + +//----------------------------------------------------------------------------- +// Purpose: information about user sessions +//----------------------------------------------------------------------------- +struct FriendSessionStateInfo_t +{ + uint32 m_uiOnlineSessionInstances; + uint8 m_uiPublishedToFriendsSessionInstance; +}; + + + +// size limit on chat room or member metadata +const uint32 k_cubChatMetadataMax = 8192; + +// size limits on Rich Presence data +enum { k_cchMaxRichPresenceKeys = 20 }; +enum { k_cchMaxRichPresenceKeyLength = 64 }; +enum { k_cchMaxRichPresenceValueLength = 256 }; + +// These values are passed as parameters to the store +enum EOverlayToStoreFlag +{ + k_EOverlayToStoreFlag_None = 0, + k_EOverlayToStoreFlag_AddToCart = 1, + k_EOverlayToStoreFlag_AddToCartAndShow = 2, +}; + +//----------------------------------------------------------------------------- +// Purpose: interface to accessing information about individual users, +// that can be a friend, in a group, on a game server or in a lobby with the local user +//----------------------------------------------------------------------------- +class ISteamFriends +{ +public: + // returns the local players name - guaranteed to not be NULL. + // this is the same name as on the users community profile page + // this is stored in UTF-8 format + // like all the other interface functions that return a char *, it's important that this pointer is not saved + // off; it will eventually be free'd or re-allocated + virtual const char *GetPersonaName() = 0; + + // Sets the player name, stores it on the server and publishes the changes to all friends who are online. + // Changes take place locally immediately, and a PersonaStateChange_t is posted, presuming success. + // + // The final results are available through the return value SteamAPICall_t, using SetPersonaNameResponse_t. + // + // If the name change fails to happen on the server, then an additional global PersonaStateChange_t will be posted + // to change the name back, in addition to the SetPersonaNameResponse_t callback. + virtual SteamAPICall_t SetPersonaName( const char *pchPersonaName ) = 0; + + // gets the status of the current user + virtual EPersonaState GetPersonaState() = 0; + + // friend iteration + // takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria + // then GetFriendByIndex() can then be used to return the id's of each of those users + virtual int GetFriendCount( int iFriendFlags ) = 0; + + // returns the steamID of a user + // iFriend is a index of range [0, GetFriendCount()) + // iFriendsFlags must be the same value as used in GetFriendCount() + // the returned CSteamID can then be used by all the functions below to access details about the user + virtual CSteamID GetFriendByIndex( int iFriend, int iFriendFlags ) = 0; + + // returns a relationship to a user + virtual EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend ) = 0; + + // returns the current status of the specified user + // this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user + virtual EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) = 0; + + // returns the name another user - guaranteed to not be NULL. + // same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user + // note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously + // + virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0; + + // returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details + virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo ) = 0; + // accesses old friends names - returns an empty string when their are no more items in the history + virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0; + // friends steam level + virtual int GetFriendSteamLevel( CSteamID steamIDFriend ) = 0; + + // Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player. + virtual const char *GetPlayerNickname( CSteamID steamIDPlayer ) = 0; + + // friend grouping (tag) apis + // returns the number of friends groups + virtual int GetFriendsGroupCount() = 0; + // returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid) + virtual FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG ) = 0; + // returns the name for the given friends group (NULL in the case of invalid friends group IDs) + virtual const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID ) = 0; + // returns the number of members in a given friends group + virtual int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID ) = 0; + // gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid + virtual void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID ) CSteamID *pOutSteamIDMembers, int nMembersCount ) = 0; + + // returns true if the specified user meets any of the criteria specified in iFriendFlags + // iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values + virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0; + + // clan (group) iteration and access functions + virtual int GetClanCount() = 0; + virtual CSteamID GetClanByIndex( int iClan ) = 0; + virtual const char *GetClanName( CSteamID steamIDClan ) = 0; + virtual const char *GetClanTag( CSteamID steamIDClan ) = 0; + // returns the most recent information we have about what's happening in a clan + virtual bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting ) = 0; + // for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest + virtual SteamAPICall_t DownloadClanActivityCounts( ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest ) = 0; + + // iterators for getting users in a chat room, lobby, game server or clan + // note that large clans that cannot be iterated by the local user + // note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby + // steamIDSource can be the steamID of a group, game server, lobby or chat room + virtual int GetFriendCountFromSource( CSteamID steamIDSource ) = 0; + virtual CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend ) = 0; + + // returns true if the local user can see that steamIDUser is a member or in steamIDSource + virtual bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource ) = 0; + + // User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI) + virtual void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) = 0; + + // activates the game overlay, with an optional dialog to open + // valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements" + virtual void ActivateGameOverlay( const char *pchDialog ) = 0; + + // activates game overlay to a specific place + // valid options are + // "steamid" - opens the overlay web browser to the specified user or groups profile + // "chat" - opens a chat window to the specified user, or joins the group chat + // "jointrade" - opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API + // "stats" - opens the overlay web browser to the specified user's stats + // "achievements" - opens the overlay web browser to the specified user's achievements + // "friendadd" - opens the overlay in minimal mode prompting the user to add the target user as a friend + // "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend + // "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite + // "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite + virtual void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID ) = 0; + + // activates game overlay web browser directly to the specified URL + // full address with protocol type is required, e.g. https://store.steampowered.com/ + virtual void ActivateGameOverlayToWebPage( const char *pchURL ) = 0; + + // activates game overlay to store page for app + virtual void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag ) = 0; + + // Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is + // in game + virtual void SetPlayedWith( CSteamID steamIDUserPlayedWith ) = 0; + + // activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby. + virtual void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby ) = 0; + + // gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set + virtual int GetSmallFriendAvatar( CSteamID steamIDFriend ) = 0; + + // gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set + virtual int GetMediumFriendAvatar( CSteamID steamIDFriend ) = 0; + + // gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set + // returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again + virtual int GetLargeFriendAvatar( CSteamID steamIDFriend ) = 0; + + // requests information about a user - persona name & avatar + // if bRequireNameOnly is set, then the avatar of a user isn't downloaded + // - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them + // if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved + // if returns false, it means that we already have all the details about that user, and functions can be called immediately + virtual bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) = 0; + + // requests information about a clan officer list + // when complete, data is returned in ClanOfficerListResponse_t call result + // this makes available the calls below + // you can only ask about clans that a user is a member of + // note that this won't download avatars automatically; if you get an officer, + // and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar + virtual SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) = 0; + + // iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed + + // returns the steamID of the clan owner + virtual CSteamID GetClanOwner( CSteamID steamIDClan ) = 0; + // returns the number of officers in a clan (including the owner) + virtual int GetClanOfficerCount( CSteamID steamIDClan ) = 0; + // returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount) + virtual CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer ) = 0; + // if current user is chat restricted, he can't send or receive any text/voice chat messages. + // the user can't see custom avatars. But the user can be online and send/recv game invites. + // a chat restricted user can't add friends or join any groups. + virtual uint32 GetUserRestrictions() = 0; + + // Rich Presence data is automatically shared between friends who are in the same game + // Each user has a set of Key/Value pairs + // Up to 20 different keys can be set + // There are two magic keys: + // "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list + // "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game + // GetFriendRichPresence() returns an empty string "" if no value is set + // SetRichPresence() to a NULL or an empty string deletes the key + // You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount() + // and GetFriendRichPresenceKeyByIndex() (typically only used for debugging) + virtual bool SetRichPresence( const char *pchKey, const char *pchValue ) = 0; + virtual void ClearRichPresence() = 0; + virtual const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey ) = 0; + virtual int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend ) = 0; + virtual const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey ) = 0; + // Requests rich presence for a specific user. + virtual void RequestFriendRichPresence( CSteamID steamIDFriend ) = 0; + + // rich invite support + // if the target accepts the invite, the pchConnectString gets added to the command-line for launching the game + // if the game is already running, a GameRichPresenceJoinRequested_t callback is posted containing the connect string + // invites can only be sent to friends + virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0; + + // recently-played-with friends iteration + // this iterates the entire list of users recently played with, across games + // GetFriendCoplayTime() returns as a unix time + virtual int GetCoplayFriendCount() = 0; + virtual CSteamID GetCoplayFriend( int iCoplayFriend ) = 0; + virtual int GetFriendCoplayTime( CSteamID steamIDFriend ) = 0; + virtual AppId_t GetFriendCoplayGame( CSteamID steamIDFriend ) = 0; + + // chat interface for games + // this allows in-game access to group (clan) chats from in the game + // the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay + // use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat + virtual SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan ) = 0; + virtual bool LeaveClanChatRoom( CSteamID steamIDClan ) = 0; + virtual int GetClanChatMemberCount( CSteamID steamIDClan ) = 0; + virtual CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) = 0; + virtual bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) = 0; + virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, OUT_STRUCT() CSteamID *psteamidChatter ) = 0; + virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0; + + // interact with the Steam (game overlay / desktop) + virtual bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat ) = 0; + virtual bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0; + virtual bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0; + + // peer-to-peer chat interception + // this is so you can show P2P chats inline in the game + virtual bool SetListenForFriendsMessages( bool bInterceptEnabled ) = 0; + virtual bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend ) = 0; + virtual int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0; + + // following apis + virtual SteamAPICall_t GetFollowerCount( CSteamID steamID ) = 0; + virtual SteamAPICall_t IsFollowing( CSteamID steamID ) = 0; + virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0; +}; + +#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends015" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// Purpose: called when a friends' status changes +//----------------------------------------------------------------------------- +struct PersonaStateChange_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 4 }; + + uint64 m_ulSteamID; // steamID of the friend who changed + int m_nChangeFlags; // what's changed +}; + + +// used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user +// these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend +enum EPersonaChange +{ + k_EPersonaChangeName = 0x0001, + k_EPersonaChangeStatus = 0x0002, + k_EPersonaChangeComeOnline = 0x0004, + k_EPersonaChangeGoneOffline = 0x0008, + k_EPersonaChangeGamePlayed = 0x0010, + k_EPersonaChangeGameServer = 0x0020, + k_EPersonaChangeAvatar = 0x0040, + k_EPersonaChangeJoinedSource= 0x0080, + k_EPersonaChangeLeftSource = 0x0100, + k_EPersonaChangeRelationshipChanged = 0x0200, + k_EPersonaChangeNameFirstSet = 0x0400, + k_EPersonaChangeFacebookInfo = 0x0800, + k_EPersonaChangeNickname = 0x1000, + k_EPersonaChangeSteamLevel = 0x2000, +}; + + +//----------------------------------------------------------------------------- +// Purpose: posted when game overlay activates or deactivates +// the game can use this to be pause or resume single player games +//----------------------------------------------------------------------------- +struct GameOverlayActivated_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 31 }; + uint8 m_bActive; // true if it's just been activated, false otherwise +}; + + +//----------------------------------------------------------------------------- +// Purpose: called when the user tries to join a different game server from their friends list +// game client should attempt to connect to specified server when this is received +//----------------------------------------------------------------------------- +struct GameServerChangeRequested_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 32 }; + char m_rgchServer[64]; // server address ("127.0.0.1:27015", "tf2.valvesoftware.com") + char m_rgchPassword[64]; // server password, if any +}; + + +//----------------------------------------------------------------------------- +// Purpose: called when the user tries to join a lobby from their friends list +// game client should attempt to connect to specified lobby when this is received +//----------------------------------------------------------------------------- +struct GameLobbyJoinRequested_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 33 }; + CSteamID m_steamIDLobby; + + // The friend they did the join via (will be invalid if not directly via a friend) + // + // On PS3, the friend will be invalid if this was triggered by a PSN invite via the XMB, but + // the account type will be console user so you can tell at least that this was from a PSN friend + // rather than a Steam friend. + CSteamID m_steamIDFriend; +}; + + +//----------------------------------------------------------------------------- +// Purpose: called when an avatar is loaded in from a previous GetLargeFriendAvatar() call +// if the image wasn't already available +//----------------------------------------------------------------------------- +struct AvatarImageLoaded_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 34 }; + CSteamID m_steamID; // steamid the avatar has been loaded for + int m_iImage; // the image index of the now loaded image + int m_iWide; // width of the loaded image + int m_iTall; // height of the loaded image +}; + + +//----------------------------------------------------------------------------- +// Purpose: marks the return of a request officer list call +//----------------------------------------------------------------------------- +struct ClanOfficerListResponse_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 35 }; + CSteamID m_steamIDClan; + int m_cOfficers; + uint8 m_bSuccess; +}; + + +//----------------------------------------------------------------------------- +// Purpose: callback indicating updated data about friends rich presence information +//----------------------------------------------------------------------------- +struct FriendRichPresenceUpdate_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 36 }; + CSteamID m_steamIDFriend; // friend who's rich presence has changed + AppId_t m_nAppID; // the appID of the game (should always be the current game) +}; + + +//----------------------------------------------------------------------------- +// Purpose: called when the user tries to join a game from their friends list +// rich presence will have been set with the "connect" key which is set here +//----------------------------------------------------------------------------- +struct GameRichPresenceJoinRequested_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 37 }; + CSteamID m_steamIDFriend; // the friend they did the join via (will be invalid if not directly via a friend) + char m_rgchConnect[k_cchMaxRichPresenceValueLength]; +}; + + +//----------------------------------------------------------------------------- +// Purpose: a chat message has been received for a clan chat the game has joined +//----------------------------------------------------------------------------- +struct GameConnectedClanChatMsg_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 38 }; + CSteamID m_steamIDClanChat; + CSteamID m_steamIDUser; + int m_iMessageID; +}; + + +//----------------------------------------------------------------------------- +// Purpose: a user has joined a clan chat +//----------------------------------------------------------------------------- +struct GameConnectedChatJoin_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 39 }; + CSteamID m_steamIDClanChat; + CSteamID m_steamIDUser; +}; + + +//----------------------------------------------------------------------------- +// Purpose: a user has left the chat we're in +//----------------------------------------------------------------------------- +struct GameConnectedChatLeave_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 40 }; + CSteamID m_steamIDClanChat; + CSteamID m_steamIDUser; + bool m_bKicked; // true if admin kicked + bool m_bDropped; // true if Steam connection dropped +}; + + +//----------------------------------------------------------------------------- +// Purpose: a DownloadClanActivityCounts() call has finished +//----------------------------------------------------------------------------- +struct DownloadClanActivityCountsResult_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 41 }; + bool m_bSuccess; +}; + + +//----------------------------------------------------------------------------- +// Purpose: a JoinClanChatRoom() call has finished +//----------------------------------------------------------------------------- +struct JoinClanChatRoomCompletionResult_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 42 }; + CSteamID m_steamIDClanChat; + EChatRoomEnterResponse m_eChatRoomEnterResponse; +}; + +//----------------------------------------------------------------------------- +// Purpose: a chat message has been received from a user +//----------------------------------------------------------------------------- +struct GameConnectedFriendChatMsg_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 43 }; + CSteamID m_steamIDUser; + int m_iMessageID; +}; + + +struct FriendsGetFollowerCount_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 44 }; + EResult m_eResult; + CSteamID m_steamID; + int m_nCount; +}; + + +struct FriendsIsFollowing_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 45 }; + EResult m_eResult; + CSteamID m_steamID; + bool m_bIsFollowing; +}; + + +struct FriendsEnumerateFollowingList_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 46 }; + EResult m_eResult; + CSteamID m_rgSteamID[ k_cEnumerateFollowersMax ]; + int32 m_nResultsReturned; + int32 m_nTotalResultCount; +}; + +//----------------------------------------------------------------------------- +// Purpose: reports the result of an attempt to change the user's persona name +//----------------------------------------------------------------------------- +struct SetPersonaNameResponse_t +{ + enum { k_iCallback = k_iSteamFriendsCallbacks + 47 }; + + bool m_bSuccess; // true if name change succeeded completely. + bool m_bLocalSuccess; // true if name change was retained locally. (We might not have been able to communicate with Steam) + EResult m_result; // detailed result code +}; + + +#pragma pack( pop ) + +#endif // ISTEAMFRIENDS_H diff --git a/public/steam/isteamgamecoordinator.h b/public/steam/isteamgamecoordinator.h new file mode 100644 index 000000000..5ab0637f0 --- /dev/null +++ b/public/steam/isteamgamecoordinator.h @@ -0,0 +1,75 @@ +//====== Copyright ©, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to the game coordinator for this application +// +//============================================================================= + +#ifndef ISTEAMGAMECOORDINATOR +#define ISTEAMGAMECOORDINATOR +#ifdef _WIN32 +#pragma once +#endif + +#include "steamtypes.h" +#include "steamclientpublic.h" + + +// list of possible return values from the ISteamGameCoordinator API +enum EGCResults +{ + k_EGCResultOK = 0, + k_EGCResultNoMessage = 1, // There is no message in the queue + k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message + k_EGCResultNotLoggedOn = 3, // The client is not logged onto Steam + k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage +}; + + +//----------------------------------------------------------------------------- +// Purpose: Functions for sending and receiving messages from the Game Coordinator +// for this application +//----------------------------------------------------------------------------- +class ISteamGameCoordinator +{ +public: + + // sends a message to the Game Coordinator + virtual EGCResults SendMessage( uint32 unMsgType, const void *pubData, uint32 cubData ) = 0; + + // returns true if there is a message waiting from the game coordinator + virtual bool IsMessageAvailable( uint32 *pcubMsgSize ) = 0; + + // fills the provided buffer with the first message in the queue and returns k_EGCResultOK or + // returns k_EGCResultNoMessage if there is no message waiting. pcubMsgSize is filled with the message size. + // If the provided buffer is not large enough to fit the entire message, k_EGCResultBufferTooSmall is returned + // and the message remains at the head of the queue. + virtual EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0; + +}; +#define STEAMGAMECOORDINATOR_INTERFACE_VERSION "SteamGameCoordinator001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +// callback notification - A new message is available for reading from the message queue +struct GCMessageAvailable_t +{ + enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 1 }; + uint32 m_nMessageSize; +}; + +// callback notification - A message failed to make it to the GC. It may be down temporarily +struct GCMessageFailed_t +{ + enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 2 }; +}; + +#pragma pack( pop ) + +#endif // ISTEAMGAMECOORDINATOR diff --git a/public/steam/isteamgameserver.h b/public/steam/isteamgameserver.h new file mode 100644 index 000000000..cc1099857 --- /dev/null +++ b/public/steam/isteamgameserver.h @@ -0,0 +1,384 @@ +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to steam for game servers +// +//============================================================================= + +#ifndef ISTEAMGAMESERVER_H +#define ISTEAMGAMESERVER_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +#define MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE ((uint16)-1) + +//----------------------------------------------------------------------------- +// Purpose: Functions for authenticating users via Steam to play on a game server +//----------------------------------------------------------------------------- +class ISteamGameServer +{ +public: + +// +// Basic server data. These properties, if set, must be set before before calling LogOn. They +// may not be changed after logged in. +// + + /// This is called by SteamGameServer_Init, and you will usually not need to call it directly + virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; + + /// Game product identifier. This is currently used by the master server for version checking purposes. + /// It's a required field, but will eventually will go away, and the AppID will be used for this purpose. + virtual void SetProduct( const char *pszProduct ) = 0; + + /// Description of the game. This is a required field and is displayed in the steam server browser....for now. + /// This is a required field, but it will go away eventually, as the data should be determined from the AppID. + virtual void SetGameDescription( const char *pszGameDescription ) = 0; + + /// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning + /// this application is the original game, not a mod. + /// + /// @see k_cbMaxGameServerGameDir + virtual void SetModDir( const char *pszModDir ) = 0; + + /// Is this is a dedicated server? The default value is false. + virtual void SetDedicatedServer( bool bDedicated ) = 0; + +// +// Login +// + + /// Begin process to login to a persistent game server account + /// + /// You need to register for callbacks to determine the result of this operation. + /// @see SteamServersConnected_t + /// @see SteamServerConnectFailure_t + /// @see SteamServersDisconnected_t + virtual void LogOn( const char *pszToken ) = 0; + + /// Login to a generic, anonymous account. + /// + /// Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init, + /// but this is no longer the case. + virtual void LogOnAnonymous() = 0; + + /// Begin process of logging game server out of steam + virtual void LogOff() = 0; + + // status functions + virtual bool BLoggedOn() = 0; + virtual bool BSecure() = 0; + virtual CSteamID GetSteamID() = 0; + + /// Returns true if the master server has requested a restart. + /// Only returns true once per request. + virtual bool WasRestartRequested() = 0; + +// +// Server state. These properties may be changed at any time. +// + + /// Max player count that will be reported to server browser and client queries + virtual void SetMaxPlayerCount( int cPlayersMax ) = 0; + + /// Number of bots. Default value is zero + virtual void SetBotPlayerCount( int cBotplayers ) = 0; + + /// Set the name of server as it will appear in the server browser + /// + /// @see k_cbMaxGameServerName + virtual void SetServerName( const char *pszServerName ) = 0; + + /// Set name of map to report in the server browser + /// + /// @see k_cbMaxGameServerName + virtual void SetMapName( const char *pszMapName ) = 0; + + /// Let people know if your server will require a password + virtual void SetPasswordProtected( bool bPasswordProtected ) = 0; + + /// Spectator server. The default value is zero, meaning the service + /// is not used. + virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0; + + /// Name of the spectator server. (Only used if spectator port is nonzero.) + /// + /// @see k_cbMaxGameServerMapName + virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0; + + /// Call this to clear the whole list of key/values that are sent in rules queries. + virtual void ClearAllKeyValues() = 0; + + /// Call this to add/update a key/value pair. + virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0; + + /// Sets a string defining the "gametags" for this server, this is optional, but if it is set + /// it allows users to filter in the matchmaking/server-browser interfaces based on the value + /// + /// @see k_cbMaxGameServerTags + virtual void SetGameTags( const char *pchGameTags ) = 0; + + /// Sets a string defining the "gamedata" for this server, this is optional, but if it is set + /// it allows users to filter in the matchmaking/server-browser interfaces based on the value + /// don't set this unless it actually changes, its only uploaded to the master once (when + /// acknowledged) + /// + /// @see k_cbMaxGameServerGameData + virtual void SetGameData( const char *pchGameData ) = 0; + + /// Region identifier. This is an optional field, the default value is empty, meaning the "world" region + virtual void SetRegion( const char *pszRegion ) = 0; + +// +// Player list management / authentication +// + + // Handles receiving a new connection from a Steam user. This call will ask the Steam + // servers to validate the users identity, app ownership, and VAC status. If the Steam servers + // are off-line, then it will validate the cached ticket itself which will validate app ownership + // and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection() + // and must then be sent up to the game server for authentication. + // + // Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL + // If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication + // for the user has succeeded or failed (the steamid in the callback will match the one returned by this call) + virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0; + + // Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation. + // + // Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect() + // when this user leaves the server just like you would for a real user. + virtual CSteamID CreateUnauthenticatedUserConnection() = 0; + + // Should be called whenever a user leaves our game server, this lets Steam internally + // track which users are currently on which servers for the purposes of preventing a single + // account being logged into multiple servers, showing who is currently on a server, etc. + virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0; + + // Update the data to be displayed in the server browser and matchmaking interfaces for a user + // currently connected to the server. For regular users you must call this after you receive a + // GSUserValidationSuccess callback. + // + // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player) + virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0; + + // New auth system APIs - do not mix with the old auth system APIs. + // ---------------------------------------------------------------- + + // Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ). + // pcbTicket retrieves the length of the actual ticket. + virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; + + // Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused + // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse ) + virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0; + + // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity + virtual void EndAuthSession( CSteamID steamID ) = 0; + + // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to + virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0; + + // After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function + // to determine if the user owns downloadable content specified by the provided AppID. + virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0; + + // Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t + // returns false if we're not connected to the steam servers and thus cannot ask + virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0; + + + // these two functions s are deprecated, and will not return results + // they will be removed in a future version of the SDK + virtual void GetGameplayStats( ) = 0; + virtual SteamAPICall_t GetServerReputation( ) = 0; + + // Returns the public IP of the server according to Steam, useful when the server is + // behind NAT and you want to advertise its IP in a lobby for other clients to directly + // connect to + virtual uint32 GetPublicIP() = 0; + +// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own +// socket to talk to the master server on, it lets the game use its socket to forward messages +// back and forth. This prevents us from requiring server ops to open up yet another port +// in their firewalls. +// +// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001 + + // These are used when you've elected to multiplex the game server's UDP socket + // rather than having the master server updater use its own sockets. + // + // Source games use this to simplify the job of the server admins, so they + // don't have to open up more ports on their firewalls. + + // Call this when a packet that starts with 0xFFFFFFFF comes in. That means + // it's for us. + virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0; + + // AFTER calling HandleIncomingPacket for any packets that came in that frame, call this. + // This gets a packet that the master server updater needs to send out on UDP. + // It returns the length of the packet it wants to send, or 0 if there are no more packets to send. + // Call this each frame until it returns 0. + virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0; + +// +// Control heartbeats / advertisement with master server +// + + // Call this as often as you like to tell the master server updater whether or not + // you want it to be active (default: off). + virtual void EnableHeartbeats( bool bActive ) = 0; + + // You usually don't need to modify this. + // Pass -1 to use the default value for iHeartbeatInterval. + // Some mods change this. + virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0; + + // Force a heartbeat to steam at the next opportunity + virtual void ForceHeartbeat() = 0; + + // associate this game server with this clan for the purposes of computing player compat + virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0; + + // ask if any of the current players dont want to play with this new player - or vice versa + virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0; + +}; + +#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012" + +// game server flags +const uint32 k_unServerFlagNone = 0x00; +const uint32 k_unServerFlagActive = 0x01; // server has users playing +const uint32 k_unServerFlagSecure = 0x02; // server wants to be secure +const uint32 k_unServerFlagDedicated = 0x04; // server is dedicated +const uint32 k_unServerFlagLinux = 0x08; // linux build +const uint32 k_unServerFlagPassworded = 0x10; // password protected +const uint32 k_unServerFlagPrivate = 0x20; // server shouldn't list on master server and + // won't enforce authentication of users that connect to the server. + // Useful when you run a server where the clients may not + // be connected to the internet but you want them to play (i.e LANs) + + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +// client has been approved to connect to this game server +struct GSClientApprove_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 1 }; + CSteamID m_SteamID; // SteamID of approved player + CSteamID m_OwnerSteamID; // SteamID of original owner for game license +}; + + +// client has been denied to connection to this game server +struct GSClientDeny_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 2 }; + CSteamID m_SteamID; + EDenyReason m_eDenyReason; + char m_rgchOptionalText[128]; +}; + + +// request the game server should kick the user +struct GSClientKick_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 3 }; + CSteamID m_SteamID; + EDenyReason m_eDenyReason; +}; + +// NOTE: callback values 4 and 5 are skipped because they are used for old deprecated callbacks, +// do not reuse them here. + + +// client achievement info +struct GSClientAchievementStatus_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 6 }; + uint64 m_SteamID; + char m_pchAchievement[128]; + bool m_bUnlocked; +}; + +// received when the game server requests to be displayed as secure (VAC protected) +// m_bSecure is true if the game server should display itself as secure to users, false otherwise +struct GSPolicyResponse_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 15 }; + uint8 m_bSecure; +}; + +// GS gameplay stats info +struct GSGameplayStats_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 7 }; + EResult m_eResult; // Result of the call + int32 m_nRank; // Overall rank of the server (0-based) + uint32 m_unTotalConnects; // Total number of clients who have ever connected to the server + uint32 m_unTotalMinutesPlayed; // Total number of minutes ever played on the server +}; + +// send as a reply to RequestUserGroupStatus() +struct GSClientGroupStatus_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 8 }; + CSteamID m_SteamIDUser; + CSteamID m_SteamIDGroup; + bool m_bMember; + bool m_bOfficer; +}; + +// Sent as a reply to GetServerReputation() +struct GSReputation_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 9 }; + EResult m_eResult; // Result of the call; + uint32 m_unReputationScore; // The reputation score for the game server + bool m_bBanned; // True if the server is banned from the Steam + // master servers + + // The following members are only filled out if m_bBanned is true. They will all + // be set to zero otherwise. Master server bans are by IP so it is possible to be + // banned even when the score is good high if there is a bad server on another port. + // This information can be used to determine which server is bad. + + uint32 m_unBannedIP; // The IP of the banned server + uint16 m_usBannedPort; // The port of the banned server + uint64 m_ulBannedGameID; // The game ID the banned server is serving + uint32 m_unBanExpires; // Time the ban expires, expressed in the Unix epoch (seconds since 1/1/1970) +}; + +// Sent as a reply to AssociateWithClan() +struct AssociateWithClanResult_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 10 }; + EResult m_eResult; // Result of the call; +}; + +// Sent as a reply to ComputeNewPlayerCompatibility() +struct ComputeNewPlayerCompatibilityResult_t +{ + enum { k_iCallback = k_iSteamGameServerCallbacks + 11 }; + EResult m_eResult; // Result of the call; + int m_cPlayersThatDontLikeCandidate; + int m_cPlayersThatCandidateDoesntLike; + int m_cClanPlayersThatDontLikeCandidate; + CSteamID m_SteamIDCandidate; +}; + + +#pragma pack( pop ) + +#endif // ISTEAMGAMESERVER_H diff --git a/public/steam/isteamgameserverstats.h b/public/steam/isteamgameserverstats.h new file mode 100644 index 000000000..8d53186ec --- /dev/null +++ b/public/steam/isteamgameserverstats.h @@ -0,0 +1,99 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: interface for game servers to steam stats and achievements +// +//============================================================================= + +#ifndef ISTEAMGAMESERVERSTATS_H +#define ISTEAMGAMESERVERSTATS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +//----------------------------------------------------------------------------- +// Purpose: Functions for authenticating users via Steam to play on a game server +//----------------------------------------------------------------------------- +class ISteamGameServerStats +{ +public: + // downloads stats for the user + // returns a GSStatsReceived_t callback when completed + // if the user has no stats, GSStatsReceived_t.m_eResult will be set to k_EResultFail + // these stats will only be auto-updated for clients playing on the server. For other + // users you'll need to call RequestUserStats() again to refresh any data + virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0; + + // requests stat information for a user, usable after a successful call to RequestUserStats() + virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0; + virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0; + virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0; + + // Set / update stats and achievements. + // Note: These updates will work only on stats game servers are allowed to edit and only for + // game servers that have been declared as officially controlled by the game creators. + // Set the IP range of your official servers on the Steamworks page + virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, int32 nData ) = 0; + virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, float fData ) = 0; + virtual bool UpdateUserAvgRateStat( CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength ) = 0; + + virtual bool SetUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0; + virtual bool ClearUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0; + + // Store the current data on the server, will get a GSStatsStored_t callback when set. + // + // If the callback has a result of k_EResultInvalidParam, one or more stats + // uploaded has been rejected, either because they broke constraints + // or were out of date. In this case the server sends back updated values. + // The stats should be re-iterated to keep in sync. + virtual SteamAPICall_t StoreUserStats( CSteamID steamIDUser ) = 0; +}; + +#define STEAMGAMESERVERSTATS_INTERFACE_VERSION "SteamGameServerStats001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// Purpose: called when the latests stats and achievements have been received +// from the server +//----------------------------------------------------------------------------- +struct GSStatsReceived_t +{ + enum { k_iCallback = k_iSteamGameServerStatsCallbacks }; + EResult m_eResult; // Success / error fetching the stats + CSteamID m_steamIDUser; // The user for whom the stats are retrieved for +}; + + +//----------------------------------------------------------------------------- +// Purpose: result of a request to store the user stats for a game +//----------------------------------------------------------------------------- +struct GSStatsStored_t +{ + enum { k_iCallback = k_iSteamGameServerStatsCallbacks + 1 }; + EResult m_eResult; // success / error + CSteamID m_steamIDUser; // The user for whom the stats were stored +}; + +//----------------------------------------------------------------------------- +// Purpose: Callback indicating that a user's stats have been unloaded. +// Call RequestUserStats again to access stats for this user +//----------------------------------------------------------------------------- +struct GSStatsUnloaded_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 }; + CSteamID m_steamIDUser; // User whose stats have been unloaded +}; + +#pragma pack( pop ) + + +#endif // ISTEAMGAMESERVERSTATS_H diff --git a/public/steam/isteamgamestats.h b/public/steam/isteamgamestats.h new file mode 100644 index 000000000..a32ae4abd --- /dev/null +++ b/public/steam/isteamgamestats.h @@ -0,0 +1,75 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: interface to steam for game play statistics +// +//============================================================================= + +#ifndef ISTEAMGAMESTATS_H +#define ISTEAMGAMESTATS_H +#ifdef _WIN32 +#pragma once +#endif + +//----------------------------------------------------------------------------- +// Purpose: Functions for recording game play sessions and details thereof +//----------------------------------------------------------------------------- +class ISteamGameStats +{ +public: + virtual SteamAPICall_t GetNewSession( int8 nAccountType, uint64 ulAccountID, int32 nAppID, RTime32 rtTimeStarted ) = 0; + virtual SteamAPICall_t EndSession( uint64 ulSessionID, RTime32 rtTimeEnded, int nReasonCode ) = 0; + virtual EResult AddSessionAttributeInt( uint64 ulSessionID, const char* pstrName, int32 nData ) = 0; + virtual EResult AddSessionAttributeString( uint64 ulSessionID, const char* pstrName, const char *pstrData ) = 0; + virtual EResult AddSessionAttributeFloat( uint64 ulSessionID, const char* pstrName, float fData ) = 0; + + virtual EResult AddNewRow( uint64 *pulRowID, uint64 ulSessionID, const char *pstrTableName ) = 0; + virtual EResult CommitRow( uint64 ulRowID ) = 0; + virtual EResult CommitOutstandingRows( uint64 ulSessionID ) = 0; + virtual EResult AddRowAttributeInt( uint64 ulRowID, const char *pstrName, int32 nData ) = 0; + virtual EResult AddRowAtributeString( uint64 ulRowID, const char *pstrName, const char *pstrData ) = 0; + virtual EResult AddRowAttributeFloat( uint64 ulRowID, const char *pstrName, float fData ) = 0; + + virtual EResult AddSessionAttributeInt64( uint64 ulSessionID, const char *pstrName, int64 llData ) = 0; + virtual EResult AddRowAttributeInt64( uint64 ulRowID, const char *pstrName, int64 llData ) = 0; +}; + +#define STEAMGAMESTATS_INTERFACE_VERSION "SteamGameStats001" + + +//----------------------------------------------------------------------------- +// Purpose: nAccountType for GetNewSession +//----------------------------------------------------------------------------- +enum EGameStatsAccountType +{ + k_EGameStatsAccountType_Steam = 1, // ullAccountID is a 64-bit SteamID for a player + k_EGameStatsAccountType_Xbox = 2, // ullAccountID is a 64-bit XUID + k_EGameStatsAccountType_SteamGameServer = 3, // ullAccountID is a 64-bit SteamID for a game server +}; + + +//----------------------------------------------------------------------------- +// Purpose: callback for GetNewSession() method +//----------------------------------------------------------------------------- +struct GameStatsSessionIssued_t +{ + enum { k_iCallback = k_iSteamGameStatsCallbacks + 1 }; + + uint64 m_ulSessionID; + EResult m_eResult; + bool m_bCollectingAny; + bool m_bCollectingDetails; +}; + + +//----------------------------------------------------------------------------- +// Purpose: callback for EndSession() method +//----------------------------------------------------------------------------- +struct GameStatsSessionClosed_t +{ + enum { k_iCallback = k_iSteamGameStatsCallbacks + 2 }; + + uint64 m_ulSessionID; + EResult m_eResult; +}; + +#endif // ISTEAMGAMESTATS_H diff --git a/public/steam/isteamhtmlsurface.h b/public/steam/isteamhtmlsurface.h new file mode 100644 index 000000000..c257164ae --- /dev/null +++ b/public/steam/isteamhtmlsurface.h @@ -0,0 +1,444 @@ +//====== Copyright 1996-2013, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to display html pages in a texture +// +//============================================================================= + +#ifndef ISTEAMHTMLSURFACE_H +#define ISTEAMHTMLSURFACE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +typedef uint32 HHTMLBrowser; +const uint32 INVALID_HTMLBROWSER = 0; + +//----------------------------------------------------------------------------- +// Purpose: Functions for displaying HTML pages and interacting with them +//----------------------------------------------------------------------------- +class ISteamHTMLSurface +{ +public: + virtual ~ISteamHTMLSurface() {} + + // Must call init and shutdown when starting/ending use of the interface + virtual bool Init() = 0; + virtual bool Shutdown() = 0; + + // Create a browser object for display of a html page, when creation is complete the call handle + // will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser. + // The user agent string is a substring to be added to the general user agent string so you can + // identify your client on web servers. + // The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if + // you do not require this functionality. + virtual SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS ) = 0; + + // Call this when you are done with a html surface, this lets us free the resources being used by it + virtual void RemoveBrowser( HHTMLBrowser unBrowserHandle ) = 0; + + // Navigate to this URL, results in a HTML_StartRequest_t as the request commences + virtual void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchPostData ) = 0; + + // Tells the surface the size in pixels to display the surface + virtual void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight ) = 0; + + // Stop the load of the current html page + virtual void StopLoad( HHTMLBrowser unBrowserHandle ) = 0; + // Reload (most likely from local cache) the current page + virtual void Reload( HHTMLBrowser unBrowserHandle ) = 0; + // navigate back in the page history + virtual void GoBack( HHTMLBrowser unBrowserHandle ) = 0; + // navigate forward in the page history + virtual void GoForward( HHTMLBrowser unBrowserHandle ) = 0; + + // add this header to any url requests from this browser + virtual void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue ) = 0; + // run this javascript script in the currently loaded page + virtual void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript ) = 0; + + enum EHTMLMouseButton + { + eHTMLMouseButton_Left = 0, + eHTMLMouseButton_Right = 1, + eHTMLMouseButton_Middle = 2, + }; + + // Mouse click and mouse movement commands + virtual void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0; + virtual void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0; + virtual void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0; + // x and y are relative to the HTML bounds + virtual void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y ) = 0; + // nDelta is pixels of scroll + virtual void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta ) = 0; + + enum EMouseCursor + { + dc_user = 0, + dc_none, + dc_arrow, + dc_ibeam, + dc_hourglass, + dc_waitarrow, + dc_crosshair, + dc_up, + dc_sizenw, + dc_sizese, + dc_sizene, + dc_sizesw, + dc_sizew, + dc_sizee, + dc_sizen, + dc_sizes, + dc_sizewe, + dc_sizens, + dc_sizeall, + dc_no, + dc_hand, + dc_blank, // don't show any custom cursor, just use your default + dc_middle_pan, + dc_north_pan, + dc_north_east_pan, + dc_east_pan, + dc_south_east_pan, + dc_south_pan, + dc_south_west_pan, + dc_west_pan, + dc_north_west_pan, + dc_alias, + dc_cell, + dc_colresize, + dc_copycur, + dc_verticaltext, + dc_rowresize, + dc_zoomin, + dc_zoomout, + dc_help, + dc_custom, + + dc_last, // custom cursors start from this value and up + }; + + enum EHTMLKeyModifiers + { + k_eHTMLKeyModifier_None = 0, + k_eHTMLKeyModifier_AltDown = 1 << 0, + k_eHTMLKeyModifier_CtrlDown = 1 << 1, + k_eHTMLKeyModifier_ShiftDown = 1 << 2, + }; + + // keyboard interactions, native keycode is the virtual key code value from your OS + virtual void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0; + virtual void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0; + // cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press) + virtual void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0; + + // programmatically scroll this many pixels on the page + virtual void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0; + virtual void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0; + + // tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things + virtual void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) = 0; + + // open the current pages html code in the local editor of choice, used for debugging + virtual void ViewSource( HHTMLBrowser unBrowserHandle ) = 0; + // copy the currently selected text on the html page to the local clipboard + virtual void CopyToClipboard( HHTMLBrowser unBrowserHandle ) = 0; + // paste from the local clipboard to the current html page + virtual void PasteFromClipboard( HHTMLBrowser unBrowserHandle ) = 0; + + // find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element + virtual void Find( HHTMLBrowser unBrowserHandle, const char *pchSearchStr, bool bCurrentlyInFind, bool bReverse ) = 0; + // cancel a currently running find + virtual void StopFind( HHTMLBrowser unBrowserHandle ) = 0; + + // return details about the link at position x,y on the current page + virtual void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y ) = 0; + + // set a webcookie for the hostname in question + virtual void SetCookie( const char *pchHostname, const char *pchKey, const char *pchValue, const char *pchPath = "/", RTime32 nExpires = 0, bool bSecure = false, bool bHTTPOnly = false ) = 0; + + // Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care) + virtual void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) = 0; + + // Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are + // more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled, + // all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1". + // When background mode is disabled, any video or audio objects with that property will resume with ".play()". + virtual void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) = 0; + + // CALLBACKS + // + // These set of functions are used as responses to callback requests + // + + // You MUST call this in response to a HTML_StartRequest_t callback + // Set bAllowed to true to allow this navigation, false to cancel it and stay + // on the current page. You can use this feature to limit the valid pages + // allowed in your HTML surface. + virtual void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed ) = 0; + + // You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback + // Set bResult to true for the OK option of a confirm, use false otherwise + virtual void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) = 0; + + // You MUST call this in response to a HTML_FileOpenDialog_t callback + virtual void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) = 0; +}; + +#define STEAMHTMLSURFACE_INTERFACE_VERSION "STEAMHTMLSURFACE_INTERFACE_VERSION_003" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +//----------------------------------------------------------------------------- +// Purpose: The browser is ready for use +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_BrowserReady_t, k_iSteamHTMLSurfaceCallbacks + 1 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this browser is now fully created and ready to navigate to pages +END_DEFINE_CALLBACK_1() + + +//----------------------------------------------------------------------------- +// Purpose: the browser has a pending paint +//----------------------------------------------------------------------------- +DEFINE_CALLBACK(HTML_NeedsPaint_t, k_iSteamHTMLSurfaceCallbacks + 2) +CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the browser that needs the paint +CALLBACK_MEMBER(1, const char *, pBGRA ) // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called +CALLBACK_MEMBER(2, uint32, unWide) // the total width of the pBGRA texture +CALLBACK_MEMBER(3, uint32, unTall) // the total height of the pBGRA texture +CALLBACK_MEMBER(4, uint32, unUpdateX) // the offset in X for the damage rect for this update +CALLBACK_MEMBER(5, uint32, unUpdateY) // the offset in Y for the damage rect for this update +CALLBACK_MEMBER(6, uint32, unUpdateWide) // the width of the damage rect for this update +CALLBACK_MEMBER(7, uint32, unUpdateTall) // the height of the damage rect for this update +CALLBACK_MEMBER(8, uint32, unScrollX) // the page scroll the browser was at when this texture was rendered +CALLBACK_MEMBER(9, uint32, unScrollY) // the page scroll the browser was at when this texture was rendered +CALLBACK_MEMBER(10, float, flPageScale) // the page scale factor on this page when rendered +CALLBACK_MEMBER(11, uint32, unPageSerial) // incremented on each new page load, you can use this to reject draws while navigating to new pages +END_DEFINE_CALLBACK_12() + + +//----------------------------------------------------------------------------- +// Purpose: The browser wanted to navigate to a new page +// NOTE - you MUST call AllowStartRequest in response to this callback +//----------------------------------------------------------------------------- +DEFINE_CALLBACK(HTML_StartRequest_t, k_iSteamHTMLSurfaceCallbacks + 3) +CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface navigating +CALLBACK_MEMBER(1, const char *, pchURL) // the url they wish to navigate to +CALLBACK_MEMBER(2, const char *, pchTarget) // the html link target type (i.e _blank, _self, _parent, _top ) +CALLBACK_MEMBER(3, const char *, pchPostData ) // any posted data for the request +CALLBACK_MEMBER(4, bool, bIsRedirect) // true if this was a http/html redirect from the last load request +END_DEFINE_CALLBACK_5() + + +//----------------------------------------------------------------------------- +// Purpose: The browser has been requested to close due to user interaction (usually from a javascript window.close() call) +//----------------------------------------------------------------------------- +DEFINE_CALLBACK(HTML_CloseBrowser_t, k_iSteamHTMLSurfaceCallbacks + 4) +CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface +END_DEFINE_CALLBACK_1() + + +//----------------------------------------------------------------------------- +// Purpose: the browser is navigating to a new url +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_URLChanged_t, k_iSteamHTMLSurfaceCallbacks + 5 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface navigating +CALLBACK_MEMBER( 1, const char *, pchURL ) // the url they wish to navigate to +CALLBACK_MEMBER( 2, const char *, pchPostData ) // any posted data for the request +CALLBACK_MEMBER( 3, bool, bIsRedirect ) // true if this was a http/html redirect from the last load request +CALLBACK_MEMBER( 4, const char *, pchPageTitle ) // the title of the page +CALLBACK_MEMBER( 5, bool, bNewNavigation ) // true if this was from a fresh tab and not a click on an existing page +END_DEFINE_CALLBACK_6() + + +//----------------------------------------------------------------------------- +// Purpose: A page is finished loading +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_FinishedRequest_t, k_iSteamHTMLSurfaceCallbacks + 6 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchURL ) // +CALLBACK_MEMBER( 2, const char *, pchPageTitle ) // +END_DEFINE_CALLBACK_3() + + +//----------------------------------------------------------------------------- +// Purpose: a request to load this url in a new tab +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_OpenLinkInNewTab_t, k_iSteamHTMLSurfaceCallbacks + 7 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchURL ) // +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: the page has a new title now +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_ChangedTitle_t, k_iSteamHTMLSurfaceCallbacks + 8 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchTitle ) // +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: results from a search +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_SearchResults_t, k_iSteamHTMLSurfaceCallbacks + 9 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, uint32, unResults ) // +CALLBACK_MEMBER( 2, uint32, unCurrentMatch ) // +END_DEFINE_CALLBACK_3() + + +//----------------------------------------------------------------------------- +// Purpose: page history status changed on the ability to go backwards and forward +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_CanGoBackAndForward_t, k_iSteamHTMLSurfaceCallbacks + 10 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, bool, bCanGoBack ) // +CALLBACK_MEMBER( 2, bool, bCanGoForward ) // +END_DEFINE_CALLBACK_3() + + +//----------------------------------------------------------------------------- +// Purpose: details on the visibility and size of the horizontal scrollbar +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_HorizontalScroll_t, k_iSteamHTMLSurfaceCallbacks + 11 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, uint32, unScrollMax ) // +CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) // +CALLBACK_MEMBER( 3, float, flPageScale ) // +CALLBACK_MEMBER( 4, bool , bVisible ) // +CALLBACK_MEMBER( 5, uint32, unPageSize ) // +END_DEFINE_CALLBACK_6() + + +//----------------------------------------------------------------------------- +// Purpose: details on the visibility and size of the vertical scrollbar +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_VerticalScroll_t, k_iSteamHTMLSurfaceCallbacks + 12 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, uint32, unScrollMax ) // +CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) // +CALLBACK_MEMBER( 3, float, flPageScale ) // +CALLBACK_MEMBER( 4, bool, bVisible ) // +CALLBACK_MEMBER( 5, uint32, unPageSize ) // +END_DEFINE_CALLBACK_6() + + +//----------------------------------------------------------------------------- +// Purpose: response to GetLinkAtPosition call +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_LinkAtPosition_t, k_iSteamHTMLSurfaceCallbacks + 13 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, uint32, x ) // NOTE - Not currently set +CALLBACK_MEMBER( 2, uint32, y ) // NOTE - Not currently set +CALLBACK_MEMBER( 3, const char *, pchURL ) // +CALLBACK_MEMBER( 4, bool, bInput ) // +CALLBACK_MEMBER( 5, bool, bLiveLink ) // +END_DEFINE_CALLBACK_6() + + + +//----------------------------------------------------------------------------- +// Purpose: show a Javascript alert dialog, call JSDialogResponse +// when the user dismisses this dialog (or right away to ignore it) +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_JSAlert_t, k_iSteamHTMLSurfaceCallbacks + 14 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchMessage ) // +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: show a Javascript confirmation dialog, call JSDialogResponse +// when the user dismisses this dialog (or right away to ignore it) +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_JSConfirm_t, k_iSteamHTMLSurfaceCallbacks + 15 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchMessage ) // +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: when received show a file open dialog +// then call FileLoadDialogResponse with the file(s) the user selected. +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_FileOpenDialog_t, k_iSteamHTMLSurfaceCallbacks + 16 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchTitle ) // +CALLBACK_MEMBER( 2, const char *, pchInitialFile ) // +END_DEFINE_CALLBACK_3() + + +//----------------------------------------------------------------------------- +// Purpose: a new html window has been created +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_NewWindow_t, k_iSteamHTMLSurfaceCallbacks + 21 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the current surface +CALLBACK_MEMBER( 1, const char *, pchURL ) // the page to load +CALLBACK_MEMBER( 2, uint32, unX ) // the x pos into the page to display the popup +CALLBACK_MEMBER( 3, uint32, unY ) // the y pos into the page to display the popup +CALLBACK_MEMBER( 4, uint32, unWide ) // the total width of the pBGRA texture +CALLBACK_MEMBER( 5, uint32, unTall ) // the total height of the pBGRA texture +CALLBACK_MEMBER( 6, HHTMLBrowser, unNewWindow_BrowserHandle ) // the handle of the new window surface +END_DEFINE_CALLBACK_7() + + +//----------------------------------------------------------------------------- +// Purpose: change the cursor to display +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_SetCursor_t, k_iSteamHTMLSurfaceCallbacks + 22 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, uint32, eMouseCursor ) // the EMouseCursor to display +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: informational message from the browser +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_StatusText_t, k_iSteamHTMLSurfaceCallbacks + 23 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: show a tooltip +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_ShowToolTip_t, k_iSteamHTMLSurfaceCallbacks + 24 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: update the text of an existing tooltip +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_UpdateToolTip_t, k_iSteamHTMLSurfaceCallbacks + 25 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display +END_DEFINE_CALLBACK_2() + + +//----------------------------------------------------------------------------- +// Purpose: hide the tooltip you are showing +//----------------------------------------------------------------------------- +DEFINE_CALLBACK( HTML_HideToolTip_t, k_iSteamHTMLSurfaceCallbacks + 26 ) +CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface +END_DEFINE_CALLBACK_1() + + +#pragma pack( pop ) + + +#endif // ISTEAMHTMLSURFACE_H diff --git a/public/steam/isteamhttp.h b/public/steam/isteamhttp.h new file mode 100644 index 000000000..8fab537de --- /dev/null +++ b/public/steam/isteamhttp.h @@ -0,0 +1,210 @@ +//====== Copyright © 1996-2009, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to http client +// +//============================================================================= + +#ifndef ISTEAMHTTP_H +#define ISTEAMHTTP_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" +#include "steamhttpenums.h" + +// Handle to a HTTP Request handle +typedef uint32 HTTPRequestHandle; +#define INVALID_HTTPREQUEST_HANDLE 0 + +typedef uint32 HTTPCookieContainerHandle; +#define INVALID_HTTPCOOKIE_HANDLE 0 + +//----------------------------------------------------------------------------- +// Purpose: interface to http client +//----------------------------------------------------------------------------- +class ISteamHTTP +{ +public: + + // Initializes a new HTTP request, returning a handle to use in further operations on it. Requires + // the method (GET or POST) and the absolute URL for the request. Both http and https are supported, + // so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/ + // or such. + virtual HTTPRequestHandle CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL ) = 0; + + // Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after + // sending the request. This is just so the caller can easily keep track of which callbacks go with which request data. + virtual bool SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue ) = 0; + + // Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default + // timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request + // has already been sent. + virtual bool SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds ) = 0; + + // Set a request header value for the request, must be called prior to sending the request. Will + // return false if the handle is invalid or the request is already sent. + virtual bool SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, const char *pchHeaderValue ) = 0; + + // Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified + // when creating the request. Must be called prior to sending the request. Will return false if the + // handle is invalid or the request is already sent. + virtual bool SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, const char *pchParamName, const char *pchParamValue ) = 0; + + // Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on + // asynchronous response via callback. + // + // Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control + // header and only do a local cache lookup rather than sending any actual remote request. + virtual bool SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0; + + // Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on + // asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and + // HTTPRequestDataReceived_t callbacks while streaming. + virtual bool SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0; + + // Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move + // the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent. + virtual bool DeferHTTPRequest( HTTPRequestHandle hRequest ) = 0; + + // Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move + // the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent. + virtual bool PrioritizeHTTPRequest( HTTPRequestHandle hRequest ) = 0; + + // Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also + // returns the size of the header value if present so the caller and allocate a correctly sized buffer for + // GetHTTPResponseHeaderValue. + virtual bool GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const char *pchHeaderName, uint32 *unResponseHeaderSize ) = 0; + + // Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the + // header is not present or if your buffer is too small to contain it's value. You should first call + // BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed. + virtual bool GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, uint8 *pHeaderValueBuffer, uint32 unBufferSize ) = 0; + + // Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the + // handle is invalid. + virtual bool GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize ) = 0; + + // Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the + // handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out + // the correct buffer size to use. + virtual bool GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0; + + // Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the + // handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset + // do not match the size and offset sent in HTTPRequestDataReceived_t. + virtual bool GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0; + + // Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t + // callback and finishing using the response. + virtual bool ReleaseHTTPRequest( HTTPRequestHandle hRequest ) = 0; + + // Gets progress on downloading the body for the request. This will be zero unless a response header has already been + // received which included a content-length field. For responses that contain no content-length it will report + // zero for the duration of the request as the size is unknown until the connection closes. + virtual bool GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut ) = 0; + + // Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params + // have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType + // parameter will set the content-type header for the request so the server may know how to interpret the body. + virtual bool SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen ) = 0; + + // Creates a cookie container handle which you must later free with ReleaseCookieContainer(). If bAllowResponsesToModify=true + // than any response to your requests using this cookie container may add new cookies which may be transmitted with + // future requests. If bAllowResponsesToModify=false than only cookies you explicitly set will be sent. This API is just for + // during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across + // repeat executions of your process. + virtual HTTPCookieContainerHandle CreateCookieContainer( bool bAllowResponsesToModify ) = 0; + + // Release a cookie container you are finished using, freeing it's memory + virtual bool ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer ) = 0; + + // Adds a cookie to the specified cookie container that will be used with future requests. + virtual bool SetCookie( HTTPCookieContainerHandle hCookieContainer, const char *pchHost, const char *pchUrl, const char *pchCookie ) = 0; + + // Set the cookie container to use for a HTTP request + virtual bool SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer ) = 0; + + // Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end + virtual bool SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const char *pchUserAgentInfo ) = 0; + + // Set that https request should require verified SSL certificate via machines certificate trust store + virtual bool SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate ) = 0; + + // Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout + // which can bump everytime we get more data + virtual bool SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, uint32 unMilliseconds ) = 0; + + // Check if the reason the request failed was because we timed it out (rather than some harder failure) + virtual bool GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut ) = 0; +}; + +#define STEAMHTTP_INTERFACE_VERSION "STEAMHTTP_INTERFACE_VERSION002" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +struct HTTPRequestCompleted_t +{ + enum { k_iCallback = k_iClientHTTPCallbacks + 1 }; + + // Handle value for the request that has completed. + HTTPRequestHandle m_hRequest; + + // Context value that the user defined on the request that this callback is associated with, 0 if + // no context value was set. + uint64 m_ulContextValue; + + // This will be true if we actually got any sort of response from the server (even an error). + // It will be false if we failed due to an internal error or client side network failure. + bool m_bRequestSuccessful; + + // Will be the HTTP status code value returned by the server, k_EHTTPStatusCode200OK is the normal + // OK response, if you get something else you probably need to treat it as a failure. + EHTTPStatusCode m_eStatusCode; + + uint32 m_unBodySize; // Same as GetHTTPResponseBodySize() +}; + + +struct HTTPRequestHeadersReceived_t +{ + enum { k_iCallback = k_iClientHTTPCallbacks + 2 }; + + // Handle value for the request that has received headers. + HTTPRequestHandle m_hRequest; + + // Context value that the user defined on the request that this callback is associated with, 0 if + // no context value was set. + uint64 m_ulContextValue; +}; + +struct HTTPRequestDataReceived_t +{ + enum { k_iCallback = k_iClientHTTPCallbacks + 3 }; + + // Handle value for the request that has received data. + HTTPRequestHandle m_hRequest; + + // Context value that the user defined on the request that this callback is associated with, 0 if + // no context value was set. + uint64 m_ulContextValue; + + + // Offset to provide to GetHTTPStreamingResponseBodyData to get this chunk of data + uint32 m_cOffset; + + // Size to provide to GetHTTPStreamingResponseBodyData to get this chunk of data + uint32 m_cBytesReceived; +}; + + +#pragma pack( pop ) + +#endif // ISTEAMHTTP_H \ No newline at end of file diff --git a/public/steam/isteaminventory.h b/public/steam/isteaminventory.h new file mode 100644 index 000000000..3802dafeb --- /dev/null +++ b/public/steam/isteaminventory.h @@ -0,0 +1,354 @@ +//====== Copyright © 1996-2014 Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to Steam Inventory +// +//============================================================================= + +#ifndef ISTEAMINVENTORY_H +#define ISTEAMINVENTORY_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +// Every individual instance of an item has a globally-unique ItemInstanceID. +// This ID is unique to the combination of (player, specific item instance) +// and will not be transferred to another player or re-used for another item. +typedef uint64 SteamItemInstanceID_t; + +static const SteamItemInstanceID_t k_SteamItemInstanceIDInvalid = ~(SteamItemInstanceID_t)0; + +// Types of items in your game are identified by a 32-bit "item definition number". +// Valid definition numbers are between 1 and 999999999; numbers less than or equal to +// zero are invalid, and numbers greater than or equal to one billion (1x10^9) are +// reserved for internal Steam use. +typedef int32 SteamItemDef_t; + + +enum ESteamItemFlags +{ + // Item status flags - these flags are permanently attached to specific item instances + k_ESteamItemNoTrade = 1 << 0, // This item is account-locked and cannot be traded or given away. + + // Action confirmation flags - these flags are set one time only, as part of a result set + k_ESteamItemRemoved = 1 << 8, // The item has been destroyed, traded away, expired, or otherwise invalidated + k_ESteamItemConsumed = 1 << 9, // The item quantity has been decreased by 1 via ConsumeItem API. + + // All other flag bits are currently reserved for internal Steam use at this time. + // Do not assume anything about the state of other flags which are not defined here. +}; + +struct SteamItemDetails_t +{ + SteamItemInstanceID_t m_itemId; + SteamItemDef_t m_iDefinition; + uint16 m_unQuantity; + uint16 m_unFlags; // see ESteamItemFlags +}; + +typedef int32 SteamInventoryResult_t; + +static const SteamInventoryResult_t k_SteamInventoryResultInvalid = -1; + + +//----------------------------------------------------------------------------- +// Purpose: Steam Inventory query and manipulation API +//----------------------------------------------------------------------------- +class ISteamInventory +{ +public: + + // INVENTORY ASYNC RESULT MANAGEMENT + // + // Asynchronous inventory queries always output a result handle which can be used with + // GetResultStatus, GetResultItems, etc. A SteamInventoryResultReady_t callback will + // be triggered when the asynchronous result becomes ready (or fails). + // + + // Find out the status of an asynchronous inventory result handle. Possible values: + // k_EResultPending - still in progress + // k_EResultOK - done, result ready + // k_EResultExpired - done, result ready, maybe out of date (see DeserializeResult) + // k_EResultInvalidParam - ERROR: invalid API call parameters + // k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later + // k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits + // k_EResultFail - ERROR: unknown / generic error + METHOD_DESC(Find out the status of an asynchronous inventory result handle.) + virtual EResult GetResultStatus( SteamInventoryResult_t resultHandle ) = 0; + + // Copies the contents of a result set into a flat array. The specific + // contents of the result set depend on which query which was used. + METHOD_DESC(Copies the contents of a result set into a flat array. The specific contents of the result set depend on which query which was used.) + virtual bool GetResultItems( SteamInventoryResult_t resultHandle, + OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray, + uint32 *punOutItemsArraySize ) = 0; + + // Returns the server time at which the result was generated. Compare against + // the value of IClientUtils::GetServerRealTime() to determine age. + METHOD_DESC(Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.) + virtual uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle ) = 0; + + // Returns true if the result belongs to the target steam ID, false if the + // result does not. This is important when using DeserializeResult, to verify + // that a remote player is not pretending to have a different user's inventory. + METHOD_DESC(Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.) + virtual bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected ) = 0; + + // Destroys a result handle and frees all associated memory. + METHOD_DESC(Destroys a result handle and frees all associated memory.) + virtual void DestroyResult( SteamInventoryResult_t resultHandle ) = 0; + + + // INVENTORY ASYNC QUERY + // + + // Captures the entire state of the current user's Steam inventory. + // You must call DestroyResult on this handle when you are done with it. + // Returns false and sets *pResultHandle to zero if inventory is unavailable. + // Note: calls to this function are subject to rate limits and may return + // cached results if called too frequently. It is suggested that you call + // this function only when you are about to display the user's full inventory, + // or if you expect that the inventory may have changed. + METHOD_DESC(Captures the entire state of the current users Steam inventory.) + virtual bool GetAllItems( SteamInventoryResult_t *pResultHandle ) = 0; + + + // Captures the state of a subset of the current user's Steam inventory, + // identified by an array of item instance IDs. The results from this call + // can be serialized and passed to other players to "prove" that the current + // user owns specific items, without exposing the user's entire inventory. + // For example, you could call GetItemsByID with the IDs of the user's + // currently equipped cosmetic items and serialize this to a buffer, and + // then transmit this buffer to other players upon joining a game. + METHOD_DESC(Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.) + virtual bool GetItemsByID( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT( unCountInstanceIDs ) const SteamItemInstanceID_t *pInstanceIDs, uint32 unCountInstanceIDs ) = 0; + + + // RESULT SERIALIZATION AND AUTHENTICATION + // + // Serialized result sets contain a short signature which can't be forged + // or replayed across different game sessions. A result set can be serialized + // on the local client, transmitted to other players via your game networking, + // and deserialized by the remote players. This is a secure way of preventing + // hackers from lying about posessing rare/high-value items. + + // Serializes a result set with signature bytes to an output buffer. Pass + // NULL as an output buffer to get the required size via punOutBufferSize. + // The size of a serialized result depends on the number items which are being + // serialized. When securely transmitting items to other players, it is + // recommended to use "GetItemsByID" first to create a minimal result set. + // Results have a built-in timestamp which will be considered "expired" after + // an hour has elapsed. See DeserializeResult for expiration handling. + virtual bool SerializeResult( SteamInventoryResult_t resultHandle, OUT_BUFFER_COUNT(punOutBufferSize) void *pOutBuffer, uint32 *punOutBufferSize ) = 0; + + // Deserializes a result set and verifies the signature bytes. Returns false + // if bRequireFullOnlineVerify is set but Steam is running in Offline mode. + // Otherwise returns true and then delivers error codes via GetResultStatus. + // + // The bRESERVED_MUST_BE_FALSE flag is reserved for future use and should not + // be set to true by your game at this time. + // + // DeserializeResult has a potential soft-failure mode where the handle status + // is set to k_EResultExpired. GetResultItems() still succeeds in this mode. + // The "expired" result could indicate that the data may be out of date - not + // just due to timed expiration (one hour), but also because one of the items + // in the result set may have been traded or consumed since the result set was + // generated. You could compare the timestamp from GetResultTimestamp() to + // ISteamUtils::GetServerRealTime() to determine how old the data is. You could + // simply ignore the "expired" result code and continue as normal, or you + // could challenge the player with expired data to send an updated result set. + virtual bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, BUFFER_COUNT(punOutBufferSize) const void *pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE = false ) = 0; + + + // INVENTORY ASYNC MODIFICATION + // + + // GenerateItems() creates one or more items and then generates a SteamInventoryCallback_t + // notification with a matching nCallbackContext parameter. This API is insecure, and could + // be abused by hacked clients. It is, however, very useful as a development cheat or as + // a means of prototyping item-related features for your game. The use of GenerateItems can + // be restricted to certain item definitions or fully blocked via the Steamworks website. + // If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should + // describe the quantity of each item to generate. + virtual bool GenerateItems( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0; + + // GrantPromoItems() checks the list of promotional items for which the user may be eligible + // and grants the items (one time only). On success, the result set will include items which + // were granted, if any. If no items were granted because the user isn't eligible for any + // promotions, this is still considered a success. + METHOD_DESC(GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).) + virtual bool GrantPromoItems( SteamInventoryResult_t *pResultHandle ) = 0; + + // AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of + // scanning for all eligible promotional items, the check is restricted to a single item + // definition or set of item definitions. This can be useful if your game has custom UI for + // showing a specific promo item to the user. + virtual bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef ) = 0; + virtual bool AddPromoItems( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength ) = 0; + + // ConsumeItem() removes items from the inventory, permanently. They cannot be recovered. + // Not for the faint of heart - if your game implements item removal at all, a high-friction + // UI confirmation process is highly recommended. Similar to GenerateItems, punArrayQuantity + // can be NULL or else an array of the same length as pArrayItems which describe the quantity + // of each item to destroy. ConsumeItem can be restricted to certain item definitions or + // fully blocked via the Steamworks website to minimize support/abuse issues such as the + // clasic "my brother borrowed my laptop and deleted all of my rare items". + METHOD_DESC(ConsumeItem() removes items from the inventory permanently.) + virtual bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity ) = 0; + + // ExchangeItems() is an atomic combination of GenerateItems and DestroyItems. It can be + // used to implement crafting recipes or transmutations, or items which unpack themselves + // into other items. Like GenerateItems, this is a flexible and dangerous API which is + // meant for rapid prototyping. You can configure restrictions on ExchangeItems via the + // Steamworks website, such as limiting it to a whitelist of input/output combinations + // corresponding to recipes. + // (Note: although GenerateItems may be hard or impossible to use securely in your game, + // ExchangeItems is perfectly reasonable to use once the whitelists are set accordingly.) + virtual bool ExchangeItems( SteamInventoryResult_t *pResultHandle, + ARRAY_COUNT(unArrayGenerateLength) const SteamItemDef_t *pArrayGenerate, ARRAY_COUNT(unArrayGenerateLength) const uint32 *punArrayGenerateQuantity, uint32 unArrayGenerateLength, + ARRAY_COUNT(unArrayDestroyLength) const SteamItemInstanceID_t *pArrayDestroy, ARRAY_COUNT(unArrayDestroyLength) const uint32 *punArrayDestroyQuantity, uint32 unArrayDestroyLength ) = 0; + + + // TransferItemQuantity() is intended for use with items which are "stackable" (can have + // quantity greater than one). It can be used to split a stack into two, or to transfer + // quantity from one stack into another stack of identical items. To split one stack into + // two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated. + virtual bool TransferItemQuantity( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest ) = 0; + + + // TIMED DROPS AND PLAYTIME CREDIT + // + + // Applications which use timed-drop mechanics should call SendItemDropHeartbeat() when + // active gameplay begins, and at least once every two minutes afterwards. The backend + // performs its own time calculations, so the precise timing of the heartbeat is not + // critical as long as you send at least one heartbeat every two minutes. Calling the + // function more often than that is not harmful, it will simply have no effect. Note: + // players may be able to spoof this message by hacking their client, so you should not + // attempt to use this as a mechanism to restrict playtime credits. It is simply meant + // to distinguish between being in any kind of gameplay situation vs the main menu or + // a pre-game launcher window. (If you are stingy with handing out playtime credit, it + // will only encourage players to run bots or use mouse/kb event simulators.) + // + // Playtime credit accumulation can be capped on a daily or weekly basis through your + // Steamworks configuration. + // + METHOD_DESC(Applications which use timed-drop mechanics should call SendItemDropHeartbeat() when active gameplay begins and at least once every two minutes afterwards.) + virtual void SendItemDropHeartbeat() = 0; + + // Playtime credit must be consumed and turned into item drops by your game. Only item + // definitions which are marked as "playtime item generators" can be spawned. The call + // will return an empty result set if there is not enough playtime credit for a drop. + // Your game should call TriggerItemDrop at an appropriate time for the user to receive + // new items, such as between rounds or while the player is dead. Note that players who + // hack their clients could modify the value of "dropListDefinition", so do not use it + // to directly control rarity. It is primarily useful during testing and development, + // where you may wish to perform experiments with different types of drops. + METHOD_DESC(Playtime credit must be consumed and turned into item drops by your game.) + virtual bool TriggerItemDrop( SteamInventoryResult_t *pResultHandle, SteamItemDef_t dropListDefinition ) = 0; + + + // IN-GAME TRADING + // + // TradeItems() implements limited in-game trading of items, if you prefer not to use + // the overlay or an in-game web browser to perform Steam Trading through the website. + // You should implement a UI where both players can see and agree to a trade, and then + // each client should call TradeItems simultaneously (+/- 5 seconds) with matching + // (but reversed) parameters. The result is the same as if both players performed a + // Steam Trading transaction through the web. Each player will get an inventory result + // confirming the removal or quantity changes of the items given away, and the new + // item instance id numbers and quantities of the received items. + // (Note: new item instance IDs are generated whenever an item changes ownership.) + virtual bool TradeItems( SteamInventoryResult_t *pResultHandle, CSteamID steamIDTradePartner, + ARRAY_COUNT(nArrayGiveLength) const SteamItemInstanceID_t *pArrayGive, ARRAY_COUNT(nArrayGiveLength) const uint32 *pArrayGiveQuantity, uint32 nArrayGiveLength, + ARRAY_COUNT(nArrayGetLength) const SteamItemInstanceID_t *pArrayGet, ARRAY_COUNT(nArrayGetLength) const uint32 *pArrayGetQuantity, uint32 nArrayGetLength ) = 0; + + + // ITEM DEFINITIONS + // + // Item definitions are a mapping of "definition IDs" (integers between 1 and 1000000) + // to a set of string properties. Some of these properties are required to display items + // on the Steam community web site. Other properties can be defined by applications. + // Use of these functions is optional; there is no reason to call LoadItemDefinitions + // if your game hardcodes the numeric definition IDs (eg, purple face mask = 20, blue + // weapon mod = 55) and does not allow for adding new item types without a client patch. + // + + // LoadItemDefinitions triggers the automatic load and refresh of item definitions. + // Every time new item definitions are available (eg, from the dynamic addition of new + // item types while players are still in-game), a SteamInventoryDefinitionUpdate_t + // callback will be fired. + METHOD_DESC(LoadItemDefinitions triggers the automatic load and refresh of item definitions.) + virtual bool LoadItemDefinitions() = 0; + + // GetItemDefinitionIDs returns the set of all defined item definition IDs (which are + // defined via Steamworks configuration, and not necessarily contiguous integers). + // If pItemDefIDs is null, the call will return true and *punItemDefIDsArraySize will + // contain the total size necessary for a subsequent call. Otherwise, the call will + // return false if and only if there is not enough space in the output array. + virtual bool GetItemDefinitionIDs( + OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs, + DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0; + + // GetItemDefinitionProperty returns a string property from a given item definition. + // Note that some properties (for example, "name") may be localized and will depend + // on the current Steam language settings (see ISteamApps::GetCurrentGameLanguage). + // Property names are always composed of ASCII letters, numbers, and/or underscores. + // Pass a NULL pointer for pchPropertyName to get a comma - separated list of available + // property names. + virtual bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPropertyName, + OUT_STRING_COUNT(punValueBufferSize) char *pchValueBuffer, uint32 *punValueBufferSize ) = 0; +}; + +#define STEAMINVENTORY_INTERFACE_VERSION "STEAMINVENTORY_INTERFACE_V001" + + +// SteamInventoryResultReady_t callbacks are fired whenever asynchronous +// results transition from "Pending" to "OK" or an error state. There will +// always be exactly one callback per handle. +struct SteamInventoryResultReady_t +{ + enum { k_iCallback = k_iClientInventoryCallbacks + 0 }; + SteamInventoryResult_t m_handle; + EResult m_result; +}; + + +// SteamInventoryFullUpdate_t callbacks are triggered when GetAllItems +// successfully returns a result which is newer / fresher than the last +// known result. (It will not trigger if the inventory hasn't changed, +// or if results from two overlapping calls are reversed in flight and +// the earlier result is already known to be stale/out-of-date.) +// The normal ResultReady callback will still be triggered immediately +// afterwards; this is an additional notification for your convenience. +struct SteamInventoryFullUpdate_t +{ + enum { k_iCallback = k_iClientInventoryCallbacks + 1 }; + SteamInventoryResult_t m_handle; +}; + + +// A SteamInventoryDefinitionUpdate_t callback is triggered whenever +// item definitions have been updated, which could be in response to +// LoadItemDefinitions() or any other async request which required +// a definition update in order to process results from the server. +struct SteamInventoryDefinitionUpdate_t +{ + enum { k_iCallback = k_iClientInventoryCallbacks + 2 }; +}; + +#pragma pack( pop ) + + +#endif // ISTEAMCONTROLLER_H diff --git a/public/steam/isteammasterserverupdater.h b/public/steam/isteammasterserverupdater.h new file mode 100644 index 000000000..9f2e712e5 --- /dev/null +++ b/public/steam/isteammasterserverupdater.h @@ -0,0 +1,2 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +#error "This file isn't used any more" diff --git a/public/steam/isteammatchmaking.h b/public/steam/isteammatchmaking.h index 0a2e214d9..e3be340d9 100644 --- a/public/steam/isteammatchmaking.h +++ b/public/steam/isteammatchmaking.h @@ -1,300 +1,747 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: interface to steam managing game server/client match making -// -//============================================================================= -#ifndef ISTEAMMATCHMAKING -#define ISTEAMMATCHMAKING -#ifdef _WIN32 -#pragma once -#endif - -#include "steamtypes.h" -#include "steamclientpublic.h" -#include "matchmakingtypes.h" -#include "isteamclient.h" -#include "isteamfriends.h" - -// 32KB max size on chat messages -enum { k_cchFriendChatMsgMax = 32 * 1024 }; - -//----------------------------------------------------------------------------- -// Purpose: Functions for match making services for clients to get to favorites -//----------------------------------------------------------------------------- -class ISteamMatchmaking -{ -public: - virtual int GetFavoriteGameCount() = 0; - - // Obsolete. Use the ...2 versions of these functions, which take separate connection and query ports. - virtual bool GetFavoriteGame( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0; - virtual int AddFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) =0; - virtual bool RemoveFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags ) = 0; - - - // returns the details of the game server - // iGame is of range [0,iGame) - virtual bool GetFavoriteGame2( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0; - - // returns the new index of the game - virtual int AddFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) =0; - - // removes the game; returns true if one was removed - virtual bool RemoveFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0; - - /////// - // Game lobby functions - - // Get a list of relevant lobbies - virtual void RequestLobbyList( uint64 ulGameID, MatchMakingKeyValuePair_t *pFilters, uint32 nFilters ) = 0; - virtual CSteamID GetLobbyByIndex( int iLobby ) = 0; - // Create a lobby - you'll get the SteamID of it on success - virtual void CreateLobby( uint64 ulGameID, bool bPrivate ) = 0; - // Join a lobby - virtual void JoinLobby( CSteamID steamIDLobby ) = 0; - // Leave a lobby - virtual void LeaveLobby( CSteamID steamIDLobby ) = 0; - // Invite someone to the lobby - virtual bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) = 0; - // List users in this lobby - virtual int GetNumLobbyMembers( CSteamID steamIDLobby ) = 0; - virtual CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember ) = 0; - // Get data associated with this lobby - virtual const char *GetLobbyData( CSteamID SteamIDLobby, const char *pchKey ) = 0; - // Update lobby data (Admin only) - virtual void SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0; - // Get per-user data for someone in this lobby - virtual const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey ) = 0; - // Update user data (for you only) - virtual void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0; - // change the lobby Admin (Admin only) - virtual void ChangeLobbyAdmin( CSteamID steamIDLobby, CSteamID steamIDNewAdmin ) = 0; - // Send a chat message to the lobby - virtual bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody ) = 0; - // Get a chat message entry - virtual int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0; - -}; -#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking001" - - -//----------------------------------------------------------------------------- -// Purpose: Callback interfaces for server list functions -//----------------------------------------------------------------------------- -class ISteamMatchmakingServerListResponse -{ -public: - virtual void ServerResponded( int iServer ) = 0; - virtual void ServerFailedToRespond( int iServer ) = 0; - virtual void RefreshComplete( EMatchMakingServerResponse response ) = 0; -}; - -class ISteamMatchmakingPingResponse -{ -public: - virtual void ServerResponded( gameserveritem_t &server ) = 0; - virtual void ServerFailedToRespond() = 0; -}; - -class ISteamMatchmakingPlayersResponse -{ -public: - virtual void AddPlayerToList( const char *pchName, int nScore, float flTimePlayed ) = 0; - virtual void PlayersFailedToRespond() = 0; - virtual void PlayersRefreshComplete() = 0; -}; - - -class ISteamMatchmakingRulesResponse -{ -public: - virtual void RulesResponded( const char *pchRule, const char *pchValue ) = 0; - virtual void RulesFailedToRespond() = 0; - virtual void RulesRefreshComplete() = 0; -}; - -typedef int HServerQuery; -const int HSERVERQUERY_INVALID = 0xffffffff; - -//----------------------------------------------------------------------------- -// Purpose: Functions for match making services for clients to get to game servers -//----------------------------------------------------------------------------- -class ISteamMatchmakingServers -{ -public: - // request a new list of servers of a particular type - virtual void RequestInternetServerList( uint32 iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual void RequestLANServerList( uint32 iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual void RequestFriendsServerList( uint32 iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual void RequestFavoritesServerList( uint32 iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual void RequestHistoryServerList( uint32 iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual void RequestSpectatorServerList( uint32 iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - - virtual gameserveritem_t *GetServerDetails( EMatchMakingType eType, int iServer ) = 0; - - virtual void CancelQuery( EMatchMakingType eType ) = 0; // stop getting new servers from an earlier query - virtual void RefreshQuery( EMatchMakingType eType ) = 0; // ping every server in your list again but don't update the list of servers - virtual bool IsRefreshing( EMatchMakingType eType ) = 0; // returns true if the list is currently refreshing its server list - virtual int GetServerCount( EMatchMakingType eType ) = 0; // how many servers in this list, GetServerDetails takes 0... GetServerCount() - 1 - virtual void RefreshServer( EMatchMakingType eType, int iServer ) = 0; // refresh a single server inside of a query (rather than all the servers ) - - // queries to individual servers - virtual HServerQuery PingServer( uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse *pRequestServersResponse ) = 0; // request details from a single server - virtual HServerQuery PlayerDetails( uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse *pRequestServersResponse ) = 0; // get a list of players from a server - virtual HServerQuery ServerRules( uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse *pRequestServersResponse ) = 0; // get the rules that server is running - virtual void CancelServerQuery( HServerQuery hServerQuery ) = 0; // cancel an outstanding query from above -}; -#define STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION "SteamMatchMakingServers001" - -//----------------------------------------------------------------------------- -// Callbacks -//----------------------------------------------------------------------------- - -// game server flags -const uint32 k_unFavoriteFlagNone = 0x00; -const uint32 k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list -const uint32 k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list - -// callbacks - - -// a server was added/removed from the favorites list, you should refresh now -struct FavoritesListChanged_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 2 }; // +2 as +1 was a previous version of this call with a different layout - uint32 m_nIP; // an IP of 0 means reload the whole list, any other value means just one server - uint32 m_nQueryPort; - uint32 m_nConnPort; - uint32 m_nAppID; - uint32 m_nFlags; - bool m_bAdd; // true if this is adding the entry, otherwise it is a remove -}; - -//----------------------------------------------------------------------------- -// Purpose: Someone has invited you to join a Lobby -//----------------------------------------------------------------------------- -struct LobbyInvite_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 3 }; - - uint64 m_ulSteamIDUser; // Steam ID of the person making the invite - uint64 m_ulSteamIDLobby; // Steam ID of the Lobby -}; - -//----------------------------------------------------------------------------- -// Purpose: You have entered a Lobby -//----------------------------------------------------------------------------- -struct LobbyEnter_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 4 }; - - uint64 m_ulSteamIDLobby; // SteamID of the Lobby you have entered - uint32 m_rgfChatPermissions; // Permissions of the current user - bool m_bLocked; // If true, then only invited users may join - uint32 m_EChatRoomEnterResponse; // EChatRoomEnterResponse -}; - -//----------------------------------------------------------------------------- -// Purpose: The lobby data has changed -//----------------------------------------------------------------------------- -struct LobbyDataUpdate_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 5 }; - - uint64 m_ulSteamIDLobby; // steamID of the Lobby - uint64 m_ulSteamIDMember; // steamID of the member whose data changed, or the room itself -}; - - -//----------------------------------------------------------------------------- -// Purpose: The lobby chat room state has changed -//----------------------------------------------------------------------------- -struct LobbyChatUpdate_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 6 }; - - uint64 m_ulSteamIDLobby; // Lobby ID - uint64 m_ulSteamIDUserChanged; // user who's status in the lobby just changed - can be recipient - uint64 m_ulSteamIDMakingChange; // Chat member who made the change (different from SteamIDUserChange if kicking, muting, etc.) - uint32 m_rgfChatMemberStateChange; // bitfield of EChatMemberStateChange values -}; - -//----------------------------------------------------------------------------- -// Purpose: A chat message for this lobby -//----------------------------------------------------------------------------- -struct LobbyChatMsg_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 7 }; - - uint64 m_ulSteamIDLobby; // the lobby id this is in - uint64 m_ulSteamIDUser; // steamID of the user who has sent this message - uint8 m_eChatEntryType; // type of message - uint32 m_iChatID; // index of the chat entry to lookup -}; - -//----------------------------------------------------------------------------- -// Purpose: There's a change of Admin in this Lobby -//----------------------------------------------------------------------------- -struct LobbyAdminChange_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 8 }; - - uint64 m_ulSteamIDLobby; - uint64 m_ulSteamIDNewAdmin; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The Admin of a Lobby has created a game to join -//----------------------------------------------------------------------------- -struct LobbyGameCreated_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 9 }; - - uint64 m_ulSteamIDLobby; - uint32 m_unIP; - uint16 m_usPort; -}; - -//----------------------------------------------------------------------------- -// Purpose: Number of matching lobbies found, iterate with GetLobbyByIndex -//----------------------------------------------------------------------------- -struct LobbyMatchList_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 10 }; - uint32 m_nLobbiesMatching; // Number of lobbies that matched search criteria and we have SteamIDs for -}; - - -//----------------------------------------------------------------------------- -// Purpose: The Lobby is closing -//----------------------------------------------------------------------------- -struct LobbyClosing_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 11 }; - uint64 m_ulSteamIDLobby; // Lobby -}; - - -//----------------------------------------------------------------------------- -// Purpose: You have been kicked from the lobby -//----------------------------------------------------------------------------- -struct LobbyKicked_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 12 }; - uint64 m_ulSteamIDLobby; // Lobby - uint64 m_ulSteamIDAdmin; // User who kicked you -}; - - -//----------------------------------------------------------------------------- -// Purpose: Result of our request to create a Lobby -//----------------------------------------------------------------------------- -struct LobbyCreate_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 13 }; - EResult m_eResult; // Result - uint64 m_ulSteamIDLobby; // chat room, zero if failed -}; - -#endif // ISTEAMMATCHMAKING +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to steam managing game server/client match making +// +//============================================================================= + +#ifndef ISTEAMMATCHMAKING +#define ISTEAMMATCHMAKING +#ifdef _WIN32 +#pragma once +#endif + +#include "steamtypes.h" +#include "steamclientpublic.h" +#include "matchmakingtypes.h" +#include "isteamclient.h" +#include "isteamfriends.h" + +// lobby type description +enum ELobbyType +{ + k_ELobbyTypePrivate = 0, // only way to join the lobby is to invite to someone else + k_ELobbyTypeFriendsOnly = 1, // shows for friends or invitees, but not in lobby list + k_ELobbyTypePublic = 2, // visible for friends and in lobby list + k_ELobbyTypeInvisible = 3, // returned by search, but not visible to other friends + // useful if you want a user in two lobbies, for example matching groups together + // a user can be in only one regular lobby, and up to two invisible lobbies +}; + +// lobby search filter tools +enum ELobbyComparison +{ + k_ELobbyComparisonEqualToOrLessThan = -2, + k_ELobbyComparisonLessThan = -1, + k_ELobbyComparisonEqual = 0, + k_ELobbyComparisonGreaterThan = 1, + k_ELobbyComparisonEqualToOrGreaterThan = 2, + k_ELobbyComparisonNotEqual = 3, +}; + +// lobby search distance. Lobby results are sorted from closest to farthest. +enum ELobbyDistanceFilter +{ + k_ELobbyDistanceFilterClose, // only lobbies in the same immediate region will be returned + k_ELobbyDistanceFilterDefault, // only lobbies in the same region or near by regions + k_ELobbyDistanceFilterFar, // for games that don't have many latency requirements, will return lobbies about half-way around the globe + k_ELobbyDistanceFilterWorldwide, // no filtering, will match lobbies as far as India to NY (not recommended, expect multiple seconds of latency between the clients) +}; + +// maximum number of characters a lobby metadata key can be +#define k_nMaxLobbyKeyLength 255 + +//----------------------------------------------------------------------------- +// Purpose: Functions for match making services for clients to get to favorites +// and to operate on game lobbies. +//----------------------------------------------------------------------------- +class ISteamMatchmaking +{ +public: + // game server favorites storage + // saves basic details about a multiplayer game server locally + + // returns the number of favorites servers the user has stored + virtual int GetFavoriteGameCount() = 0; + + // returns the details of the game server + // iGame is of range [0,GetFavoriteGameCount()) + // *pnIP, *pnConnPort are filled in the with IP:port of the game server + // *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections + // *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added + virtual bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0; + + // adds the game server to the local list; updates the time played of the server if it already exists in the list + virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) = 0; + + // removes the game server from the local storage; returns true if one was removed + virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0; + + /////// + // Game lobby functions + + // Get a list of relevant lobbies + // this is an asynchronous request + // results will be returned by LobbyMatchList_t callback & call result, with the number of lobbies found + // this will never return lobbies that are full + // to add more filter, the filter calls below need to be call before each and every RequestLobbyList() call + // use the CCallResult<> object in steam_api.h to match the SteamAPICall_t call result to a function in an object, e.g. + /* + class CMyLobbyListManager + { + CCallResult m_CallResultLobbyMatchList; + void FindLobbies() + { + // SteamMatchmaking()->AddRequestLobbyListFilter*() functions would be called here, before RequestLobbyList() + SteamAPICall_t hSteamAPICall = SteamMatchmaking()->RequestLobbyList(); + m_CallResultLobbyMatchList.Set( hSteamAPICall, this, &CMyLobbyListManager::OnLobbyMatchList ); + } + + void OnLobbyMatchList( LobbyMatchList_t *pLobbyMatchList, bool bIOFailure ) + { + // lobby list has be retrieved from Steam back-end, use results + } + } + */ + // + virtual SteamAPICall_t RequestLobbyList() = 0; + // filters for lobbies + // this needs to be called before RequestLobbyList() to take effect + // these are cleared on each call to RequestLobbyList() + virtual void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pchValueToMatch, ELobbyComparison eComparisonType ) = 0; + // numerical comparison + virtual void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType ) = 0; + // returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence + virtual void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueToBeCloseTo ) = 0; + // returns only lobbies with the specified number of slots available + virtual void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable ) = 0; + // sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed) + virtual void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilter ) = 0; + // sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client + virtual void AddRequestLobbyListResultCountFilter( int cMaxResults ) = 0; + + virtual void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby ) = 0; + + // returns the CSteamID of a lobby, as retrieved by a RequestLobbyList call + // should only be called after a LobbyMatchList_t callback is received + // iLobby is of the range [0, LobbyMatchList_t::m_nLobbiesMatching) + // the returned CSteamID::IsValid() will be false if iLobby is out of range + virtual CSteamID GetLobbyByIndex( int iLobby ) = 0; + + // Create a lobby on the Steam servers. + // If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID + // of the lobby will need to be communicated via game channels or via InviteUserToLobby() + // this is an asynchronous request + // results will be returned by LobbyCreated_t callback and call result; lobby is joined & ready to use at this point + // a LobbyEnter_t callback will also be received (since the local user is joining their own lobby) + virtual SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers ) = 0; + + // Joins an existing lobby + // this is an asynchronous request + // results will be returned by LobbyEnter_t callback & call result, check m_EChatRoomEnterResponse to see if was successful + // lobby metadata is available to use immediately on this call completing + virtual SteamAPICall_t JoinLobby( CSteamID steamIDLobby ) = 0; + + // Leave a lobby; this will take effect immediately on the client side + // other users in the lobby will be notified by a LobbyChatUpdate_t callback + virtual void LeaveLobby( CSteamID steamIDLobby ) = 0; + + // Invite another user to the lobby + // the target user will receive a LobbyInvite_t callback + // will return true if the invite is successfully sent, whether or not the target responds + // returns false if the local user is not connected to the Steam servers + // if the other user clicks the join link, a GameLobbyJoinRequested_t will be posted if the user is in-game, + // or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id> + virtual bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) = 0; + + // Lobby iteration, for viewing details of users in a lobby + // only accessible if the lobby user is a member of the specified lobby + // persona information for other lobby members (name, avatar, etc.) will be asynchronously received + // and accessible via ISteamFriends interface + + // returns the number of users in the specified lobby + virtual int GetNumLobbyMembers( CSteamID steamIDLobby ) = 0; + // returns the CSteamID of a user in the lobby + // iMember is of range [0,GetNumLobbyMembers()) + // note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby + virtual CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember ) = 0; + + // Get data associated with this lobby + // takes a simple key, and returns the string associated with it + // "" will be returned if no value is set, or if steamIDLobby is invalid + virtual const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0; + // Sets a key/value pair in the lobby metadata + // each user in the lobby will be broadcast this new value, and any new users joining will receive any existing data + // this can be used to set lobby names, map, etc. + // to reset a key, just set it to "" + // other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback + virtual bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0; + + // returns the number of metadata keys set on the specified lobby + virtual int GetLobbyDataCount( CSteamID steamIDLobby ) = 0; + + // returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount()) + virtual bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize ) = 0; + + // removes a metadata key from the lobby + virtual bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0; + + // Gets per-user metadata for someone in this lobby + virtual const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey ) = 0; + // Sets per-user metadata (for the local user implicitly) + virtual void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0; + + // Broadcasts a chat message to the all the users in the lobby + // users in the lobby (including the local user) will receive a LobbyChatMsg_t callback + // returns true if the message is successfully sent + // pvMsgBody can be binary or text data, up to 4k + // if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator + virtual bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody ) = 0; + // Get a chat message as specified in a LobbyChatMsg_t callback + // iChatID is the LobbyChatMsg_t::m_iChatID value in the callback + // *pSteamIDUser is filled in with the CSteamID of the member + // *pvData is filled in with the message itself + // return value is the number of bytes written into the buffer + virtual int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, OUT_STRUCT() CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0; + + // Refreshes metadata for a lobby you're not necessarily in right now + // you never do this for lobbies you're a member of, only if your + // this will send down all the metadata associated with a lobby + // this is an asynchronous call + // returns false if the local user is not connected to the Steam servers + // results will be returned by a LobbyDataUpdate_t callback + // if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false + virtual bool RequestLobbyData( CSteamID steamIDLobby ) = 0; + + // sets the game server associated with the lobby + // usually at this point, the users will join the specified game server + // either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect + virtual void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer ) = 0; + // returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist + virtual bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, OUT_STRUCT() CSteamID *psteamIDGameServer ) = 0; + + // set the limit on the # of users who can join the lobby + virtual bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers ) = 0; + // returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined + virtual int GetLobbyMemberLimit( CSteamID steamIDLobby ) = 0; + + // updates which type of lobby it is + // only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls + virtual bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType ) = 0; + + // sets whether or not a lobby is joinable - defaults to true for a new lobby + // if set to false, no user can join, even if they are a friend or have been invited + virtual bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable ) = 0; + + // returns the current lobby owner + // you must be a member of the lobby to access this + // there always one lobby owner - if the current owner leaves, another user will become the owner + // it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner + virtual CSteamID GetLobbyOwner( CSteamID steamIDLobby ) = 0; + + // changes who the lobby owner is + // you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby + // after completion, the local user will no longer be the owner + virtual bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner ) = 0; + + // link two lobbies for the purposes of checking player compatibility + // you must be the lobby owner of both lobbies + virtual bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent ) = 0; + +#ifdef _PS3 + // changes who the lobby owner is + // you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby + // after completion, the local user will no longer be the owner + virtual void CheckForPSNGameBootInvite( unsigned int iGameBootAttributes ) = 0; +#endif +}; +#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking009" + + +//----------------------------------------------------------------------------- +// Callback interfaces for server list functions (see ISteamMatchmakingServers below) +// +// The idea here is that your game code implements objects that implement these +// interfaces to receive callback notifications after calling asynchronous functions +// inside the ISteamMatchmakingServers() interface below. +// +// This is different than normal Steam callback handling due to the potentially +// large size of server lists. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Typedef for handle type you will receive when requesting server list. +//----------------------------------------------------------------------------- +typedef void* HServerListRequest; + +//----------------------------------------------------------------------------- +// Purpose: Callback interface for receiving responses after a server list refresh +// or an individual server update. +// +// Since you get these callbacks after requesting full list refreshes you will +// usually implement this interface inside an object like CServerBrowser. If that +// object is getting destructed you should use ISteamMatchMakingServers()->CancelQuery() +// to cancel any in-progress queries so you don't get a callback into the destructed +// object and crash. +//----------------------------------------------------------------------------- +class ISteamMatchmakingServerListResponse +{ +public: + // Server has responded ok with updated data + virtual void ServerResponded( HServerListRequest hRequest, int iServer ) = 0; + + // Server has failed to respond + virtual void ServerFailedToRespond( HServerListRequest hRequest, int iServer ) = 0; + + // A list refresh you had initiated is now 100% completed + virtual void RefreshComplete( HServerListRequest hRequest, EMatchMakingServerResponse response ) = 0; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Callback interface for receiving responses after pinging an individual server +// +// These callbacks all occur in response to querying an individual server +// via the ISteamMatchmakingServers()->PingServer() call below. If you are +// destructing an object that implements this interface then you should call +// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query +// which is in progress. Failure to cancel in progress queries when destructing +// a callback handler may result in a crash when a callback later occurs. +//----------------------------------------------------------------------------- +class ISteamMatchmakingPingResponse +{ +public: + // Server has responded successfully and has updated data + virtual void ServerResponded( gameserveritem_t &server ) = 0; + + // Server failed to respond to the ping request + virtual void ServerFailedToRespond() = 0; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Callback interface for receiving responses after requesting details on +// who is playing on a particular server. +// +// These callbacks all occur in response to querying an individual server +// via the ISteamMatchmakingServers()->PlayerDetails() call below. If you are +// destructing an object that implements this interface then you should call +// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query +// which is in progress. Failure to cancel in progress queries when destructing +// a callback handler may result in a crash when a callback later occurs. +//----------------------------------------------------------------------------- +class ISteamMatchmakingPlayersResponse +{ +public: + // Got data on a new player on the server -- you'll get this callback once per player + // on the server which you have requested player data on. + virtual void AddPlayerToList( const char *pchName, int nScore, float flTimePlayed ) = 0; + + // The server failed to respond to the request for player details + virtual void PlayersFailedToRespond() = 0; + + // The server has finished responding to the player details request + // (ie, you won't get anymore AddPlayerToList callbacks) + virtual void PlayersRefreshComplete() = 0; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Callback interface for receiving responses after requesting rules +// details on a particular server. +// +// These callbacks all occur in response to querying an individual server +// via the ISteamMatchmakingServers()->ServerRules() call below. If you are +// destructing an object that implements this interface then you should call +// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query +// which is in progress. Failure to cancel in progress queries when destructing +// a callback handler may result in a crash when a callback later occurs. +//----------------------------------------------------------------------------- +class ISteamMatchmakingRulesResponse +{ +public: + // Got data on a rule on the server -- you'll get one of these per rule defined on + // the server you are querying + virtual void RulesResponded( const char *pchRule, const char *pchValue ) = 0; + + // The server failed to respond to the request for rule details + virtual void RulesFailedToRespond() = 0; + + // The server has finished responding to the rule details request + // (ie, you won't get anymore RulesResponded callbacks) + virtual void RulesRefreshComplete() = 0; +}; + + +//----------------------------------------------------------------------------- +// Typedef for handle type you will receive when querying details on an individual server. +//----------------------------------------------------------------------------- +typedef int HServerQuery; +const int HSERVERQUERY_INVALID = 0xffffffff; + +//----------------------------------------------------------------------------- +// Purpose: Functions for match making services for clients to get to game lists and details +//----------------------------------------------------------------------------- +class ISteamMatchmakingServers +{ +public: + // Request a new list of servers of a particular type. These calls each correspond to one of the EMatchMakingType values. + // Each call allocates a new asynchronous request object. + // Request object must be released by calling ReleaseRequest( hServerListRequest ) + virtual HServerListRequest RequestInternetServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; + virtual HServerListRequest RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; + virtual HServerListRequest RequestFriendsServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; + virtual HServerListRequest RequestFavoritesServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; + virtual HServerListRequest RequestHistoryServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; + virtual HServerListRequest RequestSpectatorServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; + + // Releases the asynchronous request object and cancels any pending query on it if there's a pending query in progress. + // RefreshComplete callback is not posted when request is released. + virtual void ReleaseRequest( HServerListRequest hServerListRequest ) = 0; + + /* the filter operation codes that go in the key part of MatchMakingKeyValuePair_t should be one of these: + + "map" + - Server passes the filter if the server is playing the specified map. + "gamedataand" + - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains all of the + specified strings. The value field is a comma-delimited list of strings to match. + "gamedataor" + - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains at least one of the + specified strings. The value field is a comma-delimited list of strings to match. + "gamedatanor" + - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) does not contain any + of the specified strings. The value field is a comma-delimited list of strings to check. + "gametagsand" + - Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) contains all + of the specified strings. The value field is a comma-delimited list of strings to check. + "gametagsnor" + - Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) does not contain any + of the specified strings. The value field is a comma-delimited list of strings to check. + "and" (x1 && x2 && ... && xn) + "or" (x1 || x2 || ... || xn) + "nand" !(x1 && x2 && ... && xn) + "nor" !(x1 || x2 || ... || xn) + - Performs Boolean operation on the following filters. The operand to this filter specifies + the "size" of the Boolean inputs to the operation, in Key/value pairs. (The keyvalue + pairs must immediately follow, i.e. this is a prefix logical operator notation.) + In the simplest case where Boolean expressions are not nested, this is simply + the number of operands. + + For example, to match servers on a particular map or with a particular tag, would would + use these filters. + + ( server.map == "cp_dustbowl" || server.gametags.contains("payload") ) + "or", "2" + "map", "cp_dustbowl" + "gametagsand", "payload" + + If logical inputs are nested, then the operand specifies the size of the entire + "length" of its operands, not the number of immediate children. + + ( server.map == "cp_dustbowl" || ( server.gametags.contains("payload") && !server.gametags.contains("payloadrace") ) ) + "or", "4" + "map", "cp_dustbowl" + "and", "2" + "gametagsand", "payload" + "gametagsnor", "payloadrace" + + Unary NOT can be achieved using either "nand" or "nor" with a single operand. + + "addr" + - Server passes the filter if the server's query address matches the specified IP or IP:port. + "gameaddr" + - Server passes the filter if the server's game address matches the specified IP or IP:port. + + The following filter operations ignore the "value" part of MatchMakingKeyValuePair_t + + "dedicated" + - Server passes the filter if it passed true to SetDedicatedServer. + "secure" + - Server passes the filter if the server is VAC-enabled. + "notfull" + - Server passes the filter if the player count is less than the reported max player count. + "hasplayers" + - Server passes the filter if the player count is greater than zero. + "noplayers" + - Server passes the filter if it doesn't have any players. + "linux" + - Server passes the filter if it's a linux server + */ + + // Get details on a given server in the list, you can get the valid range of index + // values by calling GetServerCount(). You will also receive index values in + // ISteamMatchmakingServerListResponse::ServerResponded() callbacks + virtual gameserveritem_t *GetServerDetails( HServerListRequest hRequest, int iServer ) = 0; + + // Cancel an request which is operation on the given list type. You should call this to cancel + // any in-progress requests before destructing a callback object that may have been passed + // to one of the above list request calls. Not doing so may result in a crash when a callback + // occurs on the destructed object. + // Canceling a query does not release the allocated request handle. + // The request handle must be released using ReleaseRequest( hRequest ) + virtual void CancelQuery( HServerListRequest hRequest ) = 0; + + // Ping every server in your list again but don't update the list of servers + // Query callback installed when the server list was requested will be used + // again to post notifications and RefreshComplete, so the callback must remain + // valid until another RefreshComplete is called on it or the request + // is released with ReleaseRequest( hRequest ) + virtual void RefreshQuery( HServerListRequest hRequest ) = 0; + + // Returns true if the list is currently refreshing its server list + virtual bool IsRefreshing( HServerListRequest hRequest ) = 0; + + // How many servers in the given list, GetServerDetails above takes 0... GetServerCount() - 1 + virtual int GetServerCount( HServerListRequest hRequest ) = 0; + + // Refresh a single server inside of a query (rather than all the servers ) + virtual void RefreshServer( HServerListRequest hRequest, int iServer ) = 0; + + + //----------------------------------------------------------------------------- + // Queries to individual servers directly via IP/Port + //----------------------------------------------------------------------------- + + // Request updated ping time and other details from a single server + virtual HServerQuery PingServer( uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse *pRequestServersResponse ) = 0; + + // Request the list of players currently playing on a server + virtual HServerQuery PlayerDetails( uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse *pRequestServersResponse ) = 0; + + // Request the list of rules that the server is running (See ISteamGameServer::SetKeyValue() to set the rules server side) + virtual HServerQuery ServerRules( uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse *pRequestServersResponse ) = 0; + + // Cancel an outstanding Ping/Players/Rules query from above. You should call this to cancel + // any in-progress requests before destructing a callback object that may have been passed + // to one of the above calls to avoid crashing when callbacks occur. + virtual void CancelServerQuery( HServerQuery hServerQuery ) = 0; +}; +#define STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION "SteamMatchMakingServers002" + +// game server flags +const uint32 k_unFavoriteFlagNone = 0x00; +const uint32 k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list +const uint32 k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list + + +//----------------------------------------------------------------------------- +// Purpose: Used in ChatInfo messages - fields specific to a chat member - must fit in a uint32 +//----------------------------------------------------------------------------- +enum EChatMemberStateChange +{ + // Specific to joining / leaving the chatroom + k_EChatMemberStateChangeEntered = 0x0001, // This user has joined or is joining the chat room + k_EChatMemberStateChangeLeft = 0x0002, // This user has left or is leaving the chat room + k_EChatMemberStateChangeDisconnected = 0x0004, // User disconnected without leaving the chat first + k_EChatMemberStateChangeKicked = 0x0008, // User kicked + k_EChatMemberStateChangeBanned = 0x0010, // User kicked and banned +}; + +// returns true of the flags indicate that a user has been removed from the chat +#define BChatMemberStateChangeRemoved( rgfChatMemberStateChangeFlags ) ( rgfChatMemberStateChangeFlags & ( k_EChatMemberStateChangeDisconnected | k_EChatMemberStateChangeLeft | k_EChatMemberStateChangeKicked | k_EChatMemberStateChangeBanned ) ) + + +//----------------------------------------------------------------------------- +// Callbacks for ISteamMatchmaking (which go through the regular Steam callback registration system) +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// Purpose: a server was added/removed from the favorites list, you should refresh now +//----------------------------------------------------------------------------- +struct FavoritesListChanged_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 2 }; + uint32 m_nIP; // an IP of 0 means reload the whole list, any other value means just one server + uint32 m_nQueryPort; + uint32 m_nConnPort; + uint32 m_nAppID; + uint32 m_nFlags; + bool m_bAdd; // true if this is adding the entry, otherwise it is a remove + AccountID_t m_unAccountId; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Someone has invited you to join a Lobby +// normally you don't need to do anything with this, since +// the Steam UI will also display a ' has invited you to the lobby, join?' dialog +// +// if the user outside a game chooses to join, your game will be launched with the parameter "+connect_lobby <64-bit lobby id>", +// or with the callback GameLobbyJoinRequested_t if they're already in-game +//----------------------------------------------------------------------------- +struct LobbyInvite_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 3 }; + + uint64 m_ulSteamIDUser; // Steam ID of the person making the invite + uint64 m_ulSteamIDLobby; // Steam ID of the Lobby + uint64 m_ulGameID; // GameID of the Lobby +}; + + +//----------------------------------------------------------------------------- +// Purpose: Sent on entering a lobby, or on failing to enter +// m_EChatRoomEnterResponse will be set to k_EChatRoomEnterResponseSuccess on success, +// or a higher value on failure (see enum EChatRoomEnterResponse) +//----------------------------------------------------------------------------- +struct LobbyEnter_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 4 }; + + uint64 m_ulSteamIDLobby; // SteamID of the Lobby you have entered + uint32 m_rgfChatPermissions; // Permissions of the current user + bool m_bLocked; // If true, then only invited users may join + uint32 m_EChatRoomEnterResponse; // EChatRoomEnterResponse +}; + + +//----------------------------------------------------------------------------- +// Purpose: The lobby metadata has changed +// if m_ulSteamIDMember is the steamID of a lobby member, use GetLobbyMemberData() to access per-user details +// if m_ulSteamIDMember == m_ulSteamIDLobby, use GetLobbyData() to access lobby metadata +//----------------------------------------------------------------------------- +struct LobbyDataUpdate_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 5 }; + + uint64 m_ulSteamIDLobby; // steamID of the Lobby + uint64 m_ulSteamIDMember; // steamID of the member whose data changed, or the room itself + uint8 m_bSuccess; // true if we lobby data was successfully changed; + // will only be false if RequestLobbyData() was called on a lobby that no longer exists +}; + + +//----------------------------------------------------------------------------- +// Purpose: The lobby chat room state has changed +// this is usually sent when a user has joined or left the lobby +//----------------------------------------------------------------------------- +struct LobbyChatUpdate_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 6 }; + + uint64 m_ulSteamIDLobby; // Lobby ID + uint64 m_ulSteamIDUserChanged; // user who's status in the lobby just changed - can be recipient + uint64 m_ulSteamIDMakingChange; // Chat member who made the change (different from SteamIDUserChange if kicking, muting, etc.) + // for example, if one user kicks another from the lobby, this will be set to the id of the user who initiated the kick + uint32 m_rgfChatMemberStateChange; // bitfield of EChatMemberStateChange values +}; + + +//----------------------------------------------------------------------------- +// Purpose: A chat message for this lobby has been sent +// use GetLobbyChatEntry( m_iChatID ) to retrieve the contents of this message +//----------------------------------------------------------------------------- +struct LobbyChatMsg_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 7 }; + + uint64 m_ulSteamIDLobby; // the lobby id this is in + uint64 m_ulSteamIDUser; // steamID of the user who has sent this message + uint8 m_eChatEntryType; // type of message + uint32 m_iChatID; // index of the chat entry to lookup +}; + + +//----------------------------------------------------------------------------- +// Purpose: A game created a game for all the members of the lobby to join, +// as triggered by a SetLobbyGameServer() +// it's up to the individual clients to take action on this; the usual +// game behavior is to leave the lobby and connect to the specified game server +//----------------------------------------------------------------------------- +struct LobbyGameCreated_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 9 }; + + uint64 m_ulSteamIDLobby; // the lobby we were in + uint64 m_ulSteamIDGameServer; // the new game server that has been created or found for the lobby members + uint32 m_unIP; // IP & Port of the game server (if any) + uint16 m_usPort; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Number of matching lobbies found +// iterate the returned lobbies with GetLobbyByIndex(), from values 0 to m_nLobbiesMatching-1 +//----------------------------------------------------------------------------- +struct LobbyMatchList_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 10 }; + uint32 m_nLobbiesMatching; // Number of lobbies that matched search criteria and we have SteamIDs for +}; + + +//----------------------------------------------------------------------------- +// Purpose: posted if a user is forcefully removed from a lobby +// can occur if a user loses connection to Steam +//----------------------------------------------------------------------------- +struct LobbyKicked_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 12 }; + uint64 m_ulSteamIDLobby; // Lobby + uint64 m_ulSteamIDAdmin; // User who kicked you - possibly the ID of the lobby itself + uint8 m_bKickedDueToDisconnect; // true if you were kicked from the lobby due to the user losing connection to Steam (currently always true) +}; + + +//----------------------------------------------------------------------------- +// Purpose: Result of our request to create a Lobby +// m_eResult == k_EResultOK on success +// at this point, the lobby has been joined and is ready for use +// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby) +//----------------------------------------------------------------------------- +struct LobbyCreated_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 13 }; + + EResult m_eResult; // k_EResultOK - the lobby was successfully created + // k_EResultNoConnection - your Steam client doesn't have a connection to the back-end + // k_EResultTimeout - you the message to the Steam servers, but it didn't respond + // k_EResultFail - the server responded, but with an unknown internal error + // k_EResultAccessDenied - your game isn't set to allow lobbies, or your client does haven't rights to play the game + // k_EResultLimitExceeded - your game client has created too many lobbies + + uint64 m_ulSteamIDLobby; // chat room, zero if failed +}; + +// used by now obsolete RequestFriendsLobbiesResponse_t +// enum { k_iCallback = k_iSteamMatchmakingCallbacks + 14 }; + + +//----------------------------------------------------------------------------- +// Purpose: Result of CheckForPSNGameBootInvite +// m_eResult == k_EResultOK on success +// at this point, the local user may not have finishing joining this lobby; +// game code should wait until the subsequent LobbyEnter_t callback is received +//----------------------------------------------------------------------------- +struct PSNGameBootInviteResult_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 15 }; + + bool m_bGameBootInviteExists; + CSteamID m_steamIDLobby; // Should be valid if m_bGameBootInviteExists == true +}; + + +//----------------------------------------------------------------------------- +// Purpose: Result of our request to create a Lobby +// m_eResult == k_EResultOK on success +// at this point, the lobby has been joined and is ready for use +// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby) +//----------------------------------------------------------------------------- +struct FavoritesListAccountsUpdated_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 16 }; + + EResult m_eResult; +}; + +#pragma pack( pop ) + + +#endif // ISTEAMMATCHMAKING diff --git a/public/steam/isteammusic.h b/public/steam/isteammusic.h new file mode 100644 index 000000000..779a4c2eb --- /dev/null +++ b/public/steam/isteammusic.h @@ -0,0 +1,67 @@ +//============ Copyright (c) Valve Corporation, All rights reserved. ============ + +#ifndef ISTEAMMUSIC_H +#define ISTEAMMUSIC_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +enum AudioPlayback_Status +{ + AudioPlayback_Undefined = 0, + AudioPlayback_Playing = 1, + AudioPlayback_Paused = 2, + AudioPlayback_Idle = 3 +}; + + +//----------------------------------------------------------------------------- +// Purpose: Functions to control music playback in the steam client +//----------------------------------------------------------------------------- +class ISteamMusic +{ +public: + virtual bool BIsEnabled() = 0; + virtual bool BIsPlaying() = 0; + + virtual AudioPlayback_Status GetPlaybackStatus() = 0; + + virtual void Play() = 0; + virtual void Pause() = 0; + virtual void PlayPrevious() = 0; + virtual void PlayNext() = 0; + + // volume is between 0.0 and 1.0 + virtual void SetVolume( float flVolume ) = 0; + virtual float GetVolume() = 0; + +}; + +#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 ) + CALLBACK_MEMBER( 0, float, m_flNewVolume ) +END_DEFINE_CALLBACK_1() + +#pragma pack( pop ) + + +#endif // #define ISTEAMMUSIC_H diff --git a/public/steam/isteammusicremote.h b/public/steam/isteammusicremote.h new file mode 100644 index 000000000..ea29a7dee --- /dev/null +++ b/public/steam/isteammusicremote.h @@ -0,0 +1,129 @@ +//============ Copyright (c) Valve Corporation, All rights reserved. ============ + +#ifndef ISTEAMMUSICREMOTE_H +#define ISTEAMMUSICREMOTE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" +#include "isteammusic.h" + +#define k_SteamMusicNameMaxLength 255 +#define k_SteamMusicPNGMaxLength 65535 + + +class ISteamMusicRemote +{ +public: + // Service Definition + virtual bool RegisterSteamMusicRemote( const char *pchName ) = 0; + virtual bool DeregisterSteamMusicRemote() = 0; + virtual bool BIsCurrentMusicRemote() = 0; + virtual bool BActivationSuccess( bool bValue ) = 0; + + virtual bool SetDisplayName( const char *pchDisplayName ) = 0; + virtual bool SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength ) = 0; + + // Abilities for the user interface + virtual bool EnablePlayPrevious(bool bValue) = 0; + virtual bool EnablePlayNext( bool bValue ) = 0; + virtual bool EnableShuffled( bool bValue ) = 0; + virtual bool EnableLooped( bool bValue ) = 0; + virtual bool EnableQueue( bool bValue ) = 0; + virtual bool EnablePlaylists( bool bValue ) = 0; + + // Status + virtual bool UpdatePlaybackStatus( AudioPlayback_Status nStatus ) = 0; + virtual bool UpdateShuffled( bool bValue ) = 0; + virtual bool UpdateLooped( bool bValue ) = 0; + virtual bool UpdateVolume( float flValue ) = 0; // volume is between 0.0 and 1.0 + + // Current Entry + virtual bool CurrentEntryWillChange() = 0; + virtual bool CurrentEntryIsAvailable( bool bAvailable ) = 0; + virtual bool UpdateCurrentEntryText( const char *pchText ) = 0; + virtual bool UpdateCurrentEntryElapsedSeconds( int nValue ) = 0; + virtual bool UpdateCurrentEntryCoverArt( void *pvBuffer, uint32 cbBufferLength ) = 0; + virtual bool CurrentEntryDidChange() = 0; + + // Queue + virtual bool QueueWillChange() = 0; + virtual bool ResetQueueEntries() = 0; + virtual bool SetQueueEntry( int nID, int nPosition, const char *pchEntryText ) = 0; + virtual bool SetCurrentQueueEntry( int nID ) = 0; + virtual bool QueueDidChange() = 0; + + // Playlist + virtual bool PlaylistWillChange() = 0; + virtual bool ResetPlaylistEntries() = 0; + virtual bool SetPlaylistEntry( int nID, int nPosition, const char *pchEntryText ) = 0; + virtual bool SetCurrentPlaylistEntry( int nID ) = 0; + virtual bool PlaylistDidChange() = 0; +}; + +#define STEAMMUSICREMOTE_INTERFACE_VERSION "STEAMMUSICREMOTE_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +DEFINE_CALLBACK( MusicPlayerRemoteWillActivate_t, k_iSteamMusicRemoteCallbacks + 1) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerRemoteWillDeactivate_t, k_iSteamMusicRemoteCallbacks + 2 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerRemoteToFront_t, k_iSteamMusicRemoteCallbacks + 3 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerWillQuit_t, k_iSteamMusicRemoteCallbacks + 4 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerWantsPlay_t, k_iSteamMusicRemoteCallbacks + 5 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerWantsPause_t, k_iSteamMusicRemoteCallbacks + 6 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerWantsPlayPrevious_t, k_iSteamMusicRemoteCallbacks + 7 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerWantsPlayNext_t, k_iSteamMusicRemoteCallbacks + 8 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( MusicPlayerWantsShuffled_t, k_iSteamMusicRemoteCallbacks + 9 ) + CALLBACK_MEMBER( 0, bool, m_bShuffled ) +END_DEFINE_CALLBACK_1() + +DEFINE_CALLBACK( MusicPlayerWantsLooped_t, k_iSteamMusicRemoteCallbacks + 10 ) + CALLBACK_MEMBER(0, bool, m_bLooped ) +END_DEFINE_CALLBACK_1() + +DEFINE_CALLBACK( MusicPlayerWantsVolume_t, k_iSteamMusicCallbacks + 11 ) + CALLBACK_MEMBER(0, float, m_flNewVolume) +END_DEFINE_CALLBACK_1() + +DEFINE_CALLBACK( MusicPlayerSelectsQueueEntry_t, k_iSteamMusicCallbacks + 12 ) + CALLBACK_MEMBER(0, int, nID ) +END_DEFINE_CALLBACK_1() + +DEFINE_CALLBACK( MusicPlayerSelectsPlaylistEntry_t, k_iSteamMusicCallbacks + 13 ) + CALLBACK_MEMBER(0, int, nID ) +END_DEFINE_CALLBACK_1() + +DEFINE_CALLBACK( MusicPlayerWantsPlayingRepeatStatus_t, k_iSteamMusicRemoteCallbacks + 14 ) + CALLBACK_MEMBER(0, int, m_nPlayingRepeatStatus ) +END_DEFINE_CALLBACK_1() + +#pragma pack( pop ) + + + +#endif // #define ISTEAMMUSICREMOTE_H diff --git a/public/steam/isteamnetworking.h b/public/steam/isteamnetworking.h new file mode 100644 index 000000000..c77f7bf77 --- /dev/null +++ b/public/steam/isteamnetworking.h @@ -0,0 +1,306 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: interface to steam managing network connections between game clients & servers +// +//============================================================================= + +#ifndef ISTEAMNETWORKING +#define ISTEAMNETWORKING +#ifdef _WIN32 +#pragma once +#endif + +#include "steamtypes.h" +#include "steamclientpublic.h" + + +// list of possible errors returned by SendP2PPacket() API +// these will be posted in the P2PSessionConnectFail_t callback +enum EP2PSessionError +{ + k_EP2PSessionErrorNone = 0, + k_EP2PSessionErrorNotRunningApp = 1, // target is not running the same game + k_EP2PSessionErrorNoRightsToApp = 2, // local user doesn't own the app that is running + k_EP2PSessionErrorDestinationNotLoggedIn = 3, // target user isn't connected to Steam + k_EP2PSessionErrorTimeout = 4, // target isn't responding, perhaps not calling AcceptP2PSessionWithUser() + // corporate firewalls can also block this (NAT traversal is not firewall traversal) + // make sure that UDP ports 3478, 4379, and 4380 are open in an outbound direction + k_EP2PSessionErrorMax = 5 +}; + +// SendP2PPacket() send types +// Typically k_EP2PSendUnreliable is what you want for UDP-like packets, k_EP2PSendReliable for TCP-like packets +enum EP2PSend +{ + // Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare). + // The sending API does have some knowledge of the underlying connection, so if there is no NAT-traversal accomplished or + // there is a recognized adjustment happening on the connection, the packet will be batched until the connection is open again. + k_EP2PSendUnreliable = 0, + + // As above, but if the underlying p2p connection isn't yet established the packet will just be thrown away. Using this on the first + // packet sent to a remote host almost guarantees the packet will be dropped. + // This is only really useful for kinds of data that should never buffer up, i.e. voice payload packets + k_EP2PSendUnreliableNoDelay = 1, + + // Reliable message send. Can send up to 1MB of data in a single message. + // Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for efficient sends of large chunks of data. + k_EP2PSendReliable = 2, + + // As above, but applies the Nagle algorithm to the send - sends will accumulate + // until the current MTU size (typically ~1200 bytes, but can change) or ~200ms has passed (Nagle algorithm). + // Useful if you want to send a set of smaller messages but have the coalesced into a single packet + // Since the reliable stream is all ordered, you can do several small message sends with k_EP2PSendReliableWithBuffering and then + // do a normal k_EP2PSendReliable to force all the buffered data to be sent. + k_EP2PSendReliableWithBuffering = 3, + +}; + + +// connection state to a specified user, returned by GetP2PSessionState() +// this is under-the-hood info about what's going on with a SendP2PPacket(), shouldn't be needed except for debuggin +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif +struct P2PSessionState_t +{ + uint8 m_bConnectionActive; // true if we've got an active open connection + uint8 m_bConnecting; // true if we're currently trying to establish a connection + uint8 m_eP2PSessionError; // last error recorded (see enum above) + uint8 m_bUsingRelay; // true if it's going through a relay server (TURN) + int32 m_nBytesQueuedForSend; + int32 m_nPacketsQueuedForSend; + uint32 m_nRemoteIP; // potential IP:Port of remote host. Could be TURN server. + uint16 m_nRemotePort; // Only exists for compatibility with older authentication api's +}; +#pragma pack( pop ) + + +// handle to a socket +typedef uint32 SNetSocket_t; // CreateP2PConnectionSocket() +typedef uint32 SNetListenSocket_t; // CreateListenSocket() + +// connection progress indicators, used by CreateP2PConnectionSocket() +enum ESNetSocketState +{ + k_ESNetSocketStateInvalid = 0, + + // communication is valid + k_ESNetSocketStateConnected = 1, + + // states while establishing a connection + k_ESNetSocketStateInitiated = 10, // the connection state machine has started + + // p2p connections + k_ESNetSocketStateLocalCandidatesFound = 11, // we've found our local IP info + k_ESNetSocketStateReceivedRemoteCandidates = 12,// we've received information from the remote machine, via the Steam back-end, about their IP info + + // direct connections + k_ESNetSocketStateChallengeHandshake = 15, // we've received a challenge packet from the server + + // failure states + k_ESNetSocketStateDisconnecting = 21, // the API shut it down, and we're in the process of telling the other end + k_ESNetSocketStateLocalDisconnect = 22, // the API shut it down, and we've completed shutdown + k_ESNetSocketStateTimeoutDuringConnect = 23, // we timed out while trying to creating the connection + k_ESNetSocketStateRemoteEndDisconnected = 24, // the remote end has disconnected from us + k_ESNetSocketStateConnectionBroken = 25, // connection has been broken; either the other end has disappeared or our local network connection has broke + +}; + +// describes how the socket is currently connected +enum ESNetSocketConnectionType +{ + k_ESNetSocketConnectionTypeNotConnected = 0, + k_ESNetSocketConnectionTypeUDP = 1, + k_ESNetSocketConnectionTypeUDPRelay = 2, +}; + + +//----------------------------------------------------------------------------- +// Purpose: Functions for making connections and sending data between clients, +// traversing NAT's where possible +//----------------------------------------------------------------------------- +class ISteamNetworking +{ +public: + //////////////////////////////////////////////////////////////////////////////////////////// + // Session-less connection functions + // automatically establishes NAT-traversing or Relay server connections + + // Sends a P2P packet to the specified user + // UDP-like, unreliable and a max packet size of 1200 bytes + // the first packet send may be delayed as the NAT-traversal code runs + // if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t + // see EP2PSend enum above for the descriptions of the different ways of sending packets + // + // nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket() + // with the same channel number in order to retrieve the data on the other end + // using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources + virtual bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0 ) = 0; + + // returns true if any data is available for read, and the amount of data that will need to be read + virtual bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel = 0 ) = 0; + + // reads in a packet that has been sent from another user via SendP2PPacket() + // returns the size of the message and the steamID of the user who sent it in the last two parameters + // if the buffer passed in is too small, the message will be truncated + // this call is not blocking, and will return false if no data is available + virtual bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel = 0 ) = 0; + + // AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback + // P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet + // if you don't want to talk to the user, just ignore the request + // if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically + // this may be called multiple times for a single user + // (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request) + virtual bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) = 0; + + // call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood + // if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted + virtual bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) = 0; + + // call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels + // open channels to a user have been closed, the open session to the user will be closed and new data from this + // user will trigger a P2PSessionRequest_t callback + virtual bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) = 0; + + // fills out P2PSessionState_t structure with details about the underlying connection to the user + // should only needed for debugging purposes + // returns false if no connection exists to the specified user + virtual bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) = 0; + + // Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection + // or NAT-traversal cannot be established. Only applies to connections created after setting this value, + // or to existing connections that need to automatically reconnect after this value is set. + // + // P2P packet relay is allowed by default + virtual bool AllowP2PPacketRelay( bool bAllow ) = 0; + + + //////////////////////////////////////////////////////////////////////////////////////////// + // LISTEN / CONNECT style interface functions + // + // This is an older set of functions designed around the Berkeley TCP sockets model + // it's preferential that you use the above P2P functions, they're more robust + // and these older functions will be removed eventually + // + //////////////////////////////////////////////////////////////////////////////////////////// + + + // creates a socket and listens others to connect + // will trigger a SocketStatusCallback_t callback on another client connecting + // nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports + // this can usually just be 0 unless you want multiple sets of connections + // unIP is the local IP address to bind to + // pass in 0 if you just want the default local IP + // unPort is the port to use + // pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only + virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0; + + // creates a socket and begin connection to a remote destination + // can connect via a known steamID (client or game server), or directly to an IP + // on success will trigger a SocketStatusCallback_t callback + // on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState + virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0; + virtual SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 0; + + // disconnects the connection to the socket, if any, and invalidates the handle + // any unread data on the socket will be thrown away + // if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect + virtual bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) = 0; + // destroying a listen socket will automatically kill all the regular sockets generated from it + virtual bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) = 0; + + // sending data + // must be a handle to a connected socket + // data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets + // use the reliable flag with caution; although the resend rate is pretty aggressive, + // it can still cause stalls in receiving data (like TCP) + virtual bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) = 0; + + // receiving data + // returns false if there is no data remaining + // fills out *pcubMsgSize with the size of the next message, in bytes + virtual bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) = 0; + + // fills in pubDest with the contents of the message + // messages are always complete, of the same size as was sent (i.e. packetized, not streaming) + // if *pcubMsgSize < cubDest, only partial data is written + // returns false if no data is available + virtual bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0; + + // checks for data from any socket that has been connected off this listen socket + // returns false if there is no data remaining + // fills out *pcubMsgSize with the size of the next message, in bytes + // fills out *phSocket with the socket that data is available on + virtual bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0; + + // retrieves data from any socket that has been connected off this listen socket + // fills in pubDest with the contents of the message + // messages are always complete, of the same size as was sent (i.e. packetized, not streaming) + // if *pcubMsgSize < cubDest, only partial data is written + // returns false if no data is available + // fills out *phSocket with the socket that data is available on + virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0; + + // returns information about the specified socket, filling out the contents of the pointers + virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote ) = 0; + + // returns which local port the listen socket is bound to + // *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only + virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) = 0; + + // returns true to describe how the socket ended up connecting + virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0; + + // max packet size, in bytes + virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0; +}; +#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking005" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +// callback notification - a user wants to talk to us over the P2P channel via the SendP2PPacket() API +// in response, a call to AcceptP2PPacketsFromUser() needs to be made, if you want to talk with them +struct P2PSessionRequest_t +{ + enum { k_iCallback = k_iSteamNetworkingCallbacks + 2 }; + CSteamID m_steamIDRemote; // user who wants to talk to us +}; + + +// callback notification - packets can't get through to the specified user via the SendP2PPacket() API +// all packets queued packets unsent at this point will be dropped +// further attempts to send will retry making the connection (but will be dropped if we fail again) +struct P2PSessionConnectFail_t +{ + enum { k_iCallback = k_iSteamNetworkingCallbacks + 3 }; + CSteamID m_steamIDRemote; // user we were sending packets to + uint8 m_eP2PSessionError; // EP2PSessionError indicating why we're having trouble +}; + + +// callback notification - status of a socket has changed +// used as part of the CreateListenSocket() / CreateP2PConnectionSocket() +struct SocketStatusCallback_t +{ + enum { k_iCallback = k_iSteamNetworkingCallbacks + 1 }; + SNetSocket_t m_hSocket; // the socket used to send/receive data to the remote host + SNetListenSocket_t m_hListenSocket; // this is the server socket that we were listening on; NULL if this was an outgoing connection + CSteamID m_steamIDRemote; // remote steamID we have connected to, if it has one + int m_eSNetSocketState; // socket state, ESNetSocketState +}; + +#pragma pack( pop ) + +#endif // ISTEAMNETWORKING diff --git a/public/steam/isteamps3overlayrenderer.h b/public/steam/isteamps3overlayrenderer.h new file mode 100644 index 000000000..5c410d829 --- /dev/null +++ b/public/steam/isteamps3overlayrenderer.h @@ -0,0 +1,91 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: interface the game must provide Steam with on PS3 in order for the +// Steam overlay to render. +// +//============================================================================= + +#ifndef ISTEAMPS3OVERLAYRENDERER_H +#define ISTEAMPS3OVERLAYRENDERER_H +#ifdef _WIN32 +#pragma once +#endif + +#include "cell/pad.h" + +//----------------------------------------------------------------------------- +// Purpose: Enum for supported gradient directions +//----------------------------------------------------------------------------- +enum EOverlayGradientDirection +{ + k_EOverlayGradientHorizontal = 1, + k_EOverlayGradientVertical = 2, + k_EOverlayGradientNone = 3, +}; + +// Helpers for fetching individual color components from ARGB packed DWORD colors Steam PS3 overlay renderer uses. +#define STEAM_COLOR_RED( color ) \ + (int)(((color)>>16)&0xff) + +#define STEAM_COLOR_GREEN( color ) \ + (int)(((color)>>8)&0xff) + +#define STEAM_COLOR_BLUE( color ) \ + (int)((color)&0xff) + +#define STEAM_COLOR_ALPHA( color ) \ + (int)(((color)>>24)&0xff) + + +//----------------------------------------------------------------------------- +// Purpose: Interface the game must expose to Steam for rendering +//----------------------------------------------------------------------------- +class ISteamPS3OverlayRenderHost +{ +public: + + // Interface for game engine to implement which Steam requires to render. + + // Draw a textured rect. This may use only part of the texture and will pass texture coords, it will also possibly request a gradient and will specify colors for vertexes. + virtual void DrawTexturedRect( int x0, int y0, int x1, int y1, float u0, float v0, float u1, float v1, int32 iTextureID, DWORD colorStart, DWORD colorEnd, EOverlayGradientDirection eDirection ) = 0; + + // Load a RGBA texture for Steam, or update a previously loaded one. Updates may be partial. You must not evict or remove this texture once Steam has uploaded it. + virtual void LoadOrUpdateTexture( int32 iTextureID, bool bIsFullTexture, int x0, int y0, uint32 uWidth, uint32 uHeight, int32 iBytes, char *pData ) = 0; + + // Delete a texture Steam previously uploaded + virtual void DeleteTexture( int32 iTextureID ) = 0; + + // Delete all previously uploaded textures + virtual void DeleteAllTextures() = 0; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Interface Steam exposes for the game to tell it when to render, etc. +//----------------------------------------------------------------------------- +class ISteamPS3OverlayRender +{ +public: + + // Call once at startup to initialize the Steam overlay and pass it your host interface ptr + virtual bool BHostInitialize( uint32 unScreenWidth, uint32 unScreenHeight, uint32 unRefreshRate, ISteamPS3OverlayRenderHost *pRenderHost, void *CellFontLib ) = 0; + + // Call this once a frame when you are ready for the Steam overlay to render (ie, right before flipping buffers, after all your rendering) + virtual void Render() = 0; + + // Call this everytime you read input on PS3. + // + // If this returns true, then the overlay is active and has consumed the input, your game + // should then ignore all the input until BHandleCellPadData once again returns false, which + // will mean the overlay is deactivated. + virtual bool BHandleCellPadData( const CellPadData &padData ) = 0; + + // Call this if you detect no controllers connected or that the XMB is intercepting input + // + // This is important to clear input state for the overlay, so keys left down during XMB activation + // are not continued to be processed. + virtual bool BResetInputState() = 0; +}; + + +#endif // ISTEAMPS3OVERLAYRENDERER_H \ No newline at end of file diff --git a/public/steam/isteamremotestorage.h b/public/steam/isteamremotestorage.h new file mode 100644 index 000000000..cce39dfe0 --- /dev/null +++ b/public/steam/isteamremotestorage.h @@ -0,0 +1,675 @@ +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: public interface to user remote file storage in Steam +// +//============================================================================= + +#ifndef ISTEAMREMOTESTORAGE_H +#define ISTEAMREMOTESTORAGE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + + +//----------------------------------------------------------------------------- +// Purpose: Defines the largest allowed file size. Cloud files cannot be written +// in a single chunk over 100MB (and cannot be over 200MB total.) +//----------------------------------------------------------------------------- +const uint32 k_unMaxCloudFileChunkSize = 100 * 1024 * 1024; + + +//----------------------------------------------------------------------------- +// Purpose: Structure that contains an array of const char * strings and the number of those strings +//----------------------------------------------------------------------------- +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif +struct SteamParamStringArray_t +{ + const char ** m_ppStrings; + int32 m_nNumStrings; +}; +#pragma pack( pop ) + +// A handle to a piece of user generated content +typedef uint64 UGCHandle_t; +typedef uint64 PublishedFileUpdateHandle_t; +typedef uint64 PublishedFileId_t; +const PublishedFileId_t k_PublishedFileIdInvalid = 0; +const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull; +const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull; + +// Handle for writing to Steam Cloud +typedef uint64 UGCFileWriteStreamHandle_t; +const UGCFileWriteStreamHandle_t k_UGCFileStreamHandleInvalid = 0xffffffffffffffffull; + +const uint32 k_cchPublishedDocumentTitleMax = 128 + 1; +const uint32 k_cchPublishedDocumentDescriptionMax = 8000; +const uint32 k_cchPublishedDocumentChangeDescriptionMax = 8000; +const uint32 k_unEnumeratePublishedFilesMaxResults = 50; +const uint32 k_cchTagListMax = 1024 + 1; +const uint32 k_cchFilenameMax = 260; +const uint32 k_cchPublishedFileURLMax = 256; + +// Ways to handle a synchronization conflict +enum EResolveConflict +{ + k_EResolveConflictKeepClient = 1, // The local version of each file will be used to overwrite the server version + k_EResolveConflictKeepServer = 2, // The server version of each file will be used to overwrite the local version +}; + +enum ERemoteStoragePlatform +{ + k_ERemoteStoragePlatformNone = 0, + k_ERemoteStoragePlatformWindows = (1 << 0), + k_ERemoteStoragePlatformOSX = (1 << 1), + k_ERemoteStoragePlatformPS3 = (1 << 2), + k_ERemoteStoragePlatformLinux = (1 << 3), + k_ERemoteStoragePlatformReserved2 = (1 << 4), + + k_ERemoteStoragePlatformAll = 0xffffffff +}; + +enum ERemoteStoragePublishedFileVisibility +{ + k_ERemoteStoragePublishedFileVisibilityPublic = 0, + k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1, + k_ERemoteStoragePublishedFileVisibilityPrivate = 2, +}; + + +enum EWorkshopFileType +{ + k_EWorkshopFileTypeFirst = 0, + + k_EWorkshopFileTypeCommunity = 0, // normal Workshop item that can be subscribed to + k_EWorkshopFileTypeMicrotransaction = 1, // Workshop item that is meant to be voted on for the purpose of selling in-game + k_EWorkshopFileTypeCollection = 2, // a collection of Workshop or Greenlight items + k_EWorkshopFileTypeArt = 3, // artwork + k_EWorkshopFileTypeVideo = 4, // external video + k_EWorkshopFileTypeScreenshot = 5, // screenshot + k_EWorkshopFileTypeGame = 6, // Greenlight game entry + k_EWorkshopFileTypeSoftware = 7, // Greenlight software entry + k_EWorkshopFileTypeConcept = 8, // Greenlight concept + k_EWorkshopFileTypeWebGuide = 9, // Steam web guide + k_EWorkshopFileTypeIntegratedGuide = 10, // application integrated guide + k_EWorkshopFileTypeMerch = 11, // Workshop merchandise meant to be voted on for the purpose of being sold + k_EWorkshopFileTypeControllerBinding = 12, // Steam Controller bindings + k_EWorkshopFileTypeSteamworksAccessInvite = 13, // internal + k_EWorkshopFileTypeSteamVideo = 14, // Steam video + k_EWorkshopFileTypeGameManagedItem = 15, // managed completely by the game, not the user, and not shown on the web + + // Update k_EWorkshopFileTypeMax if you add values. + k_EWorkshopFileTypeMax = 16 + +}; + +enum EWorkshopVote +{ + k_EWorkshopVoteUnvoted = 0, + k_EWorkshopVoteFor = 1, + k_EWorkshopVoteAgainst = 2, + k_EWorkshopVoteLater = 3, +}; + +enum EWorkshopFileAction +{ + k_EWorkshopFileActionPlayed = 0, + k_EWorkshopFileActionCompleted = 1, +}; + +enum EWorkshopEnumerationType +{ + k_EWorkshopEnumerationTypeRankedByVote = 0, + k_EWorkshopEnumerationTypeRecent = 1, + k_EWorkshopEnumerationTypeTrending = 2, + k_EWorkshopEnumerationTypeFavoritesOfFriends = 3, + k_EWorkshopEnumerationTypeVotedByFriends = 4, + k_EWorkshopEnumerationTypeContentByFriends = 5, + k_EWorkshopEnumerationTypeRecentFromFollowedUsers = 6, +}; + +enum EWorkshopVideoProvider +{ + k_EWorkshopVideoProviderNone = 0, + k_EWorkshopVideoProviderYoutube = 1 +}; + + +enum EUGCReadAction +{ + // Keeps the file handle open unless the last byte is read. You can use this when reading large files (over 100MB) in sequential chunks. + // If the last byte is read, this will behave the same as k_EUGCRead_Close. Otherwise, it behaves the same as k_EUGCRead_ContinueReading. + // This value maintains the same behavior as before the EUGCReadAction parameter was introduced. + k_EUGCRead_ContinueReadingUntilFinished = 0, + + // Keeps the file handle open. Use this when using UGCRead to seek to different parts of the file. + // When you are done seeking around the file, make a final call with k_EUGCRead_Close to close it. + k_EUGCRead_ContinueReading = 1, + + // Frees the file handle. Use this when you're done reading the content. + // To read the file from Steam again you will need to call UGCDownload again. + k_EUGCRead_Close = 2, +}; + + +//----------------------------------------------------------------------------- +// Purpose: Functions for accessing, reading and writing files stored remotely +// and cached locally +//----------------------------------------------------------------------------- +class ISteamRemoteStorage +{ + public: + // NOTE + // + // Filenames are case-insensitive, and will be converted to lowercase automatically. + // So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then + // iterate the files, the filename returned will be "foo.bar". + // + + // file operations + virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0; + virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0; + + virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0; + + virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0; + virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0; + + virtual bool FileForget( const char *pchFile ) = 0; + virtual bool FileDelete( const char *pchFile ) = 0; + virtual SteamAPICall_t FileShare( const char *pchFile ) = 0; + virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0; + + // file operations that cause network IO + virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0; + virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0; + virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0; + virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0; + + // file information + virtual bool FileExists( const char *pchFile ) = 0; + virtual bool FilePersisted( const char *pchFile ) = 0; + virtual int32 GetFileSize( const char *pchFile ) = 0; + virtual int64 GetFileTimestamp( const char *pchFile ) = 0; + virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0; + + // iteration + virtual int32 GetFileCount() = 0; + virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0; + + // configuration management + virtual bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes ) = 0; + virtual bool IsCloudEnabledForAccount() = 0; + virtual bool IsCloudEnabledForApp() = 0; + virtual void SetCloudEnabledForApp( bool bEnabled ) = 0; + + // user generated content + + // Downloads a UGC file. A priority value of 0 will download the file immediately, + // otherwise it will wait to download the file until all downloads with a lower priority + // value are completed. Downloads with equal priority will occur simultaneously. + virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0; + + // Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false + // or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage + virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0; + + // Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result + virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, char **ppchName, int32 *pnFileSizeInBytes, OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0; + + // After download, gets the content of the file. + // Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file. + // Larger files can be read in chunks to reduce memory usage (since both sides of the IPC client and the game itself must allocate + // enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail + // unless UGCDownload is called again. + // For especially large files (anything over 100MB) it is a requirement that the file is read in chunks. + virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0; + + // Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead() + virtual int32 GetCachedUGCCount() = 0; + virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0; + + // The following functions are only necessary on the Playstation 3. On PC & Mac, the Steam client will handle these operations for you + // On Playstation 3, the game controls which files are stored in the cloud, via FilePersist, FileFetch, and FileForget. + +#if defined(_PS3) || defined(_SERVER) + // Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback + virtual void GetFileListFromServer() = 0; + // Indicate this file should be downloaded in the next sync + virtual bool FileFetch( const char *pchFile ) = 0; + // Indicate this file should be persisted in the next sync + virtual bool FilePersist( const char *pchFile ) = 0; + // Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback + virtual bool SynchronizeToClient() = 0; + // Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback + virtual bool SynchronizeToServer() = 0; + // Reset any fetch/persist/etc requests + virtual bool ResetFileRequestState() = 0; +#endif + + // publishing UGC + virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0; + virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0; + virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0; + virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0; + virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0; + virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0; + virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; + virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0; + virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0; + // Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0, + // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh. + // A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is. + virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0; + virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; + // enumerate the files that the current user published with this app + virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0; + virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; + virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0; + virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; + virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0; + virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0; + virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0; + virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0; + virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0; + virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0; + virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0; + virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0; + // this method enumerates the public view of workshop files + virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0; + + virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0; +}; + +#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION013" + + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// Purpose: sent when the local file cache is fully synced with the server for an app +// That means that an application can be started and has all latest files +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncedClient_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 1 }; + AppId_t m_nAppID; + EResult m_eResult; + int m_unNumDownloads; +}; + +//----------------------------------------------------------------------------- +// Purpose: sent when the server is fully synced with the local file cache for an app +// That means that we can shutdown Steam and our data is stored on the server +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncedServer_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 2 }; + AppId_t m_nAppID; + EResult m_eResult; + int m_unNumUploads; +}; + +//----------------------------------------------------------------------------- +// Purpose: Status of up and downloads during a sync session +// +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncProgress_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 3 }; + char m_rgchCurrentFile[k_cchFilenameMax]; // Current file being transferred + AppId_t m_nAppID; // App this info relates to + uint32 m_uBytesTransferredThisChunk; // Bytes transferred this chunk + double m_dAppPercentComplete; // Percent complete that this app's transfers are + bool m_bUploading; // if false, downloading +}; + +// +// IMPORTANT! k_iClientRemoteStorageCallbacks + 4 is used, see iclientremotestorage.h +// + + +//----------------------------------------------------------------------------- +// Purpose: Sent after we've determined the list of files that are out of sync +// with the server. +//----------------------------------------------------------------------------- +struct RemoteStorageAppSyncStatusCheck_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 5 }; + AppId_t m_nAppID; + EResult m_eResult; +}; + +//----------------------------------------------------------------------------- +// Purpose: Sent after a conflict resolution attempt. +//----------------------------------------------------------------------------- +struct RemoteStorageConflictResolution_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 6 }; + AppId_t m_nAppID; + EResult m_eResult; +}; + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to FileShare() +//----------------------------------------------------------------------------- +struct RemoteStorageFileShareResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 }; + EResult m_eResult; // The result of the operation + UGCHandle_t m_hFile; // The handle that can be shared with users and features + char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared +}; + + +// k_iClientRemoteStorageCallbacks + 8 is deprecated! Do not reuse + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to PublishFile() +//----------------------------------------------------------------------------- +struct RemoteStoragePublishFileResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 9 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; + bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to DeletePublishedFile() +//----------------------------------------------------------------------------- +struct RemoteStorageDeletePublishedFileResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 11 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to EnumerateUserPublishedFiles() +//----------------------------------------------------------------------------- +struct RemoteStorageEnumerateUserPublishedFilesResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 12 }; + EResult m_eResult; // The result of the operation. + int32 m_nResultsReturned; + int32 m_nTotalResultCount; + PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to SubscribePublishedFile() +//----------------------------------------------------------------------------- +struct RemoteStorageSubscribePublishedFileResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 13 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to EnumerateSubscribePublishedFiles() +//----------------------------------------------------------------------------- +struct RemoteStorageEnumerateUserSubscribedFilesResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 14 }; + EResult m_eResult; // The result of the operation. + int32 m_nResultsReturned; + int32 m_nTotalResultCount; + PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; + uint32 m_rgRTimeSubscribed[ k_unEnumeratePublishedFilesMaxResults ]; +}; + +#if defined(VALVE_CALLBACK_PACK_SMALL) + VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 ); +#elif defined(VALVE_CALLBACK_PACK_LARGE) + VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 + 4 ); +#else +#warning You must first include isteamclient.h +#endif + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to UnsubscribePublishedFile() +//----------------------------------------------------------------------------- +struct RemoteStorageUnsubscribePublishedFileResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 15 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to CommitPublishedFileUpdate() +//----------------------------------------------------------------------------- +struct RemoteStorageUpdatePublishedFileResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 16 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; + bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to UGCDownload() +//----------------------------------------------------------------------------- +struct RemoteStorageDownloadUGCResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 17 }; + EResult m_eResult; // The result of the operation. + UGCHandle_t m_hFile; // The handle to the file that was attempted to be downloaded. + AppId_t m_nAppID; // ID of the app that created this file. + int32 m_nSizeInBytes; // The size of the file that was downloaded, in bytes. + char m_pchFileName[k_cchFilenameMax]; // The name of the file that was downloaded. + uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to GetPublishedFileDetails() +//----------------------------------------------------------------------------- +struct RemoteStorageGetPublishedFileDetailsResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 18 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; + AppId_t m_nCreatorAppID; // ID of the app that created this file. + AppId_t m_nConsumerAppID; // ID of the app that will consume this file. + char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document + char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document + UGCHandle_t m_hFile; // The handle of the primary file + UGCHandle_t m_hPreviewFile; // The handle of the preview file + uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. + uint32 m_rtimeCreated; // time when the published file was created + uint32 m_rtimeUpdated; // time when the published file was last updated + ERemoteStoragePublishedFileVisibility m_eVisibility; + bool m_bBanned; + char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file + bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer + char m_pchFileName[k_cchFilenameMax]; // The name of the primary file + int32 m_nFileSize; // Size of the primary file + int32 m_nPreviewFileSize; // Size of the preview file + char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) + EWorkshopFileType m_eFileType; // Type of the file + bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop +}; + + +struct RemoteStorageEnumerateWorkshopFilesResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 19 }; + EResult m_eResult; + int32 m_nResultsReturned; + int32 m_nTotalResultCount; + PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; + float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ]; + AppId_t m_nAppId; + uint32 m_unStartIndex; +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of GetPublishedItemVoteDetails +//----------------------------------------------------------------------------- +struct RemoteStorageGetPublishedItemVoteDetailsResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 20 }; + EResult m_eResult; + PublishedFileId_t m_unPublishedFileId; + int32 m_nVotesFor; + int32 m_nVotesAgainst; + int32 m_nReports; + float m_fScore; +}; + + +//----------------------------------------------------------------------------- +// Purpose: User subscribed to a file for the app (from within the app or on the web) +//----------------------------------------------------------------------------- +struct RemoteStoragePublishedFileSubscribed_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 21 }; + PublishedFileId_t m_nPublishedFileId; // The published file id + AppId_t m_nAppID; // ID of the app that will consume this file. +}; + +//----------------------------------------------------------------------------- +// Purpose: User unsubscribed from a file for the app (from within the app or on the web) +//----------------------------------------------------------------------------- +struct RemoteStoragePublishedFileUnsubscribed_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 22 }; + PublishedFileId_t m_nPublishedFileId; // The published file id + AppId_t m_nAppID; // ID of the app that will consume this file. +}; + + +//----------------------------------------------------------------------------- +// Purpose: Published file that a user owns was deleted (from within the app or the web) +//----------------------------------------------------------------------------- +struct RemoteStoragePublishedFileDeleted_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 23 }; + PublishedFileId_t m_nPublishedFileId; // The published file id + AppId_t m_nAppID; // ID of the app that will consume this file. +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to UpdateUserPublishedItemVote() +//----------------------------------------------------------------------------- +struct RemoteStorageUpdateUserPublishedItemVoteResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 24 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; // The published file id +}; + + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to GetUserPublishedItemVoteDetails() +//----------------------------------------------------------------------------- +struct RemoteStorageUserVoteDetails_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 25 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; // The published file id + EWorkshopVote m_eVote; // what the user voted +}; + +struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 26 }; + EResult m_eResult; // The result of the operation. + int32 m_nResultsReturned; + int32 m_nTotalResultCount; + PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; +}; + +struct RemoteStorageSetUserPublishedFileActionResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 27 }; + EResult m_eResult; // The result of the operation. + PublishedFileId_t m_nPublishedFileId; // The published file id + EWorkshopFileAction m_eAction; // the action that was attempted +}; + +struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 28 }; + EResult m_eResult; // The result of the operation. + EWorkshopFileAction m_eAction; // the action that was filtered on + int32 m_nResultsReturned; + int32 m_nTotalResultCount; + PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; + uint32 m_rgRTimeUpdated[ k_unEnumeratePublishedFilesMaxResults ]; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Called periodically while a PublishWorkshopFile is in progress +//----------------------------------------------------------------------------- +struct RemoteStoragePublishFileProgress_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 29 }; + double m_dPercentFile; + bool m_bPreview; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Called when the content for a published file is updated +//----------------------------------------------------------------------------- +struct RemoteStoragePublishedFileUpdated_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 30 }; + PublishedFileId_t m_nPublishedFileId; // The published file id + AppId_t m_nAppID; // ID of the app that will consume this file. + UGCHandle_t m_hFile; // The new content +}; + +//----------------------------------------------------------------------------- +// Purpose: Called when a FileWriteAsync completes +//----------------------------------------------------------------------------- +struct RemoteStorageFileWriteAsyncComplete_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 31 }; + EResult m_eResult; // result +}; + +//----------------------------------------------------------------------------- +// Purpose: Called when a FileReadAsync completes +//----------------------------------------------------------------------------- +struct RemoteStorageFileReadAsyncComplete_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 32 }; + SteamAPICall_t m_hFileReadAsync; // call handle of the async read which was made + EResult m_eResult; // result + uint32 m_nOffset; // offset in the file this read was at + uint32 m_cubRead; // amount read - will the <= the amount requested +}; + +#pragma pack( pop ) + + +#endif // ISTEAMREMOTESTORAGE_H diff --git a/public/steam/isteamscreenshots.h b/public/steam/isteamscreenshots.h new file mode 100644 index 000000000..1636c1603 --- /dev/null +++ b/public/steam/isteamscreenshots.h @@ -0,0 +1,96 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: public interface to user remote file storage in Steam +// +//============================================================================= + +#ifndef ISTEAMSCREENSHOTS_H +#define ISTEAMSCREENSHOTS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +const uint32 k_nScreenshotMaxTaggedUsers = 32; +const uint32 k_nScreenshotMaxTaggedPublishedFiles = 32; +const int k_cubUFSTagTypeMax = 255; +const int k_cubUFSTagValueMax = 255; + +// Required with of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail +// one will be generated. +const int k_ScreenshotThumbWidth = 200; + +// Handle is valid for the lifetime of your process and no longer +typedef uint32 ScreenshotHandle; +#define INVALID_SCREENSHOT_HANDLE 0 + +//----------------------------------------------------------------------------- +// Purpose: Functions for adding screenshots to the user's screenshot library +//----------------------------------------------------------------------------- +class ISteamScreenshots +{ +public: + // Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format. + // The return value is a handle that is valid for the duration of the game process and can be used to apply tags. + virtual ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight ) = 0; + + // Adds a screenshot to the user's screenshot library from disk. If a thumbnail is provided, it must be 200 pixels wide and the same aspect ratio + // as the screenshot, otherwise a thumbnail will be generated if the user uploads the screenshot. The screenshots must be in either JPEG or TGA format. + // The return value is a handle that is valid for the duration of the game process and can be used to apply tags. + // JPEG, TGA, and PNG formats are supported. + virtual ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight ) = 0; + + // Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead. + virtual void TriggerScreenshot() = 0; + + // Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots, + // then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary + // in response. + virtual void HookScreenshots( bool bHook ) = 0; + + // Sets metadata about a screenshot's location (for example, the name of the map) + virtual bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) = 0; + + // Tags a user as being visible in the screenshot + virtual bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) = 0; + + // Tags a published file as being visible in the screenshot + virtual bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID ) = 0; +}; + +#define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION002" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif +//----------------------------------------------------------------------------- +// Purpose: Screenshot successfully written or otherwise added to the library +// and can now be tagged +//----------------------------------------------------------------------------- +struct ScreenshotReady_t +{ + enum { k_iCallback = k_iSteamScreenshotsCallbacks + 1 }; + ScreenshotHandle m_hLocal; + EResult m_eResult; +}; + +//----------------------------------------------------------------------------- +// Purpose: Screenshot has been requested by the user. Only sent if +// HookScreenshots() has been called, in which case Steam will not take +// the screenshot itself. +//----------------------------------------------------------------------------- +struct ScreenshotRequested_t +{ + enum { k_iCallback = k_iSteamScreenshotsCallbacks + 2 }; +}; + +#pragma pack( pop ) + + +#endif // ISTEAMSCREENSHOTS_H diff --git a/public/steam/isteamstreamlauncher.h b/public/steam/isteamstreamlauncher.h new file mode 100644 index 000000000..5f258667a --- /dev/null +++ b/public/steam/isteamstreamlauncher.h @@ -0,0 +1,85 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: interface to streaming launcher functions in Steam +// +//============================================================================= + +#ifndef ISTEAMSTREAMLAUNCHER_H +#define ISTEAMSTREAMLAUNCHER_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +enum EStreamLauncherResult +{ + k_EStreamLaunchResultSuccess = 0, + k_EStreamLaunchResultFailure = 1, // Unknown streaming launch failure + k_EStreamLaunchResultAlreadyStreaming = 2, // The UI is already streaming to a different application + k_EStreamLaunchResultInvalidLauncher = 3, // The streaming launcher doesn't exist, or failed signature check + k_EStreamLaunchResultNotReady = 4, // The UI isn't ready to go into streaming mode (Desktop UI login?) +}; + +//----------------------------------------------------------------------------- +// Purpose: interface to streaming launcher functions in Steam +//----------------------------------------------------------------------------- +class ISteamStreamLauncher +{ +public: + // Switch Steam to Big Picture mode and optionally set a launcher to run all games + virtual EStreamLauncherResult StartStreaming( const char *pchLauncher = NULL ) = 0; + + // Switch Steam back to the original mode and clear the launcher + virtual void StopStreaming() = 0; +}; + +#define STEAMSTREAMLAUNCHER_INTERFACE_VERSION "SteamStreamLauncher001" + + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// The big picture window is visible and ready for streaming +//----------------------------------------------------------------------------- +struct BigPictureStreamingResult_t +{ + enum { k_iCallback = k_iSteamStreamLauncherCallbacks + 1 }; + bool m_bSuccess; + void *m_hwnd; +}; + +//----------------------------------------------------------------------------- +// The user requested that the application stop streaming +//----------------------------------------------------------------------------- +struct StopStreamingRequest_t +{ + enum { k_iCallback = k_iSteamStreamLauncherCallbacks + 2 }; +}; + +//----------------------------------------------------------------------------- +// The big picture window is closed and no longer ready for streaming +//----------------------------------------------------------------------------- +struct BigPictureStreamingDone_t +{ + enum { k_iCallback = k_iSteamStreamLauncherCallbacks + 3 }; +}; + +//----------------------------------------------------------------------------- +// Steam is about to restart, continue streaming when it is available again +//----------------------------------------------------------------------------- +struct BigPictureStreamRestarting_t +{ + enum { k_iCallback = k_iSteamStreamLauncherCallbacks + 4 }; +}; + +#pragma pack( pop ) + +#endif // ISTEAMSTREAMLAUNCHER_H diff --git a/public/steam/isteamugc.h b/public/steam/isteamugc.h new file mode 100644 index 000000000..c574bf5ce --- /dev/null +++ b/public/steam/isteamugc.h @@ -0,0 +1,385 @@ +//====== Copyright 1996-2013, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to steam ugc +// +//============================================================================= + +#ifndef ISTEAMUGC_H +#define ISTEAMUGC_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +typedef uint64 UGCQueryHandle_t; +typedef uint64 UGCUpdateHandle_t; + + +const UGCQueryHandle_t k_UGCQueryHandleInvalid = 0xffffffffffffffffull; +const UGCUpdateHandle_t k_UGCUpdateHandleInvalid = 0xffffffffffffffffull; + + +// Matching UGC types for queries +enum EUGCMatchingUGCType +{ + k_EUGCMatchingUGCType_Items = 0, // both mtx items and ready-to-use items + k_EUGCMatchingUGCType_Items_Mtx = 1, + k_EUGCMatchingUGCType_Items_ReadyToUse = 2, + k_EUGCMatchingUGCType_Collections = 3, + k_EUGCMatchingUGCType_Artwork = 4, + k_EUGCMatchingUGCType_Videos = 5, + k_EUGCMatchingUGCType_Screenshots = 6, + k_EUGCMatchingUGCType_AllGuides = 7, // both web guides and integrated guides + k_EUGCMatchingUGCType_WebGuides = 8, + k_EUGCMatchingUGCType_IntegratedGuides = 9, + k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides + k_EUGCMatchingUGCType_ControllerBindings = 11, + k_EUGCMatchingUGCType_GameManagedItems = 12, // game managed items (not managed by users) + k_EUGCMatchingUGCType_All = ~0, // return everything +}; + +// Different lists of published UGC for a user. +// If the current logged in user is different than the specified user, then some options may not be allowed. +enum EUserUGCList +{ + k_EUserUGCList_Published, + k_EUserUGCList_VotedOn, + k_EUserUGCList_VotedUp, + k_EUserUGCList_VotedDown, + k_EUserUGCList_WillVoteLater, + k_EUserUGCList_Favorited, + k_EUserUGCList_Subscribed, + k_EUserUGCList_UsedOrPlayed, + k_EUserUGCList_Followed, +}; + +// Sort order for user published UGC lists (defaults to creation order descending) +enum EUserUGCListSortOrder +{ + k_EUserUGCListSortOrder_CreationOrderDesc, + k_EUserUGCListSortOrder_CreationOrderAsc, + k_EUserUGCListSortOrder_TitleAsc, + k_EUserUGCListSortOrder_LastUpdatedDesc, + k_EUserUGCListSortOrder_SubscriptionDateDesc, + k_EUserUGCListSortOrder_VoteScoreDesc, + k_EUserUGCListSortOrder_ForModeration, +}; + +// Combination of sorting and filtering for queries across all UGC +enum EUGCQuery +{ + k_EUGCQuery_RankedByVote = 0, + k_EUGCQuery_RankedByPublicationDate = 1, + k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate = 2, + k_EUGCQuery_RankedByTrend = 3, + k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate = 4, + k_EUGCQuery_CreatedByFriendsRankedByPublicationDate = 5, + k_EUGCQuery_RankedByNumTimesReported = 6, + k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate = 7, + k_EUGCQuery_NotYetRated = 8, + k_EUGCQuery_RankedByTotalVotesAsc = 9, + k_EUGCQuery_RankedByVotesUp = 10, + k_EUGCQuery_RankedByTextSearch = 11, + k_EUGCQuery_RankedByTotalUniqueSubscriptions = 12, +}; + +enum EItemUpdateStatus +{ + k_EItemUpdateStatusInvalid = 0, // The item update handle was invalid, job might be finished, listen too SubmitItemUpdateResult_t + k_EItemUpdateStatusPreparingConfig = 1, // The item update is processing configuration data + k_EItemUpdateStatusPreparingContent = 2, // The item update is reading and processing content files + k_EItemUpdateStatusUploadingContent = 3, // The item update is uploading content changes to Steam + k_EItemUpdateStatusUploadingPreviewFile = 4, // The item update is uploading new preview file image + k_EItemUpdateStatusCommittingChanges = 5 // The item update is committing all changes +}; + +enum EItemState +{ + k_EItemStateNone = 0, // item not tracked on client + k_EItemStateSubscribed = 1, // current user is subscribed to this item. Not just cached. + k_EItemStateLegacyItem = 2, // item was created with ISteamRemoteStorage + k_EItemStateInstalled = 4, // item is installed and usable (but maybe out of date) + k_EItemStateNeedsUpdate = 8, // items needs an update. Either because it's not installed yet or creator updated content + k_EItemStateDownloading = 16, // item update is currently downloading + k_EItemStateDownloadPending = 32, // DownloadItem() was called for this item, content isn't available until DownloadItemResult_t is fired +}; + +enum EItemStatistic +{ + k_EItemStatistic_NumSubscriptions = 0, + k_EItemStatistic_NumFavorites = 1, + k_EItemStatistic_NumFollowers = 2, + k_EItemStatistic_NumUniqueSubscriptions = 3, + k_EItemStatistic_NumUniqueFavorites = 4, + k_EItemStatistic_NumUniqueFollowers = 5, + k_EItemStatistic_NumUniqueWebsiteViews = 6, + k_EItemStatistic_ReportScore = 7, +}; + +const uint32 kNumUGCResultsPerPage = 50; +const uint32 k_cchDeveloperMetadataMax = 5000; + +// Details for a single published file/UGC +struct SteamUGCDetails_t +{ + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; // The result of the operation. + EWorkshopFileType m_eFileType; // Type of the file + AppId_t m_nCreatorAppID; // ID of the app that created this file. + AppId_t m_nConsumerAppID; // ID of the app that will consume this file. + char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document + char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document + uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. + uint32 m_rtimeCreated; // time when the published file was created + uint32 m_rtimeUpdated; // time when the published file was last updated + uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable) + ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility + bool m_bBanned; // whether the file was banned + bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop + bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer + char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file + // file/url information + UGCHandle_t m_hFile; // The handle of the primary file + UGCHandle_t m_hPreviewFile; // The handle of the preview file + char m_pchFileName[k_cchFilenameMax]; // The cloud filename of the primary file + int32 m_nFileSize; // Size of the primary file + int32 m_nPreviewFileSize; // Size of the preview file + char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) + // voting information + uint32 m_unVotesUp; // number of votes up + uint32 m_unVotesDown; // number of votes down + float m_flScore; // calculated score + // collection details + uint32 m_unNumChildren; +}; + +//----------------------------------------------------------------------------- +// Purpose: Steam UGC support API +//----------------------------------------------------------------------------- +class ISteamUGC +{ +public: + + // Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1. + virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0; + + // Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1. + virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0; + + // Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this) + virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0; + + // Send the query to Steam + virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; + + // Retrieve an individual result after receiving the callback for querying UGC + virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, char *pchURL, uint32 cchURLSize ) = 0; + virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, char *pchMetadata, uint32 cchMetadatasize ) = 0; + virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; + virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint32 *pStatValue ) = 0; + virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0; + virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, char *pchURLOrVideoID, uint32 cchURLSize, bool *pbIsImage ) = 0; + virtual uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index ) = 0; + virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, char *pchKey, uint32 cchKeySize, char *pchValue, uint32 cchValueSize ) = 0; + + // Release the request to free up memory, after retrieving results + virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0; + + // Options to set for querying UGC + virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; + virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; + virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0; + virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0; + virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0; + virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0; + virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0; + virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0; + virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0; + virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0; + + // Options only for querying user UGC + virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0; + + // Options only for querying all UGC + virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0; + virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0; + virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; + virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0; + + // DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead! + virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + + // Steam Workshop Creator API + virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet + + virtual UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate() + + virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item + virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item + virtual bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set + virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax) + virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item + virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) = 0; // change the tags of an UGC item + virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder + virtual bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) = 0; // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size + virtual bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key + virtual bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue ) = 0; // add new key-value tags for the item. Note that there can be multiple values for a tag. + + virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate() + virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0; + + // Steam Workshop Consumer API + virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0; + virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0; + virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0; + virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0; + virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP + virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits + virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items + virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs + + // get EItemState flags about item on this client + virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0; + + // get info about currently installed content on disc for items that have k_EItemStateInstalled set + // if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder) + virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0; + + // get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once + virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0; + + // download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed, + // then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time. + // If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP. + virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0; + + // game servers can set a specific workshop folder before issuing any UGC commands. + // This is helpful if you want to support multiple game servers running out of the same install folder + virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0; + + // SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends + virtual void SuspendDownloads( bool bSuspend ) = 0; +}; + +#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION007" + +//----------------------------------------------------------------------------- +// Purpose: Callback for querying UGC +//----------------------------------------------------------------------------- +struct SteamUGCQueryCompleted_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 1 }; + UGCQueryHandle_t m_handle; + EResult m_eResult; + uint32 m_unNumResultsReturned; + uint32 m_unTotalMatchingResults; + bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache +}; + + +//----------------------------------------------------------------------------- +// Purpose: Callback for requesting details on one piece of UGC +//----------------------------------------------------------------------------- +struct SteamUGCRequestUGCDetailsResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 2 }; + SteamUGCDetails_t m_details; + bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache +}; + + +//----------------------------------------------------------------------------- +// Purpose: result for ISteamUGC::CreateItem() +//----------------------------------------------------------------------------- +struct CreateItemResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 3 }; + EResult m_eResult; + PublishedFileId_t m_nPublishedFileId; // new item got this UGC PublishFileID + bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +}; + + +//----------------------------------------------------------------------------- +// Purpose: result for ISteamUGC::SubmitItemUpdate() +//----------------------------------------------------------------------------- +struct SubmitItemUpdateResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 4 }; + EResult m_eResult; + bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +}; + + +//----------------------------------------------------------------------------- +// Purpose: a Workshop item has been installed or updated +//----------------------------------------------------------------------------- +struct ItemInstalled_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 5 }; + AppId_t m_unAppID; + PublishedFileId_t m_nPublishedFileId; +}; + + +//----------------------------------------------------------------------------- +// Purpose: result of DownloadItem(), existing item files can be accessed again +//----------------------------------------------------------------------------- +struct DownloadItemResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 6 }; + AppId_t m_unAppID; + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; +}; + +//----------------------------------------------------------------------------- +// Purpose: result of AddItemToFavorites() or RemoveItemFromFavorites() +//----------------------------------------------------------------------------- +struct UserFavoriteItemsListChanged_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 7 }; + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; + bool m_bWasAddRequest; +}; + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to SetUserItemVote() +//----------------------------------------------------------------------------- +struct SetUserItemVoteResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 8 }; + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; + bool m_bVoteUp; +}; + +//----------------------------------------------------------------------------- +// Purpose: The result of a call to GetUserItemVote() +//----------------------------------------------------------------------------- +struct GetUserItemVoteResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 9 }; + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; + bool m_bVotedUp; + bool m_bVotedDown; + bool m_bVoteSkipped; +}; + +#pragma pack( pop ) + +#endif // ISTEAMUGC_H diff --git a/public/steam/isteamunifiedmessages.h b/public/steam/isteamunifiedmessages.h new file mode 100644 index 000000000..edee4a486 --- /dev/null +++ b/public/steam/isteamunifiedmessages.h @@ -0,0 +1,63 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Interface to unified messages client +// +// You should not need to use this interface except if your product is using a language other than C++. +// Contact your Steam Tech contact for more details. +// +//============================================================================= + +#ifndef ISTEAMUNIFIEDMESSAGES_H +#define ISTEAMUNIFIEDMESSAGES_H +#ifdef _WIN32 +#pragma once +#endif + +typedef uint64 ClientUnifiedMessageHandle; + +class ISteamUnifiedMessages +{ +public: + static const ClientUnifiedMessageHandle k_InvalidUnifiedMessageHandle = 0; + + // Sends a service method (in binary serialized form) using the Steam Client. + // Returns a unified message handle (k_InvalidUnifiedMessageHandle if could not send the message). + virtual ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void *pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext ) = 0; + + // Gets the size of the response and the EResult. Returns false if the response is not ready yet. + virtual bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult ) = 0; + + // Gets a response in binary serialized form (and optionally release the corresponding allocated memory). + virtual bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease ) = 0; + + // Releases the message and its corresponding allocated memory. + virtual bool ReleaseMethod( ClientUnifiedMessageHandle hHandle ) = 0; + + // Sends a service notification (in binary serialized form) using the Steam Client. + // Returns true if the notification was sent successfully. + virtual bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize ) = 0; +}; + +#define STEAMUNIFIEDMESSAGES_INTERFACE_VERSION "STEAMUNIFIEDMESSAGES_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +struct SteamUnifiedMessagesSendMethodResult_t +{ + enum { k_iCallback = k_iClientUnifiedMessagesCallbacks + 1 }; + ClientUnifiedMessageHandle m_hHandle; // The handle returned by SendMethod(). + uint64 m_unContext; // Context provided when calling SendMethod(). + EResult m_eResult; // The result of the method call. + uint32 m_unResponseSize; // The size of the response. +}; + +#pragma pack( pop ) + +#endif // ISTEAMUNIFIEDMESSAGES_H diff --git a/public/steam/isteamuser.h b/public/steam/isteamuser.h index 7bd468785..5af937d27 100644 --- a/public/steam/isteamuser.h +++ b/public/steam/isteamuser.h @@ -1,174 +1,380 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: interface to user account information in Steam -// -//============================================================================= - -#ifndef ISTEAMUSER_H -#define ISTEAMUSER_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -// structure that contains client callback data -struct CallbackMsg_t -{ - HSteamUser m_hSteamUser; - int m_iCallback; - uint8 *m_pubParam; - int m_cubParam; -}; - -// reference to a steam call, to filter results by -typedef int32 HSteamCall; - -enum ERegistrySubTree -{ - k_ERegistrySubTreeNews = 0, - k_ERegistrySubTreeApps = 1, - k_ERegistrySubTreeSubscriptions = 2, - k_ERegistrySubTreeGameServers = 3, - k_ERegistrySubTreeFriends = 4, - k_ERegistrySubTreeSystem = 5, -}; - -enum EAppUsageEvent -{ - k_EAppUsageEventGameLaunch = 1, - k_EAppUsageEventGameLaunchTrial = 2, - k_EAppUsageEventMedia = 3, - k_EAppUsageEventPreloadStart = 4, - k_EAppUsageEventPreloadFinish = 5, - k_EAppUsageEventMarketingMessageView = 6, // deprecated, do not use - k_EAppUsageEventInGameAdViewed = 7, - k_EAppUsageEventGameLaunchFreeWeekend = 8, -}; - - -//----------------------------------------------------------------------------- -// Purpose: Functions for accessing and manipulating a steam account -// associated with one client instance -//----------------------------------------------------------------------------- -class ISteamUser -{ -public: - // returns the HSteamUser this interface represents - virtual HSteamUser GetHSteamUser() = 0; - - // steam account management functions - virtual bool BLoggedOn() = 0; - virtual CSteamID GetSteamID() = 0; - - // notify of connection to game server - virtual int InitiateGameConnection( void *pBlob, int cbMaxBlob, CSteamID steamID, CGameID gameID, uint32 unIPServer, uint16 usPortServer, bool bSecure, void *pvSteam2GetEncryptionKey, int cbSteam2GetEncryptionKey ) = 0; - // notify of disconnect - virtual void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) = 0; - - // game info - virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0; - - // legacy authentication support - need to be called if the game server rejects the user with a 'bad ticket' error - virtual void RefreshSteam2Login() = 0; -}; - -#define STEAMUSER_INTERFACE_VERSION "SteamUser008" - - -// callbacks - - -//----------------------------------------------------------------------------- -// Purpose: called when a logon attempt has succeeded -//----------------------------------------------------------------------------- -struct LogonSuccess_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 1 }; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when a logon attempt has failed -//----------------------------------------------------------------------------- -struct LogonFailure_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 2 }; - EResult m_eResult; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the user logs off -//----------------------------------------------------------------------------- -struct LoggedOff_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 3 }; - EResult m_eResult; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the client is trying to retry logon after being unintentionally logged off -//----------------------------------------------------------------------------- -struct BeginLogonRetry_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 4 }; -}; - - -//----------------------------------------------------------------------------- -// Purpose: connect to game server denied -//----------------------------------------------------------------------------- -struct ClientGameServerDeny_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 13 }; - - uint32 m_uAppID; - uint32 m_unGameServerIP; - uint16 m_usGameServerPort; - uint16 m_bSecure; - uint32 m_uReason; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the callback system for this client is in an error state (and has flushed pending callbacks) -// When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect -//----------------------------------------------------------------------------- -struct CallbackPipeFailure_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 17 }; -}; - - -//----------------------------------------------------------------------------- -// Purpose: connect to game server denied -//----------------------------------------------------------------------------- -struct GSPolicyResponse_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 15 }; - uint8 m_bSecure; -}; - - -// C API bindings for GoldSRC, see isteamclient.h for details -extern "C" -{ - // C functions we export for the C API, maps to ISteamUser functions - DLL_EXPORT void Steam_LogOn( HSteamUser hUser, HSteamPipe hSteamPipe, uint64 ulSteamID ); - DLL_EXPORT void Steam_LogOff( HSteamUser hUser, HSteamPipe hSteamPipe ); - DLL_EXPORT bool Steam_BLoggedOn( HSteamUser hUser, HSteamPipe hSteamPipe ); - DLL_EXPORT bool Steam_BConnected( HSteamUser hUser, HSteamPipe hSteamPipe ); - DLL_EXPORT bool Steam_BGetCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg, HSteamCall *phSteamCall ); - DLL_EXPORT void Steam_FreeLastCallback( HSteamPipe hSteamPipe ); - DLL_EXPORT int Steam_GSGetSteamGameConnectToken( HSteamUser hUser, HSteamPipe hSteamPipe, void *pBlob, int cbBlobMax ); - DLL_EXPORT int Steam_InitiateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, void *pBlob, int cbMaxBlob, uint64 steamID, int nGameAppID, uint32 unIPServer, uint16 usPortServer, bool bSecure ); - DLL_EXPORT void Steam_TerminateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, uint32 unIPServer, uint16 usPortServer ); - - - typedef bool (*PFNSteam_BGetCallback)( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg, HSteamCall *phSteamCall ); - typedef void (*PFNSteam_FreeLastCallback)( HSteamPipe hSteamPipe ); -} - -#endif // ISTEAMUSER_H +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to user account information in Steam +// +//============================================================================= + +#ifndef ISTEAMUSER_H +#define ISTEAMUSER_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +// structure that contains client callback data +// see callbacks documentation for more details +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif +struct CallbackMsg_t +{ + HSteamUser m_hSteamUser; + int m_iCallback; + uint8 *m_pubParam; + int m_cubParam; +}; +#pragma pack( pop ) + +// reference to a steam call, to filter results by +typedef int32 HSteamCall; + +//----------------------------------------------------------------------------- +// Purpose: Functions for accessing and manipulating a steam account +// associated with one client instance +//----------------------------------------------------------------------------- +class ISteamUser +{ +public: + // returns the HSteamUser this interface represents + // this is only used internally by the API, and by a few select interfaces that support multi-user + virtual HSteamUser GetHSteamUser() = 0; + + // returns true if the Steam client current has a live connection to the Steam servers. + // If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy. + // The Steam client will automatically be trying to recreate the connection as often as possible. + virtual bool BLoggedOn() = 0; + + // returns the CSteamID of the account currently logged into the Steam client + // a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API + virtual CSteamID GetSteamID() = 0; + + // Multiplayer Authentication functions + + // InitiateGameConnection() starts the state machine for authenticating the game client with the game server + // It is the client portion of a three-way handshake between the client, the game server, and the steam servers + // + // Parameters: + // void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token. + // int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes. + // CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client + // CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( ) + // uint32 unIPServer, uint16 usPortServer - the IP address of the game server + // bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running) + // + // return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed + // The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process. + virtual int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) = 0; + + // notify of disconnect + // needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call + virtual void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) = 0; + + // Legacy functions + + // used by only a few games to track usage events + virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0; + + // get the local storage folder for current Steam account to write application data, e.g. save games, configs etc. + // this will usually be something like "C:\Progam Files\Steam\userdata\\\local" + virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0; + + // Starts voice recording. Once started, use GetVoice() to get the data + virtual void StartVoiceRecording( ) = 0; + + // Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for + // a little bit after this function is called. GetVoice() should continue to be called until it returns + // k_eVoiceResultNotRecording + virtual void StopVoiceRecording( ) = 0; + + // Determine the amount of captured audio data that is available in bytes. + // This provides both the compressed and uncompressed data. Please note that the uncompressed + // data is not the raw feed from the microphone: data may only be available if audible + // levels of speech are detected. + // nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case) + // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate + virtual EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate ) = 0; + + // Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to + // DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format. + // Please note that the uncompressed data is not the raw feed from the microphone: data may only be available if audible + // levels of speech are detected, and may have passed through denoising filters, etc. + // This function should be called as often as possible once recording has started; once per frame at least. + // nBytesWritten is set to the number of bytes written to pDestBuffer. + // nUncompressedBytesWritten is set to the number of bytes written to pUncompressedDestBuffer. + // You must grab both compressed and uncompressed here at the same time, if you want both. + // Matching data that is not read during this call will be thrown away. + // GetAvailableVoice() can be used to determine how much data is actually available. + // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate + virtual EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 *nUncompressBytesWritten, uint32 nUncompressedVoiceDesiredSampleRate ) = 0; + + // Decompresses a chunk of compressed data produced by GetVoice(). + // nBytesWritten is set to the number of bytes written to pDestBuffer unless the return value is k_EVoiceResultBufferTooSmall. + // In that case, nBytesWritten is set to the size of the buffer required to decompress the given + // data. The suggested buffer size for the destination buffer is 22 kilobytes. + // The output format of the data is 16-bit signed at the requested samples per second. + // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nDesiredSampleRate + virtual EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate ) = 0; + + // This returns the frequency of the voice data as it's stored internally; calling DecompressVoice() with this size will yield the best results + virtual uint32 GetVoiceOptimalSampleRate() = 0; + + // Retrieve ticket to be sent to the entity who wishes to authenticate you. + // pcbTicket retrieves the length of the actual ticket. + virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; + + // Authenticate ticket from entity steamID to be sure it is valid and isnt reused + // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse ) + virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0; + + // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity + virtual void EndAuthSession( CSteamID steamID ) = 0; + + // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to + virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0; + + // After receiving a user's authentication data, and passing it to BeginAuthSession, use this function + // to determine if the user owns downloadable content specified by the provided AppID. + virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0; + + // returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam + // (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT. + virtual bool BIsBehindNAT() = 0; + + // set data to be replicated to friends so that they can join your game + // CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client + // uint32 unIPServer, uint16 usPortServer - the IP address of the game server + virtual void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer ) = 0; + + // Requests a ticket encrypted with an app specific shared key + // pDataToInclude, cbDataToInclude will be encrypted into the ticket + // ( This is asynchronous, you must wait for the ticket to be completed by the server ) + virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0; + + // retrieve a finished ticket + virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; + + // Trading Card badges data access + // if you only have one set of cards, the series will be 1 + // the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1) + virtual int GetGameBadgeLevel( int nSeries, bool bFoil ) = 0; + + // gets the Steam Level of the user, as shown on their profile + virtual int GetPlayerSteamLevel() = 0; + + // Requests a URL which authenticates an in-game browser for store check-out, + // and then redirects to the specified URL. As long as the in-game browser + // accepts and handles session cookies, Steam microtransaction checkout pages + // will automatically recognize the user instead of presenting a login page. + // The result of this API call will be a StoreAuthURLResponse_t callback. + // NOTE: The URL has a very short lifetime to prevent history-snooping attacks, + // so you should only call this API when you are about to launch the browser, + // or else immediately navigate to the result URL using a hidden browser window. + // NOTE 2: The resulting authorization cookie has an expiration time of one day, + // so it would be a good idea to request and visit a new auth URL every 12 hours. + virtual SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL ) = 0; + +#ifdef _PS3 + // Initiates PS3 Logon request using just PSN ticket. + // + // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to + // prompt the user for network setup/PSN logon before initiating the Steam side of the logon. + // + // Listen for SteamServersConnected_t or SteamServerConnectFailure_t for status. SteamServerConnectFailure_t + // may return with EResult k_EResultExternalAccountUnlinked if the PSN account is unknown to Steam. You should + // then call LogOnAndLinkSteamAccountToPSN() after prompting the user for credentials to establish a link. + // Future calls to LogOn() after the one time link call should succeed as long as the user is connected to PSN. + virtual void LogOn( bool bInteractive ) = 0; + + // Initiates a request to logon with a specific steam username/password and create a PSN account link at + // the same time. Should call this only if LogOn() has failed and indicated the PSN account is unlinked. + // + // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to + // prompt the user for network setup/PSN logon before initiating the Steam side of the logon. pchUserName + // should be the users Steam username, and pchPassword should be the users Steam password. + // + // Listen for SteamServersConnected_t or SteamServerConnectFailure_t for status. SteamServerConnectFailure_t + // may return with EResult k_EResultOtherAccountAlreadyLinked if already linked to another account. + virtual void LogOnAndLinkSteamAccountToPSN( bool bInteractive, const char *pchUserName, const char *pchPassword ) = 0; + + // Final logon option for PS3, this logs into an existing account if already linked, but if not already linked + // creates a new account using the info in the PSN ticket to generate a unique account name. The new account is + // then linked to the PSN ticket. This is the faster option for new users who don't have an existing Steam account + // to get into multiplayer. + // + // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to + // prompt the user for network setup/PSN logon before initiating the Steam side of the logon. + virtual void LogOnAndCreateNewSteamAccountIfNeeded( bool bInteractive ) = 0; + + // Returns a special SteamID that represents the user's PSN information. Can be used to query the user's PSN avatar, + // online name, etc. through the standard Steamworks interfaces. + virtual CSteamID GetConsoleSteamID() = 0; +#endif + +}; + +#define STEAMUSER_INTERFACE_VERSION "SteamUser018" + + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// Purpose: called when a connections to the Steam back-end has been established +// this means the Steam client now has a working connection to the Steam servers +// usually this will have occurred before the game has launched, and should +// only be seen if the user has dropped connection due to a networking issue +// or a Steam server update +//----------------------------------------------------------------------------- +struct SteamServersConnected_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 1 }; +}; + +//----------------------------------------------------------------------------- +// Purpose: called when a connection attempt has failed +// this will occur periodically if the Steam client is not connected, +// and has failed in it's retry to establish a connection +//----------------------------------------------------------------------------- +struct SteamServerConnectFailure_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 2 }; + EResult m_eResult; + bool m_bStillRetrying; +}; + + +//----------------------------------------------------------------------------- +// Purpose: called if the client has lost connection to the Steam servers +// real-time services will be disabled until a matching SteamServersConnected_t has been posted +//----------------------------------------------------------------------------- +struct SteamServersDisconnected_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 3 }; + EResult m_eResult; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Sent by the Steam server to the client telling it to disconnect from the specified game server, +// which it may be in the process of or already connected to. +// The game client should immediately disconnect upon receiving this message. +// This can usually occur if the user doesn't have rights to play on the game server. +//----------------------------------------------------------------------------- +struct ClientGameServerDeny_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 13 }; + + uint32 m_uAppID; + uint32 m_unGameServerIP; + uint16 m_usGameServerPort; + uint16 m_bSecure; + uint32 m_uReason; +}; + + +//----------------------------------------------------------------------------- +// Purpose: called when the callback system for this client is in an error state (and has flushed pending callbacks) +// When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect. +// This usually occurs in the rare event the Steam client has some kind of fatal error. +//----------------------------------------------------------------------------- +struct IPCFailure_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 17 }; + enum EFailureType + { + k_EFailureFlushedCallbackQueue, + k_EFailurePipeFail, + }; + uint8 m_eFailureType; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Signaled whenever licenses change +//----------------------------------------------------------------------------- +struct LicensesUpdated_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 25 }; +}; + + +//----------------------------------------------------------------------------- +// callback for BeginAuthSession +//----------------------------------------------------------------------------- +struct ValidateAuthTicketResponse_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 43 }; + CSteamID m_SteamID; + EAuthSessionResponse m_eAuthSessionResponse; + CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed +}; + + +//----------------------------------------------------------------------------- +// Purpose: called when a user has responded to a microtransaction authorization request +//----------------------------------------------------------------------------- +struct MicroTxnAuthorizationResponse_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 52 }; + + uint32 m_unAppID; // AppID for this microtransaction + uint64 m_ulOrderID; // OrderID provided for the microtransaction + uint8 m_bAuthorized; // if user authorized transaction +}; + + +//----------------------------------------------------------------------------- +// Purpose: Result from RequestEncryptedAppTicket +//----------------------------------------------------------------------------- +struct EncryptedAppTicketResponse_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 54 }; + + EResult m_eResult; +}; + +//----------------------------------------------------------------------------- +// callback for GetAuthSessionTicket +//----------------------------------------------------------------------------- +struct GetAuthSessionTicketResponse_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 63 }; + HAuthTicket m_hAuthTicket; + EResult m_eResult; +}; + + +//----------------------------------------------------------------------------- +// Purpose: sent to your game in response to a steam://gamewebcallback/ command +//----------------------------------------------------------------------------- +struct GameWebCallback_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 64 }; + char m_szURL[256]; +}; + +//----------------------------------------------------------------------------- +// Purpose: sent to your game in response to ISteamUser::RequestStoreAuthURL +//----------------------------------------------------------------------------- +struct StoreAuthURLResponse_t +{ + enum { k_iCallback = k_iSteamUserCallbacks + 65 }; + char m_szURL[512]; +}; + + + +#pragma pack( pop ) + +#endif // ISTEAMUSER_H diff --git a/public/steam/isteamuserstats.h b/public/steam/isteamuserstats.h index d36e3dc24..3a65691ce 100644 --- a/public/steam/isteamuserstats.h +++ b/public/steam/isteamuserstats.h @@ -1,112 +1,465 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: interface to user account information in Steam -// -//============================================================================= - -#ifndef ISTEAMUSERSTATS_H -#define ISTEAMUSERSTATS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -// size limit on stat or achievement name -const uint32 k_cchStatNameMax = 128; - -class ISteamUserStats -{ -public: - - // The "schema" of a Game's UserData is really defined elsewhere, and - // the game should know it before accessing this interface. These top - // three functions are mostly provided for iteration / testing purposes. - // Get the number of stats fields for nGameID - virtual uint32 GetNumStats( CGameID nGameID ) = 0; - // Get stat name iStat in [0,GetNumStats) - virtual const char *GetStatName( CGameID nGameID, uint32 iStat ) = 0; - // Get type of this field - virtual ESteamUserStatType GetStatType( CGameID nGameID, const char *pchName ) = 0; - // Get the number of achievements for nGameID - virtual uint32 GetNumAchievements( CGameID nGameID ) = 0; - // Get achievement name iAchievement in [0,GetNumAchievements) - virtual const char *GetAchievementName( CGameID nGameID, uint32 iAchievement ) = 0; - - // Ask the server to send down this user's data and achievements for nGameID - virtual bool RequestCurrentStats( CGameID nGameID ) = 0; - - // Data accessors - virtual bool GetStat( CGameID nGameID, const char *pchName, int32 *pData ) = 0; - virtual bool GetStat( CGameID nGameID, const char *pchName, float *pData ) = 0; - - // Set / update data - virtual bool SetStat( CGameID nGameID, const char *pchName, int32 nData ) = 0; - virtual bool SetStat( CGameID nGameID, const char *pchName, float fData ) = 0; - virtual bool UpdateAvgRateStat( CGameID nGameID, const char *pchName, uint32 nCountThisSession, double dSessionLength ) = 0; - - // Achievement flag accessors - virtual bool GetAchievement( CGameID nGameID, const char *pchName, bool *pbAchieved ) = 0; - virtual bool SetAchievement( CGameID nGameID, const char *pchName ) = 0; - virtual bool ClearAchievement( CGameID nGameID, const char *pchName ) = 0; - - // Store the current data on the server, will get a callback when set - // And one callback for every new achievement - virtual bool StoreStats( CGameID nGameID ) = 0; - - // Achievement / GroupAchievement metadata - - // Gets the icon of the achievement, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set - virtual int GetAchievementIcon( CGameID nGameID, const char *pchName ) = 0; - // Get general attributes (display name / text, etc) for an Achievement - virtual const char *GetAchievementDisplayAttribute( CGameID nGameID, const char *pchName, const char *pchKey ) = 0; - - // Achievement progress - triggers an AchievementProgress callback, that is all. - // Calling this w/ N out of N progress will NOT set the achievement, the game must still do that. - virtual bool IndicateAchievementProgress( CGameID nGameID, const char *pchName, uint32 nCurProgress, uint32 nMaxProgress ) = 0; - -}; - - -#define STEAMUSERSTATS_INTERFACE_VERSION "STEAMUSERSTATS_INTERFACE_VERSION002" - -//----------------------------------------------------------------------------- -// Purpose: called when the latests stats and achievements have been received -// from the server -//----------------------------------------------------------------------------- -struct UserStatsReceived_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 1 }; - uint64 m_nGameID; // Game these stats are for - EResult m_eResult; // Success / error fetching the stats -}; - - -//----------------------------------------------------------------------------- -// Purpose: result of a request to store the user stats for a game -//----------------------------------------------------------------------------- -struct UserStatsStored_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 2 }; - uint64 m_nGameID; // Game these stats are for - EResult m_eResult; // success / error -}; - -//----------------------------------------------------------------------------- -// Purpose: result of a request to store the achievements for a game, or an -// "indicate progress" call. If both m_nCurProgress and m_nMaxProgress -// are zero, that means the achievement has been fully unlocked. -//----------------------------------------------------------------------------- -struct UserAchievementStored_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 3 }; - - uint64 m_nGameID; // Game this is for - bool m_bGroupAchievement; // if this is a "group" achievement - char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement - uint32 m_nCurProgress; // current progress towards the achievement - uint32 m_nMaxProgress; // "out of" this many -}; - - -#endif // ISTEAMUSER_H +//====== Copyright � 1996-2009, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to stats, achievements, and leaderboards +// +//============================================================================= + +#ifndef ISTEAMUSERSTATS_H +#define ISTEAMUSERSTATS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" +#include "isteamremotestorage.h" + +// size limit on stat or achievement name (UTF-8 encoded) +enum { k_cchStatNameMax = 128 }; + +// maximum number of bytes for a leaderboard name (UTF-8 encoded) +enum { k_cchLeaderboardNameMax = 128 }; + +// maximum number of details int32's storable for a single leaderboard entry +enum { k_cLeaderboardDetailsMax = 64 }; + +// handle to a single leaderboard +typedef uint64 SteamLeaderboard_t; + +// handle to a set of downloaded entries in a leaderboard +typedef uint64 SteamLeaderboardEntries_t; + +// type of data request, when downloading leaderboard entries +enum ELeaderboardDataRequest +{ + k_ELeaderboardDataRequestGlobal = 0, + k_ELeaderboardDataRequestGlobalAroundUser = 1, + k_ELeaderboardDataRequestFriends = 2, + k_ELeaderboardDataRequestUsers = 3 +}; + +// the sort order of a leaderboard +enum ELeaderboardSortMethod +{ + k_ELeaderboardSortMethodNone = 0, + k_ELeaderboardSortMethodAscending = 1, // top-score is lowest number + k_ELeaderboardSortMethodDescending = 2, // top-score is highest number +}; + +// the display type (used by the Steam Community web site) for a leaderboard +enum ELeaderboardDisplayType +{ + k_ELeaderboardDisplayTypeNone = 0, + k_ELeaderboardDisplayTypeNumeric = 1, // simple numerical score + k_ELeaderboardDisplayTypeTimeSeconds = 2, // the score represents a time, in seconds + k_ELeaderboardDisplayTypeTimeMilliSeconds = 3, // the score represents a time, in milliseconds +}; + +enum ELeaderboardUploadScoreMethod +{ + k_ELeaderboardUploadScoreMethodNone = 0, + k_ELeaderboardUploadScoreMethodKeepBest = 1, // Leaderboard will keep user's best score + k_ELeaderboardUploadScoreMethodForceUpdate = 2, // Leaderboard will always replace score with specified +}; + +// a single entry in a leaderboard, as returned by GetDownloadedLeaderboardEntry() +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +struct LeaderboardEntry_t +{ + CSteamID m_steamIDUser; // user with the entry - use SteamFriends()->GetFriendPersonaName() & SteamFriends()->GetFriendAvatar() to get more info + int32 m_nGlobalRank; // [1..N], where N is the number of users with an entry in the leaderboard + int32 m_nScore; // score as set in the leaderboard + int32 m_cDetails; // number of int32 details available for this entry + UGCHandle_t m_hUGC; // handle for UGC attached to the entry +}; + +#pragma pack( pop ) + + +//----------------------------------------------------------------------------- +// Purpose: Functions for accessing stats, achievements, and leaderboard information +//----------------------------------------------------------------------------- +class ISteamUserStats +{ +public: + // Ask the server to send down this user's data and achievements for this game + virtual bool RequestCurrentStats() = 0; + + // Data accessors + virtual bool GetStat( const char *pchName, int32 *pData ) = 0; + virtual bool GetStat( const char *pchName, float *pData ) = 0; + + // Set / update data + virtual bool SetStat( const char *pchName, int32 nData ) = 0; + virtual bool SetStat( const char *pchName, float fData ) = 0; + virtual bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength ) = 0; + + // Achievement flag accessors + virtual bool GetAchievement( const char *pchName, bool *pbAchieved ) = 0; + virtual bool SetAchievement( const char *pchName ) = 0; + virtual bool ClearAchievement( const char *pchName ) = 0; + + // Get the achievement status, and the time it was unlocked if unlocked. + // If the return value is true, but the unlock time is zero, that means it was unlocked before Steam + // began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970. + virtual bool GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0; + + // Store the current data on the server, will get a callback when set + // And one callback for every new achievement + // + // If the callback has a result of k_EResultInvalidParam, one or more stats + // uploaded has been rejected, either because they broke constraints + // or were out of date. In this case the server sends back updated values. + // The stats should be re-iterated to keep in sync. + virtual bool StoreStats() = 0; + + // Achievement / GroupAchievement metadata + + // Gets the icon of the achievement, which is a handle to be used in ISteamUtils::GetImageRGBA(), or 0 if none set. + // A return value of 0 may indicate we are still fetching data, and you can wait for the UserAchievementIconFetched_t callback + // which will notify you when the bits are ready. If the callback still returns zero, then there is no image set for the + // specified achievement. + virtual int GetAchievementIcon( const char *pchName ) = 0; + + // Get general attributes for an achievement. Accepts the following keys: + // - "name" and "desc" for retrieving the localized achievement name and description (returned in UTF8) + // - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden) + virtual const char *GetAchievementDisplayAttribute( const char *pchName, const char *pchKey ) = 0; + + // Achievement progress - triggers an AchievementProgress callback, that is all. + // Calling this w/ N out of N progress will NOT set the achievement, the game must still do that. + virtual bool IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress ) = 0; + + // Used for iterating achievements. In general games should not need these functions because they should have a + // list of existing achievements compiled into them + virtual uint32 GetNumAchievements() = 0; + // Get achievement name iAchievement in [0,GetNumAchievements) + virtual const char *GetAchievementName( uint32 iAchievement ) = 0; + + // Friends stats & achievements + + // downloads stats for the user + // returns a UserStatsReceived_t received when completed + // if the other user has no stats, UserStatsReceived_t.m_eResult will be set to k_EResultFail + // these stats won't be auto-updated; you'll need to call RequestUserStats() again to refresh any data + virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0; + + // requests stat information for a user, usable after a successful call to RequestUserStats() + virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0; + virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0; + virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0; + // See notes for GetAchievementAndUnlockTime above + virtual bool GetUserAchievementAndUnlockTime( CSteamID steamIDUser, const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0; + + // Reset stats + virtual bool ResetAllStats( bool bAchievementsToo ) = 0; + + // Leaderboard functions + + // asks the Steam back-end for a leaderboard by name, and will create it if it's not yet + // This call is asynchronous, with the result returned in LeaderboardFindResult_t + virtual SteamAPICall_t FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType ) = 0; + + // as above, but won't create the leaderboard if it's not found + // This call is asynchronous, with the result returned in LeaderboardFindResult_t + virtual SteamAPICall_t FindLeaderboard( const char *pchLeaderboardName ) = 0; + + // returns the name of a leaderboard + virtual const char *GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard ) = 0; + + // returns the total number of entries in a leaderboard, as of the last request + virtual int GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard ) = 0; + + // returns the sort method of the leaderboard + virtual ELeaderboardSortMethod GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard ) = 0; + + // returns the display type of the leaderboard + virtual ELeaderboardDisplayType GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard ) = 0; + + // Asks the Steam back-end for a set of rows in the leaderboard. + // This call is asynchronous, with the result returned in LeaderboardScoresDownloaded_t + // LeaderboardScoresDownloaded_t will contain a handle to pull the results from GetDownloadedLeaderboardEntries() (below) + // You can ask for more entries than exist, and it will return as many as do exist. + // k_ELeaderboardDataRequestGlobal requests rows in the leaderboard from the full table, with nRangeStart & nRangeEnd in the range [1, TotalEntries] + // k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate + // e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after + // k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user + virtual SteamAPICall_t DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd ) = 0; + // as above, but downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers + // if a user doesn't have a leaderboard entry, they won't be included in the result + // a max of 100 users can be downloaded at a time, with only one outstanding call at a time + METHOD_DESC(Downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers) + virtual SteamAPICall_t DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, + ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers ) = 0; + + // Returns data about a single leaderboard entry + // use a for loop from 0 to LeaderboardScoresDownloaded_t::m_cEntryCount to get all the downloaded entries + // e.g. + // void OnLeaderboardScoresDownloaded( LeaderboardScoresDownloaded_t *pLeaderboardScoresDownloaded ) + // { + // for ( int index = 0; index < pLeaderboardScoresDownloaded->m_cEntryCount; index++ ) + // { + // LeaderboardEntry_t leaderboardEntry; + // int32 details[3]; // we know this is how many we've stored previously + // GetDownloadedLeaderboardEntry( pLeaderboardScoresDownloaded->m_hSteamLeaderboardEntries, index, &leaderboardEntry, details, 3 ); + // assert( leaderboardEntry.m_cDetails == 3 ); + // ... + // } + // once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid + virtual bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t *pLeaderboardEntry, int32 *pDetails, int cDetailsMax ) = 0; + + // Uploads a user score to the Steam back-end. + // This call is asynchronous, with the result returned in LeaderboardScoreUploaded_t + // Details are extra game-defined information regarding how the user got that score + // pScoreDetails points to an array of int32's, cScoreDetailsCount is the number of int32's in the list + virtual SteamAPICall_t UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount ) = 0; + + // Attaches a piece of user generated content the user's entry on a leaderboard. + // hContent is a handle to a piece of user generated content that was shared using ISteamUserRemoteStorage::FileShare(). + // This call is asynchronous, with the result returned in LeaderboardUGCSet_t. + virtual SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC ) = 0; + + // Retrieves the number of players currently playing your game (online + offline) + // This call is asynchronous, with the result returned in NumberOfCurrentPlayers_t + virtual SteamAPICall_t GetNumberOfCurrentPlayers() = 0; + + // Requests that Steam fetch data on the percentage of players who have received each achievement + // for the game globally. + // This call is asynchronous, with the result returned in GlobalAchievementPercentagesReady_t. + virtual SteamAPICall_t RequestGlobalAchievementPercentages() = 0; + + // Get the info on the most achieved achievement for the game, returns an iterator index you can use to fetch + // the next most achieved afterwards. Will return -1 if there is no data on achievement + // percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback). + virtual int GetMostAchievedAchievementInfo( char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0; + + // Get the info on the next most achieved achievement for the game. Call this after GetMostAchievedAchievementInfo or another + // GetNextMostAchievedAchievementInfo call passing the iterator from the previous call. Returns -1 after the last + // achievement has been iterated. + virtual int GetNextMostAchievedAchievementInfo( int iIteratorPrevious, char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0; + + // Returns the percentage of users who have achieved the specified achievement. + virtual bool GetAchievementAchievedPercent( const char *pchName, float *pflPercent ) = 0; + + // Requests global stats data, which is available for stats marked as "aggregated". + // This call is asynchronous, with the results returned in GlobalStatsReceived_t. + // nHistoryDays specifies how many days of day-by-day history to retrieve in addition + // to the overall totals. The limit is 60. + virtual SteamAPICall_t RequestGlobalStats( int nHistoryDays ) = 0; + + // Gets the lifetime totals for an aggregated stat + virtual bool GetGlobalStat( const char *pchStatName, int64 *pData ) = 0; + virtual bool GetGlobalStat( const char *pchStatName, double *pData ) = 0; + + // Gets history for an aggregated stat. pData will be filled with daily values, starting with today. + // So when called, pData[0] will be today, pData[1] will be yesterday, and pData[2] will be two days ago, + // etc. cubData is the size in bytes of the pubData buffer. Returns the number of + // elements actually set. + virtual int32 GetGlobalStatHistory( const char *pchStatName, ARRAY_COUNT(cubData) int64 *pData, uint32 cubData ) = 0; + virtual int32 GetGlobalStatHistory( const char *pchStatName, ARRAY_COUNT(cubData) double *pData, uint32 cubData ) = 0; + +#ifdef _PS3 + // Call to kick off installation of the PS3 trophies. This call is asynchronous, and the results will be returned in a PS3TrophiesInstalled_t + // callback. + virtual bool InstallPS3Trophies() = 0; + + // Returns the amount of space required at boot to install trophies. This value can be used when comparing the amount of space needed + // by the game to the available space value passed to the game at boot. The value is set during InstallPS3Trophies(). + virtual uint64 GetTrophySpaceRequiredBeforeInstall() = 0; + + // On PS3, user stats & achievement progress through Steam must be stored with the user's saved game data. + // At startup, before calling RequestCurrentStats(), you must pass the user's stats data to Steam via this method. + // If you do not have any user data, call this function with pvData = NULL and cubData = 0 + virtual bool SetUserStatsData( const void *pvData, uint32 cubData ) = 0; + + // Call to get the user's current stats data. You should retrieve this data after receiving successful UserStatsReceived_t & UserStatsStored_t + // callbacks, and store the data with the user's save game data. You can call this method with pvData = NULL and cubData = 0 to get the required + // buffer size. + virtual bool GetUserStatsData( void *pvData, uint32 cubData, uint32 *pcubWritten ) = 0; +#endif +}; + +#define STEAMUSERSTATS_INTERFACE_VERSION "STEAMUSERSTATS_INTERFACE_VERSION011" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// Purpose: called when the latests stats and achievements have been received +// from the server +//----------------------------------------------------------------------------- +struct UserStatsReceived_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 1 }; + uint64 m_nGameID; // Game these stats are for + EResult m_eResult; // Success / error fetching the stats + CSteamID m_steamIDUser; // The user for whom the stats are retrieved for +}; + + +//----------------------------------------------------------------------------- +// Purpose: result of a request to store the user stats for a game +//----------------------------------------------------------------------------- +struct UserStatsStored_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 2 }; + uint64 m_nGameID; // Game these stats are for + EResult m_eResult; // success / error +}; + + +//----------------------------------------------------------------------------- +// Purpose: result of a request to store the achievements for a game, or an +// "indicate progress" call. If both m_nCurProgress and m_nMaxProgress +// are zero, that means the achievement has been fully unlocked. +//----------------------------------------------------------------------------- +struct UserAchievementStored_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 3 }; + + uint64 m_nGameID; // Game this is for + bool m_bGroupAchievement; // if this is a "group" achievement + char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement + uint32 m_nCurProgress; // current progress towards the achievement + uint32 m_nMaxProgress; // "out of" this many +}; + + +//----------------------------------------------------------------------------- +// Purpose: call result for finding a leaderboard, returned as a result of FindOrCreateLeaderboard() or FindLeaderboard() +// use CCallResult<> to map this async result to a member function +//----------------------------------------------------------------------------- +struct LeaderboardFindResult_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 4 }; + SteamLeaderboard_t m_hSteamLeaderboard; // handle to the leaderboard serarched for, 0 if no leaderboard found + uint8 m_bLeaderboardFound; // 0 if no leaderboard found +}; + + +//----------------------------------------------------------------------------- +// Purpose: call result indicating scores for a leaderboard have been downloaded and are ready to be retrieved, returned as a result of DownloadLeaderboardEntries() +// use CCallResult<> to map this async result to a member function +//----------------------------------------------------------------------------- +struct LeaderboardScoresDownloaded_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 5 }; + SteamLeaderboard_t m_hSteamLeaderboard; + SteamLeaderboardEntries_t m_hSteamLeaderboardEntries; // the handle to pass into GetDownloadedLeaderboardEntries() + int m_cEntryCount; // the number of entries downloaded +}; + + +//----------------------------------------------------------------------------- +// Purpose: call result indicating scores has been uploaded, returned as a result of UploadLeaderboardScore() +// use CCallResult<> to map this async result to a member function +//----------------------------------------------------------------------------- +struct LeaderboardScoreUploaded_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 6 }; + uint8 m_bSuccess; // 1 if the call was successful + SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was + int32 m_nScore; // the score that was attempted to set + uint8 m_bScoreChanged; // true if the score in the leaderboard change, false if the existing score was better + int m_nGlobalRankNew; // the new global rank of the user in this leaderboard + int m_nGlobalRankPrevious; // the previous global rank of the user in this leaderboard; 0 if the user had no existing entry in the leaderboard +}; + +struct NumberOfCurrentPlayers_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 7 }; + uint8 m_bSuccess; // 1 if the call was successful + int32 m_cPlayers; // Number of players currently playing +}; + + + +//----------------------------------------------------------------------------- +// Purpose: Callback indicating that a user's stats have been unloaded. +// Call RequestUserStats again to access stats for this user +//----------------------------------------------------------------------------- +struct UserStatsUnloaded_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 }; + CSteamID m_steamIDUser; // User whose stats have been unloaded +}; + + + +//----------------------------------------------------------------------------- +// Purpose: Callback indicating that an achievement icon has been fetched +//----------------------------------------------------------------------------- +struct UserAchievementIconFetched_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 9 }; + + CGameID m_nGameID; // Game this is for + char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement + bool m_bAchieved; // Is the icon for the achieved or not achieved version? + int m_nIconHandle; // Handle to the image, which can be used in SteamUtils()->GetImageRGBA(), 0 means no image is set for the achievement +}; + + +//----------------------------------------------------------------------------- +// Purpose: Callback indicating that global achievement percentages are fetched +//----------------------------------------------------------------------------- +struct GlobalAchievementPercentagesReady_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 10 }; + + uint64 m_nGameID; // Game this is for + EResult m_eResult; // Result of the operation +}; + + +//----------------------------------------------------------------------------- +// Purpose: call result indicating UGC has been uploaded, returned as a result of SetLeaderboardUGC() +//----------------------------------------------------------------------------- +struct LeaderboardUGCSet_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 11 }; + EResult m_eResult; // The result of the operation + SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was +}; + + +//----------------------------------------------------------------------------- +// Purpose: callback indicating that PS3 trophies have been installed +//----------------------------------------------------------------------------- +struct PS3TrophiesInstalled_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 }; + uint64 m_nGameID; // Game these stats are for + EResult m_eResult; // The result of the operation + uint64 m_ulRequiredDiskSpace; // If m_eResult is k_EResultDiskFull, will contain the amount of space needed to install trophies + +}; + + +//----------------------------------------------------------------------------- +// Purpose: callback indicating global stats have been received. +// Returned as a result of RequestGlobalStats() +//----------------------------------------------------------------------------- +struct GlobalStatsReceived_t +{ + enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 }; + uint64 m_nGameID; // Game global stats were requested for + EResult m_eResult; // The result of the request +}; + +#pragma pack( pop ) + + +#endif // ISTEAMUSER_H diff --git a/public/steam/isteamutils.h b/public/steam/isteamutils.h index 8a0610274..54777d33c 100644 --- a/public/steam/isteamutils.h +++ b/public/steam/isteamutils.h @@ -1,74 +1,310 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: interface to utility functions in Steam -// -//============================================================================= - -#ifndef ISTEAMUTILS_H -#define ISTEAMUTILS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -//----------------------------------------------------------------------------- -// Purpose: interface to user independent utility functions -//----------------------------------------------------------------------------- -class ISteamUtils -{ -public: - // return the number of seconds since the user - virtual uint32 GetSecondsSinceAppActive() = 0; - virtual uint32 GetSecondsSinceComputerActive() = 0; - - // the universe this client is connecting to - virtual EUniverse GetConnectedUniverse() = 0; - - // Steam server time - in PST, number of seconds since January 1, 1970 (i.e unix time) - virtual uint32 GetServerRealTime() = 0; - - // returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database) - // e.g "US" or "UK". - virtual const char *GetIPCountry() = 0; - - // returns true if the image exists, and valid sizes were filled out - virtual bool GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight ) = 0; - - // returns true if the image exists, and the buffer was successfully filled out - // results are returned in RGBA format - // the destination buffer size should be 4 * height * width * sizeof(char) - virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0; - - // returns the IP of the reporting server for valve - currently only used in Source engine games - virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0; - - // return the amount of battery power left in the current system in % [0..100], 255 for being on AC power - virtual uint8 GetCurrentBatteryPower() = 0; -}; - -#define STEAMUTILS_INTERFACE_VERSION "SteamUtils002" - - -// callbacks - - -//----------------------------------------------------------------------------- -// Purpose: The country of the user changed -//----------------------------------------------------------------------------- -struct IPCountry_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 1 }; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Fired when running on a laptop and less than 10 minutes of battery is left, fires then every minute -//----------------------------------------------------------------------------- -struct LowBatteryPower_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 2 }; - uint8 m_nMinutesBatteryLeft; -}; - -#endif // ISTEAMUTILS_H +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to utility functions in Steam +// +//============================================================================= + +#ifndef ISTEAMUTILS_H +#define ISTEAMUTILS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + + +// Steam API call failure results +enum ESteamAPICallFailure +{ + k_ESteamAPICallFailureNone = -1, // no failure + k_ESteamAPICallFailureSteamGone = 0, // the local Steam process has gone away + k_ESteamAPICallFailureNetworkFailure = 1, // the network connection to Steam has been broken, or was already broken + // SteamServersDisconnected_t callback will be sent around the same time + // SteamServersConnected_t will be sent when the client is able to talk to the Steam servers again + k_ESteamAPICallFailureInvalidHandle = 2, // the SteamAPICall_t handle passed in no longer exists + k_ESteamAPICallFailureMismatchedCallback = 3,// GetAPICallResult() was called with the wrong callback type for this API call +}; + + +// Input modes for the Big Picture gamepad text entry +enum EGamepadTextInputMode +{ + k_EGamepadTextInputModeNormal = 0, + k_EGamepadTextInputModePassword = 1 +}; + + +// Controls number of allowed lines for the Big Picture gamepad text entry +enum EGamepadTextInputLineMode +{ + k_EGamepadTextInputLineModeSingleLine = 0, + k_EGamepadTextInputLineModeMultipleLines = 1 +}; + + +// function prototype for warning message hook +#if defined( POSIX ) +#define __cdecl +#endif +extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *); + +//----------------------------------------------------------------------------- +// Purpose: interface to user independent utility functions +//----------------------------------------------------------------------------- +class ISteamUtils +{ +public: + // return the number of seconds since the user + virtual uint32 GetSecondsSinceAppActive() = 0; + virtual uint32 GetSecondsSinceComputerActive() = 0; + + // the universe this client is connecting to + virtual EUniverse GetConnectedUniverse() = 0; + + // Steam server time - in PST, number of seconds since January 1, 1970 (i.e unix time) + virtual uint32 GetServerRealTime() = 0; + + // returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database) + // e.g "US" or "UK". + virtual const char *GetIPCountry() = 0; + + // returns true if the image exists, and valid sizes were filled out + virtual bool GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight ) = 0; + + // returns true if the image exists, and the buffer was successfully filled out + // results are returned in RGBA format + // the destination buffer size should be 4 * height * width * sizeof(char) + virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0; + + // returns the IP of the reporting server for valve - currently only used in Source engine games + virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0; + + // return the amount of battery power left in the current system in % [0..100], 255 for being on AC power + virtual uint8 GetCurrentBatteryPower() = 0; + + // returns the appID of the current process + virtual uint32 GetAppID() = 0; + + // Sets the position where the overlay instance for the currently calling game should show notifications. + // This position is per-game and if this function is called from outside of a game context it will do nothing. + virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0; + + // API asynchronous call results + // can be used directly, but more commonly used via the callback dispatch API (see steam_api.h) + virtual bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed ) = 0; + virtual ESteamAPICallFailure GetAPICallFailureReason( SteamAPICall_t hSteamAPICall ) = 0; + virtual bool GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) = 0; + + // this needs to be called every frame to process matchmaking results + // redundant if you're already calling SteamAPI_RunCallbacks() + virtual void RunFrame() = 0; + + // returns the number of IPC calls made since the last time this function was called + // Used for perf debugging so you can understand how many IPC calls your game makes per frame + // Every IPC call is at minimum a thread context switch if not a process one so you want to rate + // control how often you do them. + virtual uint32 GetIPCCallCount() = 0; + + // API warning handling + // 'int' is the severity; 0 for msg, 1 for warning + // 'const char *' is the text of the message + // callbacks will occur directly after the API function is called that generated the warning or message + virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0; + + // Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to + // start & hook the game process, so this function will initially return false while the overlay is loading. + virtual bool IsOverlayEnabled() = 0; + + // Normally this call is unneeded if your game has a constantly running frame loop that calls the + // D3D Present API, or OGL SwapBuffers API every frame. + // + // However, if you have a game that only refreshes the screen on an event driven basis then that can break + // the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also + // need to Present() to the screen any time an even needing a notification happens or when the overlay is + // brought up over the game by a user. You can use this API to ask the overlay if it currently need a present + // in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you + // refresh the screen with Present or SwapBuffers to allow the overlay to do it's work. + virtual bool BOverlayNeedsPresent() = 0; + +#ifndef _PS3 + // Asynchronous call to check if an executable file has been signed using the public key set on the signing tab + // of the partner site, for example to refuse to load modified executable files. + // The result is returned in CheckFileSignature_t. + // k_ECheckFileSignatureNoSignaturesFoundForThisApp - This app has not been configured on the signing tab of the partner site to enable this function. + // k_ECheckFileSignatureNoSignaturesFoundForThisFile - This file is not listed on the signing tab for the partner site. + // k_ECheckFileSignatureFileNotFound - The file does not exist on disk. + // k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match. + // k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid. + virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0; +#endif + +#ifdef _PS3 + virtual void PostPS3SysutilCallback( uint64_t status, uint64_t param, void* userdata ) = 0; + virtual bool BIsReadyToShutdown() = 0; + virtual bool BIsPSNOnline() = 0; + + // Call this with localized strings for the language the game is running in, otherwise default english + // strings will be used by Steam. + virtual void SetPSNGameBootInviteStrings( const char *pchSubject, const char *pchBody ) = 0; +#endif + + // Activates the Big Picture text input dialog which only supports gamepad input + virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0; + + // Returns previously entered text & length + virtual uint32 GetEnteredGamepadTextLength() = 0; + virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0; + + // returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases + virtual const char *GetSteamUILanguage() = 0; + + // returns true if Steam itself is running in VR mode + virtual bool IsSteamRunningInVR() = 0; + + // Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition. + virtual void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset ) = 0; +}; + +#define STEAMUTILS_INTERFACE_VERSION "SteamUtils007" + + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + +//----------------------------------------------------------------------------- +// Purpose: The country of the user changed +//----------------------------------------------------------------------------- +struct IPCountry_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 1 }; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Fired when running on a laptop and less than 10 minutes of battery is left, fires then every minute +//----------------------------------------------------------------------------- +struct LowBatteryPower_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 2 }; + uint8 m_nMinutesBatteryLeft; +}; + + +//----------------------------------------------------------------------------- +// Purpose: called when a SteamAsyncCall_t has completed (or failed) +//----------------------------------------------------------------------------- +struct SteamAPICallCompleted_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 3 }; + SteamAPICall_t m_hAsyncCall; +}; + + +//----------------------------------------------------------------------------- +// called when Steam wants to shutdown +//----------------------------------------------------------------------------- +struct SteamShutdown_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 4 }; +}; + +//----------------------------------------------------------------------------- +// results for CheckFileSignature +//----------------------------------------------------------------------------- +enum ECheckFileSignature +{ + k_ECheckFileSignatureInvalidSignature = 0, + k_ECheckFileSignatureValidSignature = 1, + k_ECheckFileSignatureFileNotFound = 2, + k_ECheckFileSignatureNoSignaturesFoundForThisApp = 3, + k_ECheckFileSignatureNoSignaturesFoundForThisFile = 4, +}; + +//----------------------------------------------------------------------------- +// callback for CheckFileSignature +//----------------------------------------------------------------------------- +struct CheckFileSignature_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 5 }; + ECheckFileSignature m_eCheckFileSignature; +}; + +#ifdef _PS3 +//----------------------------------------------------------------------------- +// callback for NetCtlNetStartDialog finishing on PS3 +//----------------------------------------------------------------------------- +struct NetStartDialogFinished_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 6 }; +}; + +//----------------------------------------------------------------------------- +// callback for NetCtlNetStartDialog unloaded on PS3 +//----------------------------------------------------------------------------- +struct NetStartDialogUnloaded_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 7 }; +}; + +//----------------------------------------------------------------------------- +// callback for system menu closing on PS3 - should trigger resyncronizing friends list, etc. +//----------------------------------------------------------------------------- +struct PS3SystemMenuClosed_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 8 }; +}; + +//----------------------------------------------------------------------------- +// callback for NP message being selected by user on PS3 - should trigger handling of message if it's a lobby invite, etc. +//----------------------------------------------------------------------------- +struct PS3NPMessageSelected_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 9 }; + uint32 dataid; +}; + +//----------------------------------------------------------------------------- +// callback for when the PS3 keyboard dialog closes +//----------------------------------------------------------------------------- +struct PS3KeyboardDialogFinished_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 10 }; +}; + +// k_iSteamUtilsCallbacks + 11 is taken + +//----------------------------------------------------------------------------- +// callback for PSN status changing on PS3 +//----------------------------------------------------------------------------- +struct PS3PSNStatusChange_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 12 }; + bool m_bPSNOnline; +}; + +#endif + +// k_iSteamUtilsCallbacks + 13 is taken + + +//----------------------------------------------------------------------------- +// Big Picture gamepad text input has been closed +//----------------------------------------------------------------------------- +struct GamepadTextInputDismissed_t +{ + enum { k_iCallback = k_iSteamUtilsCallbacks + 14 }; + bool m_bSubmitted; // true if user entered & accepted text (Call ISteamUtils::GetEnteredGamepadTextInput() for text), false if canceled input + uint32 m_unSubmittedText; +}; + +// k_iSteamUtilsCallbacks + 15 is taken + +#pragma pack( pop ) + +#endif // ISTEAMUTILS_H diff --git a/public/steam/isteamvideo.h b/public/steam/isteamvideo.h new file mode 100644 index 000000000..6893f0b20 --- /dev/null +++ b/public/steam/isteamvideo.h @@ -0,0 +1,60 @@ +//====== Copyright © 1996-2014 Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to Steam Video +// +//============================================================================= + +#ifndef ISTEAMVIDEO_H +#define ISTEAMVIDEO_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + + + +//----------------------------------------------------------------------------- +// Purpose: Steam Video API +//----------------------------------------------------------------------------- +class ISteamVideo +{ +public: + + // Get a URL suitable for streaming the given Video app ID's video + virtual void GetVideoURL( AppId_t unVideoAppID ) = 0; + + // returns true if user is uploading a live broadcast + virtual bool IsBroadcasting( int *pnNumViewers ) = 0; +}; + +#define STEAMVIDEO_INTERFACE_VERSION "STEAMVIDEO_INTERFACE_V001" + +DEFINE_CALLBACK( BroadcastUploadStart_t, k_iClientVideoCallbacks + 4 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( BroadcastUploadStop_t, k_iClientVideoCallbacks + 5 ) + CALLBACK_MEMBER( 0, EBroadcastUploadResult, m_eResult ) +END_DEFINE_CALLBACK_1() + +DEFINE_CALLBACK( GetVideoURLResult_t, k_iClientVideoCallbacks + 11 ) + CALLBACK_MEMBER( 0, EResult, m_eResult ) + CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID ) + CALLBACK_MEMBER( 2, char, m_rgchURL[256] ) +END_DEFINE_CALLBACK_1() + + +#pragma pack( pop ) + + +#endif // ISTEAMVIDEO_H diff --git a/public/steam/matchmakingtypes.h b/public/steam/matchmakingtypes.h index 2386d669e..08d5a9669 100644 --- a/public/steam/matchmakingtypes.h +++ b/public/steam/matchmakingtypes.h @@ -1,235 +1,251 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef MATCHMAKINGTYPES_H -#define MATCHMAKINGTYPES_H - -#ifdef _WIN32 -#pragma once -#endif - -#include -#include - -struct MatchMakingKeyValuePair_t -{ - MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; } - MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue ) - { - strncpy( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only! - strncpy( m_szValue, pchValue, sizeof(m_szValue) ); - } - char m_szKey[ 256 ]; - char m_szValue[ 256 ]; -}; - - -enum EMatchMakingServerResponse -{ - eServerResponded = 0, - eServerFailedToRespond, - eNoServersListedOnMasterServer // for the Internet query type, returned in response callback if no servers of this type match -}; - -enum EMatchMakingType -{ - eInternetServer = 0, - eLANServer, - eFriendsServer, - eFavoritesServer, - eHistoryServer, - eSpectatorServer, - eInvalidServer -}; - - -// servernetadr_t is all the addressing info the serverbrowser needs to know about a game server, -// namely: its IP, its connection port, and its query port. -class servernetadr_t -{ -public: - - void Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort ); -#ifdef NETADR_H - void Init( const netadr_t &ipAndQueryPort, uint16 usConnectionPort ); - netadr_t& GetIPAndQueryPort(); -#endif - - // Access the query port. - uint16 GetQueryPort() const; - void SetQueryPort( uint16 usPort ); - - // Access the connection port. - uint16 GetConnectionPort() const; - void SetConnectionPort( uint16 usPort ); - - // Access the IP - uint32 GetIP() const; - void SetIP( uint32 ); - - // This gets the 'a.b.c.d:port' string with the connection port (instead of the query port). - const char *GetConnectionAddressString() const; - const char *GetQueryAddressString() const; - - // Comparison operators and functions. - bool operator<(const servernetadr_t &netadr) const; - void operator=( const servernetadr_t &that ) - { - m_usConnectionPort = that.m_usConnectionPort; - m_usQueryPort = that.m_usQueryPort; - m_unIP = that.m_unIP; - } - - -private: - const char *ToString( uint32 unIP, uint16 usPort ) const; - uint16 m_usConnectionPort; // (in HOST byte order) - uint16 m_usQueryPort; - uint32 m_unIP; -}; - - -inline void servernetadr_t::Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort ) -{ - m_unIP = ip; - m_usQueryPort = usQueryPort; - m_usConnectionPort = usConnectionPort; -} - -#ifdef NETADR_H -inline void servernetadr_t::Init( const netadr_t &ipAndQueryPort, uint16 usConnectionPort ) -{ - Init( ipAndQueryPort.GetIP(), ipAndQueryPort.GetPort(), usConnectionPort ); -} - -inline netadr_t& servernetadr_t::GetIPAndQueryPort() -{ - static netadr_t netAdr; - netAdr.SetIP( m_unIP ); - netAdr.SetPort( m_usQueryPort ); - return netAdr; -} -#endif - -inline uint16 servernetadr_t::GetQueryPort() const -{ - return m_usQueryPort; -} - -inline void servernetadr_t::SetQueryPort( uint16 usPort ) -{ - m_usQueryPort = usPort; -} - -inline uint16 servernetadr_t::GetConnectionPort() const -{ - return m_usConnectionPort; -} - -inline void servernetadr_t::SetConnectionPort( uint16 usPort ) -{ - m_usConnectionPort = usPort; -} - -inline uint32 servernetadr_t::GetIP() const -{ - return m_unIP; -} - -inline void servernetadr_t::SetIP( uint32 unIP ) -{ - m_unIP = unIP; -} - -inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const -{ - static char s[4][64]; - static int nBuf = 0; - unsigned char *ipByte = (unsigned char *)&unIP; - Q_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort ); - const char *pchRet = s[nBuf]; - ++nBuf; - nBuf %= ( (sizeof(s)/sizeof(s[0])) ); - return pchRet; -} - -inline const char* servernetadr_t::GetConnectionAddressString() const -{ - return ToString( m_unIP, m_usConnectionPort ); -} - -inline const char* servernetadr_t::GetQueryAddressString() const -{ - return ToString( m_unIP, m_usQueryPort ); -} - -inline bool servernetadr_t::operator<(const servernetadr_t &netadr) const -{ - return ( m_unIP < netadr.m_unIP ) || ( m_unIP == netadr.m_unIP && m_usQueryPort < netadr.m_usQueryPort ); -} - -//----------------------------------------------------------------------------- -// Purpose: Data describing a single server -//----------------------------------------------------------------------------- -class gameserveritem_t -{ -public: - gameserveritem_t(); - - const char* GetName() const; - void SetName( const char *pName ); - -public: - servernetadr_t m_NetAdr; // IP/Query Port/Connection Port for this server - int m_nPing; // current ping time in milliseconds - bool m_bHadSuccessfulResponse; // server has responded successfully in the past - bool m_bDoNotRefresh; // server is marked as not responding and should no longer be refreshed - char m_szGameDir[32]; // current game directory - char m_szMap[32]; // current map - char m_szGameDescription[64]; // game description - int m_nAppID; // Steam App ID of this server - int m_nPlayers; // current number of players on the server - int m_nMaxPlayers; // Maximum players that can join this server - int m_nBotPlayers; // Number of bots (i.e simulated players) on this server - bool m_bPassword; // true if this server needs a password to join - bool m_bSecure; // Is this server protected by VAC - uint32 m_ulTimeLastPlayed; // time (in unix time) when this server was last played on (for favorite/history servers) - int m_nServerVersion; // server version as reported to Steam - -private: - char m_szServerName[64]; // Game server name - - // For data added after SteamMatchMaking001 add it here -public: - char m_szGameTags[128]; // the tags this server exposes -}; - - -inline gameserveritem_t::gameserveritem_t() -{ - m_szGameDir[0] = m_szMap[0] = m_szGameDescription[0] = m_szServerName[0] = 0; - m_bHadSuccessfulResponse = m_bDoNotRefresh = m_bPassword = m_bSecure = false; - m_nPing = m_nAppID = m_nPlayers = m_nMaxPlayers = m_nBotPlayers = m_ulTimeLastPlayed = m_nServerVersion = 0; - m_szGameTags[0] = 0; -} - -inline const char* gameserveritem_t::GetName() const -{ - // Use the IP address as the name if nothing is set yet. - if ( m_szServerName[0] == 0 ) - return m_NetAdr.GetConnectionAddressString(); - else - return m_szServerName; -} - -inline void gameserveritem_t::SetName( const char *pName ) -{ - strncpy( m_szServerName, pName, sizeof( m_szServerName ) ); -} - - -#endif // MATCHMAKINGTYPES_H +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef MATCHMAKINGTYPES_H +#define MATCHMAKINGTYPES_H + +#ifdef _WIN32 +#pragma once +#endif + +#ifdef POSIX +#ifndef _snprintf +#define _snprintf snprintf +#endif +#endif + +#include +#include + +// +// Max size (in bytes of UTF-8 data, not in characters) of server fields, including null terminator. +// WARNING: These cannot be changed easily, without breaking clients using old interfaces. +// +const int k_cbMaxGameServerGameDir = 32; +const int k_cbMaxGameServerMapName = 32; +const int k_cbMaxGameServerGameDescription = 64; +const int k_cbMaxGameServerName = 64; +const int k_cbMaxGameServerTags = 128; +const int k_cbMaxGameServerGameData = 2048; + +/// Store key/value pair used in matchmaking queries. +/// +/// Actually, the name Key/Value is a bit misleading. The "key" is better +/// understood as "filter operation code" and the "value" is the operand to this +/// filter operation. The meaning of the operand depends upon the filter. +struct MatchMakingKeyValuePair_t +{ + MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; } + MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue ) + { + strncpy( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only! + m_szKey[ sizeof( m_szKey ) - 1 ] = '\0'; + strncpy( m_szValue, pchValue, sizeof(m_szValue) ); + m_szValue[ sizeof( m_szValue ) - 1 ] = '\0'; + } + char m_szKey[ 256 ]; + char m_szValue[ 256 ]; +}; + + +enum EMatchMakingServerResponse +{ + eServerResponded = 0, + eServerFailedToRespond, + eNoServersListedOnMasterServer // for the Internet query type, returned in response callback if no servers of this type match +}; + +// servernetadr_t is all the addressing info the serverbrowser needs to know about a game server, +// namely: its IP, its connection port, and its query port. +class servernetadr_t +{ +public: + + servernetadr_t() : m_usConnectionPort( 0 ), m_usQueryPort( 0 ), m_unIP( 0 ) {} + + void Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort ); +#ifdef NETADR_H + netadr_t GetIPAndQueryPort(); +#endif + + // Access the query port. + uint16 GetQueryPort() const; + void SetQueryPort( uint16 usPort ); + + // Access the connection port. + uint16 GetConnectionPort() const; + void SetConnectionPort( uint16 usPort ); + + // Access the IP + uint32 GetIP() const; + void SetIP( uint32 ); + + // This gets the 'a.b.c.d:port' string with the connection port (instead of the query port). + const char *GetConnectionAddressString() const; + const char *GetQueryAddressString() const; + + // Comparison operators and functions. + bool operator<(const servernetadr_t &netadr) const; + void operator=( const servernetadr_t &that ) + { + m_usConnectionPort = that.m_usConnectionPort; + m_usQueryPort = that.m_usQueryPort; + m_unIP = that.m_unIP; + } + + +private: + const char *ToString( uint32 unIP, uint16 usPort ) const; + uint16 m_usConnectionPort; // (in HOST byte order) + uint16 m_usQueryPort; + uint32 m_unIP; +}; + + +inline void servernetadr_t::Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort ) +{ + m_unIP = ip; + m_usQueryPort = usQueryPort; + m_usConnectionPort = usConnectionPort; +} + +#ifdef NETADR_H +inline netadr_t servernetadr_t::GetIPAndQueryPort() +{ + return netadr_t( m_unIP, m_usQueryPort ); +} +#endif + +inline uint16 servernetadr_t::GetQueryPort() const +{ + return m_usQueryPort; +} + +inline void servernetadr_t::SetQueryPort( uint16 usPort ) +{ + m_usQueryPort = usPort; +} + +inline uint16 servernetadr_t::GetConnectionPort() const +{ + return m_usConnectionPort; +} + +inline void servernetadr_t::SetConnectionPort( uint16 usPort ) +{ + m_usConnectionPort = usPort; +} + +inline uint32 servernetadr_t::GetIP() const +{ + return m_unIP; +} + +inline void servernetadr_t::SetIP( uint32 unIP ) +{ + m_unIP = unIP; +} + +inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const +{ + static char s[4][64]; + static int nBuf = 0; + unsigned char *ipByte = (unsigned char *)&unIP; +#ifdef VALVE_BIG_ENDIAN + V_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort ); +#else + V_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort ); +#endif + const char *pchRet = s[nBuf]; + ++nBuf; + nBuf %= ( (sizeof(s)/sizeof(s[0])) ); + return pchRet; +} + +inline const char* servernetadr_t::GetConnectionAddressString() const +{ + return ToString( m_unIP, m_usConnectionPort ); +} + +inline const char* servernetadr_t::GetQueryAddressString() const +{ + return ToString( m_unIP, m_usQueryPort ); +} + +inline bool servernetadr_t::operator<(const servernetadr_t &netadr) const +{ + return ( m_unIP < netadr.m_unIP ) || ( m_unIP == netadr.m_unIP && m_usQueryPort < netadr.m_usQueryPort ); +} + +//----------------------------------------------------------------------------- +// Purpose: Data describing a single server +//----------------------------------------------------------------------------- +class gameserveritem_t +{ +public: + gameserveritem_t(); + + const char* GetName() const; + void SetName( const char *pName ); + +public: + servernetadr_t m_NetAdr; ///< IP/Query Port/Connection Port for this server + int m_nPing; ///< current ping time in milliseconds + bool m_bHadSuccessfulResponse; ///< server has responded successfully in the past + bool m_bDoNotRefresh; ///< server is marked as not responding and should no longer be refreshed + char m_szGameDir[k_cbMaxGameServerGameDir]; ///< current game directory + char m_szMap[k_cbMaxGameServerMapName]; ///< current map + char m_szGameDescription[k_cbMaxGameServerGameDescription]; ///< game description + uint32 m_nAppID; ///< Steam App ID of this server + int m_nPlayers; ///< total number of players currently on the server. INCLUDES BOTS!! + int m_nMaxPlayers; ///< Maximum players that can join this server + int m_nBotPlayers; ///< Number of bots (i.e simulated players) on this server + bool m_bPassword; ///< true if this server needs a password to join + bool m_bSecure; ///< Is this server protected by VAC + uint32 m_ulTimeLastPlayed; ///< time (in unix time) when this server was last played on (for favorite/history servers) + int m_nServerVersion; ///< server version as reported to Steam + +private: + + /// Game server name + char m_szServerName[k_cbMaxGameServerName]; + + // For data added after SteamMatchMaking001 add it here +public: + /// the tags this server exposes + char m_szGameTags[k_cbMaxGameServerTags]; + + /// steamID of the game server - invalid if it's doesn't have one (old server, or not connected to Steam) + CSteamID m_steamID; +}; + + +inline gameserveritem_t::gameserveritem_t() +{ + m_szGameDir[0] = m_szMap[0] = m_szGameDescription[0] = m_szServerName[0] = 0; + m_bHadSuccessfulResponse = m_bDoNotRefresh = m_bPassword = m_bSecure = false; + m_nPing = m_nAppID = m_nPlayers = m_nMaxPlayers = m_nBotPlayers = m_ulTimeLastPlayed = m_nServerVersion = 0; + m_szGameTags[0] = 0; +} + +inline const char* gameserveritem_t::GetName() const +{ + // Use the IP address as the name if nothing is set yet. + if ( m_szServerName[0] == 0 ) + return m_NetAdr.GetConnectionAddressString(); + else + return m_szServerName; +} + +inline void gameserveritem_t::SetName( const char *pName ) +{ + strncpy( m_szServerName, pName, sizeof( m_szServerName ) ); + m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0'; +} + + +#endif // MATCHMAKINGTYPES_H diff --git a/public/steam/steam_api.h b/public/steam/steam_api.h index 4b410d317..f3872501c 100644 --- a/public/steam/steam_api.h +++ b/public/steam/steam_api.h @@ -1,295 +1,650 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: -// -//============================================================================= - -#ifndef STEAM_API_H -#define STEAM_API_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" -#include "isteamuser.h" -#include "isteamfriends.h" -#include "isteamutils.h" -#include "isteammatchmaking.h" -#include "isteamuserstats.h" -#include "isteamapps.h" - -// Steam API export macro -#if defined( _WIN32 ) && !defined( _X360 ) - #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" __declspec( dllexport ) - #elif defined( STEAM_API_NODLL ) - #define S_API extern "C" - #else - #define S_API extern "C" __declspec( dllimport ) - #endif // STEAM_API_EXPORTS -#else // !WIN32 - #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" - #else - #define S_API extern "C" - #endif // STEAM_API_EXPORTS -#endif - -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// Steam API setup & teardown -// -// These functions manage loading, initializing and shutdown of the steamclient.dll -// -// bugbug johnc: seperate defining these to defining game server interface more cleanly -// -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -S_API void SteamAPI_Shutdown(); - -S_API void SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ); -S_API void SteamAPI_SetMiniDumpComment( const char *pchMsg ); - -// interface pointers, configured by SteamAPI_Init() -S_API ISteamClient *SteamClient(); - - -// -// VERSION_SAFE_STEAM_API_INTERFACES is usually not necessary, but it provides safety against releasing -// new steam_api.dll's without recompiling/rereleasing modules that use it. -// -// If you use VERSION_SAFE_STEAM_API_INTERFACES, then you should call SteamAPI_InitSafe(). Also, to get the -// Steam interfaces, you must create and Init() a CSteamAPIContext (below) and use the interfaces in there. -// -// If you don't use VERSION_SAFE_STEAM_API_INTERFACES, then you can use SteamAPI_Init() and the SteamXXXX() -// functions below to get at the Steam interfaces. -// -#ifdef VERSION_SAFE_STEAM_API_INTERFACES -S_API bool SteamAPI_InitSafe(); -#else -S_API bool SteamAPI_Init(); - -S_API ISteamUser *SteamUser(); -S_API ISteamFriends *SteamFriends(); -S_API ISteamUtils *SteamUtils(); -S_API ISteamMatchmaking *SteamMatchmaking(); -S_API ISteamUserStats *SteamUserStats(); -S_API ISteamApps *SteamApps(); -S_API ISteamMatchmakingServers *SteamMatchmakingServers(); -#endif // VERSION_SAFE_STEAM_API_INTERFACES - -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steam callback helper functions -// -// These following classes/macros are used to be able to easily multiplex callbacks -// from the Steam API into various objects in the app in a thread-safe manner -// -// This functors are triggered via the SteamAPI_RunCallbacks() function, mapping the callback -// to as many functions/objects as are registered to it -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -S_API void SteamAPI_RunCallbacks(); - - - -// functions used by the utility CCallback objects to receive callbacks -S_API void SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); -S_API void SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); - -//----------------------------------------------------------------------------- -// Purpose: base for callbacks, -// used only by CCallback, shouldn't be used directly -//----------------------------------------------------------------------------- -class CCallbackBase -{ -public: - CCallbackBase() { m_nCallbackFlags = 0; } - // don't add a virtual destructor because we export this binary interface across dll's - virtual void Run( void *pvParam ) = 0; - -protected: - enum { k_ECallbackFlagsRegistered = 0x01, k_ECallbackFlagsGameServer = 0x02 }; - uint8 m_nCallbackFlags; -private: - int m_iCallback; - friend class CCallbackMgr; -}; - - -//----------------------------------------------------------------------------- -// Purpose: maps a steam callback to a class member function -// template params: T = local class, P = parameter struct -//----------------------------------------------------------------------------- -template< class T, class P, bool bGameServer > -class CCallback : private CCallbackBase -{ -public: - typedef void (T::*func_t)( P* ); - - // If you can't support constructing a callback with the correct parameters - // then uncomment the empty constructor below and manually call - // ::Register() for your object - //CCallback() {} - - // constructor for initializing this object in owner's constructor - CCallback( T *pObj, func_t func ) : m_pObj( pObj ), m_Func( func ) - { - if ( bGameServer ) - { - m_nCallbackFlags |= k_ECallbackFlagsGameServer; - } - - Register( pObj, func ); - } - - ~CCallback() - { - SteamAPI_UnregisterCallback( this ); - } - - // manual registration of the callback - void Register( T *pObj, func_t func ) - { - m_pObj = pObj; - m_Func = func; - SteamAPI_RegisterCallback( this, P::k_iCallback ); - } - -private: - virtual void Run( void *pvParam ) - { - (m_pObj->*m_Func)( (P *)pvParam ); - } - - T *m_pObj; - func_t m_Func; -}; - - -// utility macro for declaring the function and callback object together -#define STEAM_CALLBACK( thisclass, func, param, var ) CCallback< thisclass, param, false > var; void func( param *pParam ) - - - - -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steamclient.dll private wrapper functions -// -// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -// pumps out all the steam messages, calling the register callback -S_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks ); - -// register the callback funcs to use to interact with the steam dll -S_API void Steam_RegisterInterfaceFuncs( void *hModule ); - -// returns the HSteamUser of the last user to dispatch a callback -S_API HSteamUser Steam_GetHSteamUserCurrent(); - -// returns the filename path of the current running Steam process, used if you need to load an explicit steam dll by name -S_API const char *SteamAPI_GetSteamInstallPath(); - - -#ifdef VERSION_SAFE_STEAM_API_INTERFACES -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// VERSION_SAFE_STEAM_API_INTERFACES uses CSteamAPIContext to provide interfaces to each module in a way that -// lets them each specify the interface versions they are compiled with. -// -// It's important that these stay inlined in the header so the calling module specifies the interface versions -// for whatever Steam API version it has. -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -#if defined( _WIN32 ) && !defined( _X360 ) - S_API HSteamPipe GetHSteamPipe(); - S_API HSteamUser GetHSteamUser(); -#endif - -class CSteamAPIContext -{ -public: - CSteamAPIContext(); - void Clear(); - - bool Init(); - - ISteamUser* SteamUser() { return m_pSteamUser; } - ISteamFriends* SteamFriends() { return m_pSteamFriends; } - ISteamUtils* SteamUtils() { return m_pSteamUtils; } - ISteamMatchmaking* SteamMatchmaking() { return m_pSteamMatchmaking; } - ISteamUserStats* SteamUserStats() { return m_pSteamUserStats; } - ISteamApps* SteamApps() { return m_pSteamApps; } - ISteamMatchmakingServers* SteamMatchmakingServers() { return m_pSteamMatchmakingServers; } - -private: - ISteamUser *m_pSteamUser; - ISteamFriends *m_pSteamFriends; - ISteamUtils *m_pSteamUtils; - ISteamMatchmaking *m_pSteamMatchmaking; - ISteamUserStats *m_pSteamUserStats; - ISteamApps *m_pSteamApps; - ISteamMatchmakingServers *m_pSteamMatchmakingServers; -}; - -inline CSteamAPIContext::CSteamAPIContext() -{ - Clear(); -} - -inline void CSteamAPIContext::Clear() -{ - m_pSteamUser = NULL; - m_pSteamFriends = NULL; - m_pSteamUtils = NULL; - m_pSteamMatchmaking = NULL; - m_pSteamUserStats = NULL; - m_pSteamApps = NULL; - m_pSteamMatchmakingServers = NULL; -} - -// This function must be inlined so the module using steam_api.dll gets the version names they want. -inline bool CSteamAPIContext::Init() -{ -#if defined( _WIN32 ) && !defined( _X360 ) - - if ( !SteamClient() ) - return false; - - HSteamUser hSteamUser = GetHSteamUser(); - HSteamPipe hSteamPipe = GetHSteamPipe(); - - m_pSteamUser = SteamClient()->GetISteamUser( hSteamUser, hSteamPipe, STEAMUSER_INTERFACE_VERSION ); - if ( !m_pSteamUser ) - return false; - - m_pSteamFriends = SteamClient()->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION ); - if ( !m_pSteamFriends ) - return false; - - m_pSteamUtils = SteamClient()->GetISteamUtils( hSteamUser, STEAMUTILS_INTERFACE_VERSION ); - if ( !m_pSteamUtils ) - return false; - - m_pSteamMatchmaking = SteamClient()->GetISteamMatchmaking( hSteamUser, hSteamPipe, STEAMMATCHMAKING_INTERFACE_VERSION ); - if ( !m_pSteamMatchmaking ) - return false; - - m_pSteamMatchmakingServers = SteamClient()->GetISteamMatchmakingServers( hSteamUser, hSteamPipe, STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION ); - if ( !m_pSteamMatchmakingServers ) - return false; - - m_pSteamUserStats = SteamClient()->GetISteamUserStats( hSteamUser, hSteamPipe, STEAMUSERSTATS_INTERFACE_VERSION ); - if ( !m_pSteamUserStats ) - return false; - - m_pSteamApps = SteamClient()->GetISteamApps( hSteamUser, hSteamPipe, STEAMAPPS_INTERFACE_VERSION ); - if ( !m_pSteamApps ) - return false; - - return true; -#else - return false; -#endif -} - -#endif // VERSION_SAFE_STEAM_API_INTERFACES - -#endif // STEAM_API_H +//====== Copyright 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: +// +//============================================================================= + +#ifndef STEAM_API_H +#define STEAM_API_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" +#include "isteamuser.h" +#include "isteamfriends.h" +#include "isteamutils.h" +#include "isteammatchmaking.h" +#include "isteamuserstats.h" +#include "isteamapps.h" +#include "isteamnetworking.h" +#include "isteamremotestorage.h" +#include "isteamscreenshots.h" +#include "isteammusic.h" +#include "isteammusicremote.h" +#include "isteamhttp.h" +#include "isteamunifiedmessages.h" +#include "isteamcontroller.h" +#include "isteamugc.h" +#include "isteamapplist.h" +#include "isteamhtmlsurface.h" +#include "isteaminventory.h" +#include "isteamvideo.h" + +#if defined( _PS3 ) +#include "steamps3params.h" +#endif + +// Steam API export macro +#if defined( _WIN32 ) && !defined( _X360 ) + #if defined( STEAM_API_EXPORTS ) + #define S_API extern "C" __declspec( dllexport ) + #elif defined( STEAM_API_NODLL ) + #define S_API extern "C" + #else + #define S_API extern "C" __declspec( dllimport ) + #endif // STEAM_API_EXPORTS +#elif defined( GNUC ) + #if defined( STEAM_API_EXPORTS ) + #define S_API extern "C" __attribute__ ((visibility("default"))) + #else + #define S_API extern "C" + #endif // STEAM_API_EXPORTS +#else // !WIN32 + #if defined( STEAM_API_EXPORTS ) + #define S_API extern "C" + #else + #define S_API extern "C" + #endif // STEAM_API_EXPORTS +#endif + +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// Steam API setup & shutdown +// +// These functions manage loading, initializing and shutdown of the steamclient.dll +// +//----------------------------------------------------------------------------------------------------------------------------------------------------------// + +// S_API void SteamAPI_Init(); (see below) +S_API void S_CALLTYPE SteamAPI_Shutdown(); + +// checks if a local Steam client is running +S_API bool S_CALLTYPE SteamAPI_IsSteamRunning(); + +// Detects if your executable was launched through the Steam client, and restarts your game through +// the client if necessary. The Steam client will be started if it is not running. +// +// Returns: true if your executable was NOT launched through the Steam client. This function will +// then start your application through the client. Your current process should exit. +// +// false if your executable was started through the Steam client or a steam_appid.txt file +// is present in your game's directory (for development). Your current process should continue. +// +// NOTE: This function should be used only if you are using CEG or not using Steam's DRM. Once applied +// to your executable, Steam's DRM will handle restarting through Steam if necessary. +S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID ); + +// crash dump recording functions +S_API void S_CALLTYPE SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ); +S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg ); + +// interface pointers, configured by SteamAPI_Init() +S_API ISteamClient *S_CALLTYPE SteamClient(); + + +// +// VERSION_SAFE_STEAM_API_INTERFACES is usually not necessary, but it provides safety against releasing +// new steam_api.dll's without recompiling/rereleasing modules that use it. +// +// If you use VERSION_SAFE_STEAM_API_INTERFACES, then you should call SteamAPI_InitSafe(). Also, to get the +// Steam interfaces, you must create and Init() a CSteamAPIContext (below) and use the interfaces in there. +// +// If you don't use VERSION_SAFE_STEAM_API_INTERFACES, then you can use SteamAPI_Init() and the SteamXXXX() +// functions below to get at the Steam interfaces. +// +#ifdef VERSION_SAFE_STEAM_API_INTERFACES +S_API bool S_CALLTYPE SteamAPI_InitSafe(); +#else + +#if defined(_PS3) +S_API bool S_CALLTYPE SteamAPI_Init( SteamPS3Params_t *pParams ); +#else +S_API bool S_CALLTYPE SteamAPI_Init(); +#endif + +S_API ISteamUser *S_CALLTYPE SteamUser(); +S_API ISteamFriends *S_CALLTYPE SteamFriends(); +S_API ISteamUtils *S_CALLTYPE SteamUtils(); +S_API ISteamMatchmaking *S_CALLTYPE SteamMatchmaking(); +S_API ISteamUserStats *S_CALLTYPE SteamUserStats(); +S_API ISteamApps *S_CALLTYPE SteamApps(); +S_API ISteamNetworking *S_CALLTYPE SteamNetworking(); +S_API ISteamMatchmakingServers *S_CALLTYPE SteamMatchmakingServers(); +S_API ISteamRemoteStorage *S_CALLTYPE SteamRemoteStorage(); +S_API ISteamScreenshots *S_CALLTYPE SteamScreenshots(); +S_API ISteamHTTP *S_CALLTYPE SteamHTTP(); +S_API ISteamUnifiedMessages *S_CALLTYPE SteamUnifiedMessages(); +S_API ISteamController *S_CALLTYPE SteamController(); +S_API ISteamUGC *S_CALLTYPE SteamUGC(); +S_API ISteamAppList *S_CALLTYPE SteamAppList(); +S_API ISteamMusic *S_CALLTYPE SteamMusic(); +S_API ISteamMusicRemote *S_CALLTYPE SteamMusicRemote(); +S_API ISteamHTMLSurface *S_CALLTYPE SteamHTMLSurface(); +S_API ISteamInventory *S_CALLTYPE SteamInventory(); +S_API ISteamVideo *S_CALLTYPE SteamVideo(); +#ifdef _PS3 +S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender(); +#endif +#endif // VERSION_SAFE_STEAM_API_INTERFACES + + +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// steam callback and call-result helpers +// +// The following macros and classes are used to register your application for +// callbacks and call-results, which are delivered in a predictable manner. +// +// STEAM_CALLBACK macros are meant for use inside of a C++ class definition. +// They map a Steam notification callback directly to a class member function +// which is automatically prototyped as "void func( callback_type *pParam )". +// +// CCallResult is used with specific Steam APIs that return "result handles". +// The handle can be passed to a CCallResult object's Set function, along with +// an object pointer and member-function pointer. The member function will +// be executed once the results of the Steam API call are available. +// +// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK +// macros if you require finer control over registration and unregistration. +// +// Callbacks and call-results are queued automatically and are only +// delivered/executed when your application calls SteamAPI_RunCallbacks(). +//----------------------------------------------------------------------------------------------------------------------------------------------------------// + +S_API void S_CALLTYPE SteamAPI_RunCallbacks(); + + + +// Declares a callback member function plus a helper member variable which +// registers the callback on object creation and unregisters on destruction. +// The optional fourth 'var' param exists only for backwards-compatibility +// and can be ignored. +#define STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \ + _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) ) + +// Declares a callback function and a named CCallbackManual variable which +// has Register and Unregister functions instead of automatic registration. +#define STEAM_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \ + CCallbackManual< thisclass, callback_type > var; void func( callback_type *pParam ) + + +// Internal functions used by the utility CCallback objects to receive callbacks +S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); +S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); +// Internal functions used by the utility CCallResult objects to receive async call results +S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); +S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); + + +//----------------------------------------------------------------------------- +// Purpose: base for callbacks and call results - internal implementation detail +//----------------------------------------------------------------------------- +class CCallbackBase +{ +public: + CCallbackBase() { m_nCallbackFlags = 0; m_iCallback = 0; } + // don't add a virtual destructor because we export this binary interface across dll's + virtual void Run( void *pvParam ) = 0; + virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) = 0; + int GetICallback() { return m_iCallback; } + virtual int GetCallbackSizeBytes() = 0; + +protected: + enum { k_ECallbackFlagsRegistered = 0x01, k_ECallbackFlagsGameServer = 0x02 }; + uint8 m_nCallbackFlags; + int m_iCallback; + friend class CCallbackMgr; + +private: + CCallbackBase( const CCallbackBase& ); + CCallbackBase& operator=( const CCallbackBase& ); +}; + +//----------------------------------------------------------------------------- +// Purpose: templated base for callbacks - internal implementation detail +//----------------------------------------------------------------------------- +template< int sizeof_P > +class CCallbackImpl : protected CCallbackBase +{ +public: + ~CCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) SteamAPI_UnregisterCallback( this ); } + void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; } + +protected: + virtual void Run( void *pvParam ) = 0; + virtual void Run( void *pvParam, bool /*bIOFailure*/, SteamAPICall_t /*hSteamAPICall*/ ) { Run( pvParam ); } + virtual int GetCallbackSizeBytes() { return sizeof_P; } +}; + + +//----------------------------------------------------------------------------- +// Purpose: maps a steam async call result to a class member function +// template params: T = local class, P = parameter struct +//----------------------------------------------------------------------------- +template< class T, class P > +class CCallResult : private CCallbackBase +{ +public: + typedef void (T::*func_t)( P*, bool ); + + CCallResult() + { + m_hAPICall = k_uAPICallInvalid; + m_pObj = NULL; + m_Func = NULL; + m_iCallback = P::k_iCallback; + } + + void Set( SteamAPICall_t hAPICall, T *p, func_t func ) + { + if ( m_hAPICall ) + SteamAPI_UnregisterCallResult( this, m_hAPICall ); + + m_hAPICall = hAPICall; + m_pObj = p; + m_Func = func; + + if ( hAPICall ) + SteamAPI_RegisterCallResult( this, hAPICall ); + } + + bool IsActive() const + { + return ( m_hAPICall != k_uAPICallInvalid ); + } + + void Cancel() + { + if ( m_hAPICall != k_uAPICallInvalid ) + { + SteamAPI_UnregisterCallResult( this, m_hAPICall ); + m_hAPICall = k_uAPICallInvalid; + } + + } + + ~CCallResult() + { + Cancel(); + } + + void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; } +private: + virtual void Run( void *pvParam ) + { + m_hAPICall = k_uAPICallInvalid; // caller unregisters for us + (m_pObj->*m_Func)( (P *)pvParam, false ); + } + virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) + { + if ( hSteamAPICall == m_hAPICall ) + { + m_hAPICall = k_uAPICallInvalid; // caller unregisters for us + (m_pObj->*m_Func)( (P *)pvParam, bIOFailure ); + } + } + virtual int GetCallbackSizeBytes() + { + return sizeof( P ); + } + + SteamAPICall_t m_hAPICall; + T *m_pObj; + func_t m_Func; +}; + + + +//----------------------------------------------------------------------------- +// Purpose: maps a steam callback to a class member function +// template params: T = local class, P = parameter struct, +// bGameserver = listen for gameserver callbacks instead of client callbacks +//----------------------------------------------------------------------------- +template< class T, class P, bool bGameserver = false > +class CCallback : public CCallbackImpl< sizeof( P ) > +{ +public: + typedef void (T::*func_t)(P*); + + // NOTE: If you can't provide the correct parameters at construction time, you should + // use the CCallbackManual callback object (STEAM_CALLBACK_MANUAL macro) instead. + CCallback( T *pObj, func_t func ) : m_pObj( NULL ), m_Func( NULL ) + { + if ( bGameserver ) + { + this->SetGameserverFlag(); + } + Register( pObj, func ); + } + + // manual registration of the callback + void Register( T *pObj, func_t func ) + { + if ( !pObj || !func ) + return; + + if ( this->m_nCallbackFlags & CCallbackBase::k_ECallbackFlagsRegistered ) + Unregister(); + + m_pObj = pObj; + m_Func = func; + // SteamAPI_RegisterCallback sets k_ECallbackFlagsRegistered + SteamAPI_RegisterCallback( this, P::k_iCallback ); + } + + void Unregister() + { + // SteamAPI_UnregisterCallback removes k_ECallbackFlagsRegistered + SteamAPI_UnregisterCallback( this ); + } + +protected: + virtual void Run( void *pvParam ) + { + (m_pObj->*m_Func)( (P *)pvParam ); + } + + T *m_pObj; + func_t m_Func; +}; + + +//----------------------------------------------------------------------------- +// Purpose: subclass of CCallback which allows default-construction in +// an unregistered state; you must call Register manually +//----------------------------------------------------------------------------- +template< class T, class P, bool bGameServer = false > +class CCallbackManual : public CCallback< T, P, bGameServer > +{ +public: + CCallbackManual() : CCallback< T, P, bGameServer >( NULL, NULL ) {} + + // Inherits public Register and Unregister functions from base class +}; + + + +//----------------------------------------------------------------------------- +// The following macros are implementation details, not intended for public use +//----------------------------------------------------------------------------- +#define _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) +#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED +#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y +#define _STEAM_CALLBACK_3( extra_code, thisclass, func, param ) \ + struct CCallbackInternal_ ## func : private CCallbackImpl< sizeof( param ) > { \ + CCallbackInternal_ ## func () { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \ + CCallbackInternal_ ## func ( const CCallbackInternal_ ## func & ) { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \ + CCallbackInternal_ ## func & operator=( const CCallbackInternal_ ## func & ) { return *this; } \ + private: virtual void Run( void *pvParam ) { _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) \ + thisclass *pOuter = reinterpret_cast( reinterpret_cast(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \ + pOuter->func( reinterpret_cast( pvParam ) ); \ + } \ + } m_steamcallback_ ## func ; void func( param *pParam ) +#define _STEAM_CALLBACK_4( _, thisclass, func, param, var ) \ + CCallback< thisclass, param > var; void func( param *pParam ) + + +#ifdef _WIN32 +// disable this warning; this pattern need for steam callback registration +#pragma warning( disable: 4355 ) // 'this' : used in base member initializer list +#endif + + +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// steamclient.dll private wrapper functions +// +// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases +//----------------------------------------------------------------------------------------------------------------------------------------------------------// + +// pumps out all the steam messages, calling the register callback +S_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks ); + +// register the callback funcs to use to interact with the steam dll +S_API void Steam_RegisterInterfaceFuncs( void *hModule ); + +// returns the HSteamUser of the last user to dispatch a callback +S_API HSteamUser Steam_GetHSteamUserCurrent(); + +// returns the filename path of the current running Steam process, used if you need to load an explicit steam dll by name +S_API const char *SteamAPI_GetSteamInstallPath(); + +// returns the pipe we are communicating to Steam with +S_API HSteamPipe SteamAPI_GetHSteamPipe(); + +// sets whether or not Steam_RunCallbacks() should do a try {} catch (...) {} around calls to issuing callbacks +S_API void SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks ); + +// backwards compat export, passes through to SteamAPI_ variants +S_API HSteamPipe GetHSteamPipe(); +S_API HSteamUser GetHSteamUser(); + +#ifdef VERSION_SAFE_STEAM_API_INTERFACES +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// VERSION_SAFE_STEAM_API_INTERFACES uses CSteamAPIContext to provide interfaces to each module in a way that +// lets them each specify the interface versions they are compiled with. +// +// It's important that these stay inlined in the header so the calling module specifies the interface versions +// for whatever Steam API version it has. +//----------------------------------------------------------------------------------------------------------------------------------------------------------// + +S_API HSteamUser SteamAPI_GetHSteamUser(); + +class CSteamAPIContext +{ +public: + CSteamAPIContext(); + void Clear(); + + bool Init(); + + ISteamUser* SteamUser() { return m_pSteamUser; } + ISteamFriends* SteamFriends() { return m_pSteamFriends; } + ISteamUtils* SteamUtils() { return m_pSteamUtils; } + ISteamMatchmaking* SteamMatchmaking() { return m_pSteamMatchmaking; } + ISteamUserStats* SteamUserStats() { return m_pSteamUserStats; } + ISteamApps* SteamApps() { return m_pSteamApps; } + ISteamMatchmakingServers* SteamMatchmakingServers() { return m_pSteamMatchmakingServers; } + ISteamNetworking* SteamNetworking() { return m_pSteamNetworking; } + ISteamRemoteStorage* SteamRemoteStorage() { return m_pSteamRemoteStorage; } + ISteamScreenshots* SteamScreenshots() { return m_pSteamScreenshots; } + ISteamHTTP* SteamHTTP() { return m_pSteamHTTP; } + ISteamUnifiedMessages* SteamUnifiedMessages() { return m_pSteamUnifiedMessages; } + ISteamController* SteamController() { return m_pController; } + ISteamUGC* SteamUGC() { return m_pSteamUGC; } + ISteamAppList* SteamAppList() { return m_pSteamAppList; } + ISteamMusic* SteamMusic() { return m_pSteamMusic; } + ISteamMusicRemote* SteamMusicRemote() { return m_pSteamMusicRemote; } + ISteamHTMLSurface* SteamHTMLSurface() { return m_pSteamHTMLSurface; } + ISteamInventory* SteamInventory() { return m_pSteamInventory; } + ISteamVideo* SteamVideo() { return m_pSteamVideo; } +#ifdef _PS3 + ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; } +#endif + +private: + ISteamUser *m_pSteamUser; + ISteamFriends *m_pSteamFriends; + ISteamUtils *m_pSteamUtils; + ISteamMatchmaking *m_pSteamMatchmaking; + ISteamUserStats *m_pSteamUserStats; + ISteamApps *m_pSteamApps; + ISteamMatchmakingServers *m_pSteamMatchmakingServers; + ISteamNetworking *m_pSteamNetworking; + ISteamRemoteStorage *m_pSteamRemoteStorage; + ISteamScreenshots *m_pSteamScreenshots; + ISteamHTTP *m_pSteamHTTP; + ISteamUnifiedMessages*m_pSteamUnifiedMessages; + ISteamController *m_pController; + ISteamUGC *m_pSteamUGC; + ISteamAppList *m_pSteamAppList; + ISteamMusic *m_pSteamMusic; + ISteamMusicRemote *m_pSteamMusicRemote; + ISteamHTMLSurface *m_pSteamHTMLSurface; + ISteamInventory *m_pSteamInventory; + ISteamVideo *m_pSteamVideo; +#ifdef _PS3 + ISteamPS3OverlayRender *m_pSteamPS3OverlayRender; +#endif +}; + +inline CSteamAPIContext::CSteamAPIContext() +{ + Clear(); +} + +inline void CSteamAPIContext::Clear() +{ + m_pSteamUser = NULL; + m_pSteamFriends = NULL; + m_pSteamUtils = NULL; + m_pSteamMatchmaking = NULL; + m_pSteamUserStats = NULL; + m_pSteamApps = NULL; + m_pSteamMatchmakingServers = NULL; + m_pSteamNetworking = NULL; + m_pSteamRemoteStorage = NULL; + m_pSteamHTTP = NULL; + m_pSteamScreenshots = NULL; + m_pSteamMusic = NULL; + m_pSteamUnifiedMessages = NULL; + m_pController = NULL; + m_pSteamUGC = NULL; + m_pSteamAppList = NULL; + m_pSteamMusic = NULL; + m_pSteamMusicRemote= NULL; + m_pSteamHTMLSurface = NULL; + m_pSteamInventory = NULL; +#ifdef _PS3 + m_pSteamPS3OverlayRender = NULL; +#endif +} + +// This function must be inlined so the module using steam_api.dll gets the version names they want. +inline bool CSteamAPIContext::Init() +{ + if ( !SteamClient() ) + return false; + + HSteamUser hSteamUser = SteamAPI_GetHSteamUser(); + HSteamPipe hSteamPipe = SteamAPI_GetHSteamPipe(); + + m_pSteamUser = SteamClient()->GetISteamUser( hSteamUser, hSteamPipe, STEAMUSER_INTERFACE_VERSION ); + if ( !m_pSteamUser ) + return false; + + m_pSteamFriends = SteamClient()->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION ); + if ( !m_pSteamFriends ) + return false; + + m_pSteamUtils = SteamClient()->GetISteamUtils( hSteamPipe, STEAMUTILS_INTERFACE_VERSION ); + if ( !m_pSteamUtils ) + return false; + + m_pSteamMatchmaking = SteamClient()->GetISteamMatchmaking( hSteamUser, hSteamPipe, STEAMMATCHMAKING_INTERFACE_VERSION ); + if ( !m_pSteamMatchmaking ) + return false; + + m_pSteamMatchmakingServers = SteamClient()->GetISteamMatchmakingServers( hSteamUser, hSteamPipe, STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION ); + if ( !m_pSteamMatchmakingServers ) + return false; + + m_pSteamUserStats = SteamClient()->GetISteamUserStats( hSteamUser, hSteamPipe, STEAMUSERSTATS_INTERFACE_VERSION ); + if ( !m_pSteamUserStats ) + return false; + + m_pSteamApps = SteamClient()->GetISteamApps( hSteamUser, hSteamPipe, STEAMAPPS_INTERFACE_VERSION ); + if ( !m_pSteamApps ) + return false; + + m_pSteamNetworking = SteamClient()->GetISteamNetworking( hSteamUser, hSteamPipe, STEAMNETWORKING_INTERFACE_VERSION ); + if ( !m_pSteamNetworking ) + return false; + + m_pSteamRemoteStorage = SteamClient()->GetISteamRemoteStorage( hSteamUser, hSteamPipe, STEAMREMOTESTORAGE_INTERFACE_VERSION ); + if ( !m_pSteamRemoteStorage ) + return false; + + m_pSteamScreenshots = SteamClient()->GetISteamScreenshots( hSteamUser, hSteamPipe, STEAMSCREENSHOTS_INTERFACE_VERSION ); + if ( !m_pSteamScreenshots ) + return false; + + m_pSteamHTTP = SteamClient()->GetISteamHTTP( hSteamUser, hSteamPipe, STEAMHTTP_INTERFACE_VERSION ); + if ( !m_pSteamHTTP ) + return false; + + m_pSteamUnifiedMessages = SteamClient()->GetISteamUnifiedMessages( hSteamUser, hSteamPipe, STEAMUNIFIEDMESSAGES_INTERFACE_VERSION ); + if ( !m_pSteamUnifiedMessages ) + return false; + + m_pController = SteamClient()->GetISteamController( hSteamUser, hSteamPipe, STEAMCONTROLLER_INTERFACE_VERSION ); + if ( !m_pController ) + return false; + + m_pSteamUGC = SteamClient()->GetISteamUGC( hSteamUser, hSteamPipe, STEAMUGC_INTERFACE_VERSION ); + if ( !m_pSteamUGC ) + return false; + + m_pSteamAppList = SteamClient()->GetISteamAppList( hSteamUser, hSteamPipe, STEAMAPPLIST_INTERFACE_VERSION ); + if ( !m_pSteamAppList ) + return false; + + m_pSteamMusic = SteamClient()->GetISteamMusic( hSteamUser, hSteamPipe, STEAMMUSIC_INTERFACE_VERSION ); + if ( !m_pSteamMusic ) + { + return false; + } + + m_pSteamMusicRemote = SteamClient()->GetISteamMusicRemote( hSteamUser, hSteamPipe, STEAMMUSICREMOTE_INTERFACE_VERSION ); + if ( !m_pSteamMusicRemote ) + { + return false; + } + + m_pSteamHTMLSurface = SteamClient()->GetISteamHTMLSurface( hSteamUser, hSteamPipe, STEAMHTMLSURFACE_INTERFACE_VERSION ); + if ( !m_pSteamHTMLSurface ) + { + return false; + } + + m_pSteamInventory = SteamClient()->GetISteamInventory( hSteamUser, hSteamPipe, STEAMINVENTORY_INTERFACE_VERSION ); + if ( !m_pSteamInventory ) + { + return false; + } + + m_pSteamVideo = SteamClient()->GetISteamVideo( hSteamUser, hSteamPipe, STEAMVIDEO_INTERFACE_VERSION ); + if ( !m_pSteamVideo ) + { + return false; + } + +#ifdef _PS3 + m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender(); +#endif + + return true; +} + +#endif // VERSION_SAFE_STEAM_API_INTERFACES + +#if defined(USE_BREAKPAD_HANDLER) || defined(STEAM_API_EXPORTS) +// this should be called before the game initialized the steam APIs +// pchDate should be of the format "Mmm dd yyyy" (such as from the __DATE__ macro ) +// pchTime should be of the format "hh:mm:ss" (such as from the __TIME__ macro ) +// bFullMemoryDumps (Win32 only) -- writes out a uuid-full.dmp in the client/dumps folder +// pvContext-- can be NULL, will be the void * context passed into m_pfnPreMinidumpCallback +// PFNPreMinidumpCallback m_pfnPreMinidumpCallback -- optional callback which occurs just before a .dmp file is written during a crash. Applications can hook this to allow adding additional information into the .dmp comment stream. +S_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback ); +S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID ); +#endif + +#endif // STEAM_API_H diff --git a/public/steam/steam_api.json b/public/steam/steam_api.json new file mode 100644 index 000000000..4d94b6b50 --- /dev/null +++ b/public/steam/steam_api.json @@ -0,0 +1,7241 @@ +{"typedefs":[{"typedef": "uint8","type": "unsigned char"} +,{"typedef": "uint8","type": "unsigned char"} +,{"typedef": "int8","type": "signed char"} +,{"typedef": "int16","type": "short"} +,{"typedef": "uint16","type": "unsigned short"} +,{"typedef": "int32","type": "int"} +,{"typedef": "uint32","type": "unsigned int"} +,{"typedef": "int64","type": "long long"} +,{"typedef": "uint64","type": "unsigned long long"} +,{"typedef": "lint64","type": "int64"} +,{"typedef": "ulint64","type": "uint64"} +,{"typedef": "intp","type": "long long"} +,{"typedef": "uintp","type": "unsigned long long"} +,{"typedef": "Salt_t","type": "uint8 [8]"} +,{"typedef": "GID_t","type": "uint64"} +,{"typedef": "JobID_t","type": "uint64"} +,{"typedef": "TxnID_t","type": "GID_t"} +,{"typedef": "PackageId_t","type": "uint32"} +,{"typedef": "BundleId_t","type": "uint32"} +,{"typedef": "AppId_t","type": "uint32"} +,{"typedef": "AssetClassId_t","type": "uint64"} +,{"typedef": "PhysicalItemId_t","type": "uint32"} +,{"typedef": "DepotId_t","type": "uint32"} +,{"typedef": "RTime32","type": "uint32"} +,{"typedef": "CellID_t","type": "uint32"} +,{"typedef": "SteamAPICall_t","type": "uint64"} +,{"typedef": "AccountID_t","type": "uint32"} +,{"typedef": "PartnerId_t","type": "uint32"} +,{"typedef": "ManifestId_t","type": "uint64"} +,{"typedef": "HAuthTicket","type": "uint32"} +,{"typedef": "PFNLegacyKeyRegistration","type": "void (*)(const char *, const char *)"} +,{"typedef": "PFNLegacyKeyInstalled","type": "_Bool (*)(void)"} +,{"typedef": "PFNPreMinidumpCallback","type": "void (*)(void *)"} +,{"typedef": "BREAKPAD_HANDLE","type": "void *"} +,{"typedef": "ValvePackingSentinel_t","type": "struct ValvePackingSentinel_t"} +,{"typedef": "compile_time_assert_type","type": "char [1]"} +,{"typedef": "HSteamPipe","type": "int32"} +,{"typedef": "HSteamUser","type": "int32"} +,{"typedef": "SteamAPIWarningMessageHook_t","type": "void (*)(int, const char *) __attribute__((cdecl))"} +,{"typedef": "SteamAPI_PostAPIResultInProcess_t","type": "void (*)(SteamAPICall_t, void *, uint32, int)"} +,{"typedef": "SteamAPI_CheckCallbackRegistered_t","type": "uint32 (*)(int)"} +,{"typedef": "HSteamCall","type": "int32"} +,{"typedef": "FriendsGroupID_t","type": "int16"} +,{"typedef": "SteamAPIWarningMessageHook_t","type": "void (*)(int, const char *) __attribute__((cdecl))"} +,{"typedef": "HServerListRequest","type": "void *"} +,{"typedef": "HServerQuery","type": "int"} +,{"typedef": "UGCHandle_t","type": "uint64"} +,{"typedef": "PublishedFileUpdateHandle_t","type": "uint64"} +,{"typedef": "PublishedFileId_t","type": "uint64"} +,{"typedef": "UGCFileWriteStreamHandle_t","type": "uint64"} +,{"typedef": "compile_time_assert_type","type": "char [1]"} +,{"typedef": "SteamLeaderboard_t","type": "uint64"} +,{"typedef": "SteamLeaderboardEntries_t","type": "uint64"} +,{"typedef": "SNetSocket_t","type": "uint32"} +,{"typedef": "SNetListenSocket_t","type": "uint32"} +,{"typedef": "ScreenshotHandle","type": "uint32"} +,{"typedef": "HTTPRequestHandle","type": "uint32"} +,{"typedef": "HTTPCookieContainerHandle","type": "uint32"} +,{"typedef": "ClientUnifiedMessageHandle","type": "uint64"} +,{"typedef": "ControllerHandle_t","type": "uint64"} +,{"typedef": "ControllerActionSetHandle_t","type": "uint64"} +,{"typedef": "ControllerDigitalActionHandle_t","type": "uint64"} +,{"typedef": "ControllerAnalogActionHandle_t","type": "uint64"} +,{"typedef": "UGCQueryHandle_t","type": "uint64"} +,{"typedef": "UGCUpdateHandle_t","type": "uint64"} +,{"typedef": "HHTMLBrowser","type": "uint32"} +,{"typedef": "SteamItemInstanceID_t","type": "uint64"} +,{"typedef": "SteamItemDef_t","type": "int32"} +,{"typedef": "SteamInventoryResult_t","type": "int32"} +,{"typedef": "CCallResult::func_t","type": "void (T::*)(P *, _Bool)"} +,{"typedef": "CCallback::func_t","type": "void (T::*)(P *)"} +], +"enums":[ + {"enumname": "EUniverse","values": [ + {"name": "k_EUniverseInvalid","value": "0"} + ,{"name": "k_EUniversePublic","value": "1"} + ,{"name": "k_EUniverseBeta","value": "2"} + ,{"name": "k_EUniverseInternal","value": "3"} + ,{"name": "k_EUniverseDev","value": "4"} + ,{"name": "k_EUniverseMax","value": "5"} +]} +, {"enumname": "EResult","values": [ + {"name": "k_EResultOK","value": "1"} + ,{"name": "k_EResultFail","value": "2"} + ,{"name": "k_EResultNoConnection","value": "3"} + ,{"name": "k_EResultInvalidPassword","value": "5"} + ,{"name": "k_EResultLoggedInElsewhere","value": "6"} + ,{"name": "k_EResultInvalidProtocolVer","value": "7"} + ,{"name": "k_EResultInvalidParam","value": "8"} + ,{"name": "k_EResultFileNotFound","value": "9"} + ,{"name": "k_EResultBusy","value": "10"} + ,{"name": "k_EResultInvalidState","value": "11"} + ,{"name": "k_EResultInvalidName","value": "12"} + ,{"name": "k_EResultInvalidEmail","value": "13"} + ,{"name": "k_EResultDuplicateName","value": "14"} + ,{"name": "k_EResultAccessDenied","value": "15"} + ,{"name": "k_EResultTimeout","value": "16"} + ,{"name": "k_EResultBanned","value": "17"} + ,{"name": "k_EResultAccountNotFound","value": "18"} + ,{"name": "k_EResultInvalidSteamID","value": "19"} + ,{"name": "k_EResultServiceUnavailable","value": "20"} + ,{"name": "k_EResultNotLoggedOn","value": "21"} + ,{"name": "k_EResultPending","value": "22"} + ,{"name": "k_EResultEncryptionFailure","value": "23"} + ,{"name": "k_EResultInsufficientPrivilege","value": "24"} + ,{"name": "k_EResultLimitExceeded","value": "25"} + ,{"name": "k_EResultRevoked","value": "26"} + ,{"name": "k_EResultExpired","value": "27"} + ,{"name": "k_EResultAlreadyRedeemed","value": "28"} + ,{"name": "k_EResultDuplicateRequest","value": "29"} + ,{"name": "k_EResultAlreadyOwned","value": "30"} + ,{"name": "k_EResultIPNotFound","value": "31"} + ,{"name": "k_EResultPersistFailed","value": "32"} + ,{"name": "k_EResultLockingFailed","value": "33"} + ,{"name": "k_EResultLogonSessionReplaced","value": "34"} + ,{"name": "k_EResultConnectFailed","value": "35"} + ,{"name": "k_EResultHandshakeFailed","value": "36"} + ,{"name": "k_EResultIOFailure","value": "37"} + ,{"name": "k_EResultRemoteDisconnect","value": "38"} + ,{"name": "k_EResultShoppingCartNotFound","value": "39"} + ,{"name": "k_EResultBlocked","value": "40"} + ,{"name": "k_EResultIgnored","value": "41"} + ,{"name": "k_EResultNoMatch","value": "42"} + ,{"name": "k_EResultAccountDisabled","value": "43"} + ,{"name": "k_EResultServiceReadOnly","value": "44"} + ,{"name": "k_EResultAccountNotFeatured","value": "45"} + ,{"name": "k_EResultAdministratorOK","value": "46"} + ,{"name": "k_EResultContentVersion","value": "47"} + ,{"name": "k_EResultTryAnotherCM","value": "48"} + ,{"name": "k_EResultPasswordRequiredToKickSession","value": "49"} + ,{"name": "k_EResultAlreadyLoggedInElsewhere","value": "50"} + ,{"name": "k_EResultSuspended","value": "51"} + ,{"name": "k_EResultCancelled","value": "52"} + ,{"name": "k_EResultDataCorruption","value": "53"} + ,{"name": "k_EResultDiskFull","value": "54"} + ,{"name": "k_EResultRemoteCallFailed","value": "55"} + ,{"name": "k_EResultPasswordUnset","value": "56"} + ,{"name": "k_EResultExternalAccountUnlinked","value": "57"} + ,{"name": "k_EResultPSNTicketInvalid","value": "58"} + ,{"name": "k_EResultExternalAccountAlreadyLinked","value": "59"} + ,{"name": "k_EResultRemoteFileConflict","value": "60"} + ,{"name": "k_EResultIllegalPassword","value": "61"} + ,{"name": "k_EResultSameAsPreviousValue","value": "62"} + ,{"name": "k_EResultAccountLogonDenied","value": "63"} + ,{"name": "k_EResultCannotUseOldPassword","value": "64"} + ,{"name": "k_EResultInvalidLoginAuthCode","value": "65"} + ,{"name": "k_EResultAccountLogonDeniedNoMail","value": "66"} + ,{"name": "k_EResultHardwareNotCapableOfIPT","value": "67"} + ,{"name": "k_EResultIPTInitError","value": "68"} + ,{"name": "k_EResultParentalControlRestricted","value": "69"} + ,{"name": "k_EResultFacebookQueryError","value": "70"} + ,{"name": "k_EResultExpiredLoginAuthCode","value": "71"} + ,{"name": "k_EResultIPLoginRestrictionFailed","value": "72"} + ,{"name": "k_EResultAccountLockedDown","value": "73"} + ,{"name": "k_EResultAccountLogonDeniedVerifiedEmailRequired","value": "74"} + ,{"name": "k_EResultNoMatchingURL","value": "75"} + ,{"name": "k_EResultBadResponse","value": "76"} + ,{"name": "k_EResultRequirePasswordReEntry","value": "77"} + ,{"name": "k_EResultValueOutOfRange","value": "78"} + ,{"name": "k_EResultUnexpectedError","value": "79"} + ,{"name": "k_EResultDisabled","value": "80"} + ,{"name": "k_EResultInvalidCEGSubmission","value": "81"} + ,{"name": "k_EResultRestrictedDevice","value": "82"} + ,{"name": "k_EResultRegionLocked","value": "83"} + ,{"name": "k_EResultRateLimitExceeded","value": "84"} + ,{"name": "k_EResultAccountLoginDeniedNeedTwoFactor","value": "85"} + ,{"name": "k_EResultItemDeleted","value": "86"} + ,{"name": "k_EResultAccountLoginDeniedThrottle","value": "87"} + ,{"name": "k_EResultTwoFactorCodeMismatch","value": "88"} + ,{"name": "k_EResultTwoFactorActivationCodeMismatch","value": "89"} + ,{"name": "k_EResultAccountAssociatedToMultiplePartners","value": "90"} + ,{"name": "k_EResultNotModified","value": "91"} + ,{"name": "k_EResultNoMobileDevice","value": "92"} + ,{"name": "k_EResultTimeNotSynced","value": "93"} + ,{"name": "k_EResultSmsCodeFailed","value": "94"} + ,{"name": "k_EResultAccountLimitExceeded","value": "95"} + ,{"name": "k_EResultAccountActivityLimitExceeded","value": "96"} + ,{"name": "k_EResultPhoneActivityLimitExceeded","value": "97"} + ,{"name": "k_EResultRefundToWallet","value": "98"} + ,{"name": "k_EResultEmailSendFailure","value": "99"} + ,{"name": "k_EResultNotSettled","value": "100"} + ,{"name": "k_EResultNeedCaptcha","value": "101"} +]} +, {"enumname": "EVoiceResult","values": [ + {"name": "k_EVoiceResultOK","value": "0"} + ,{"name": "k_EVoiceResultNotInitialized","value": "1"} + ,{"name": "k_EVoiceResultNotRecording","value": "2"} + ,{"name": "k_EVoiceResultNoData","value": "3"} + ,{"name": "k_EVoiceResultBufferTooSmall","value": "4"} + ,{"name": "k_EVoiceResultDataCorrupted","value": "5"} + ,{"name": "k_EVoiceResultRestricted","value": "6"} + ,{"name": "k_EVoiceResultUnsupportedCodec","value": "7"} + ,{"name": "k_EVoiceResultReceiverOutOfDate","value": "8"} + ,{"name": "k_EVoiceResultReceiverDidNotAnswer","value": "9"} +]} +, {"enumname": "EDenyReason","values": [ + {"name": "k_EDenyInvalid","value": "0"} + ,{"name": "k_EDenyInvalidVersion","value": "1"} + ,{"name": "k_EDenyGeneric","value": "2"} + ,{"name": "k_EDenyNotLoggedOn","value": "3"} + ,{"name": "k_EDenyNoLicense","value": "4"} + ,{"name": "k_EDenyCheater","value": "5"} + ,{"name": "k_EDenyLoggedInElseWhere","value": "6"} + ,{"name": "k_EDenyUnknownText","value": "7"} + ,{"name": "k_EDenyIncompatibleAnticheat","value": "8"} + ,{"name": "k_EDenyMemoryCorruption","value": "9"} + ,{"name": "k_EDenyIncompatibleSoftware","value": "10"} + ,{"name": "k_EDenySteamConnectionLost","value": "11"} + ,{"name": "k_EDenySteamConnectionError","value": "12"} + ,{"name": "k_EDenySteamResponseTimedOut","value": "13"} + ,{"name": "k_EDenySteamValidationStalled","value": "14"} + ,{"name": "k_EDenySteamOwnerLeftGuestUser","value": "15"} +]} +, {"enumname": "EBeginAuthSessionResult","values": [ + {"name": "k_EBeginAuthSessionResultOK","value": "0"} + ,{"name": "k_EBeginAuthSessionResultInvalidTicket","value": "1"} + ,{"name": "k_EBeginAuthSessionResultDuplicateRequest","value": "2"} + ,{"name": "k_EBeginAuthSessionResultInvalidVersion","value": "3"} + ,{"name": "k_EBeginAuthSessionResultGameMismatch","value": "4"} + ,{"name": "k_EBeginAuthSessionResultExpiredTicket","value": "5"} +]} +, {"enumname": "EAuthSessionResponse","values": [ + {"name": "k_EAuthSessionResponseOK","value": "0"} + ,{"name": "k_EAuthSessionResponseUserNotConnectedToSteam","value": "1"} + ,{"name": "k_EAuthSessionResponseNoLicenseOrExpired","value": "2"} + ,{"name": "k_EAuthSessionResponseVACBanned","value": "3"} + ,{"name": "k_EAuthSessionResponseLoggedInElseWhere","value": "4"} + ,{"name": "k_EAuthSessionResponseVACCheckTimedOut","value": "5"} + ,{"name": "k_EAuthSessionResponseAuthTicketCanceled","value": "6"} + ,{"name": "k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed","value": "7"} + ,{"name": "k_EAuthSessionResponseAuthTicketInvalid","value": "8"} + ,{"name": "k_EAuthSessionResponsePublisherIssuedBan","value": "9"} +]} +, {"enumname": "EUserHasLicenseForAppResult","values": [ + {"name": "k_EUserHasLicenseResultHasLicense","value": "0"} + ,{"name": "k_EUserHasLicenseResultDoesNotHaveLicense","value": "1"} + ,{"name": "k_EUserHasLicenseResultNoAuth","value": "2"} +]} +, {"enumname": "EAccountType","values": [ + {"name": "k_EAccountTypeInvalid","value": "0"} + ,{"name": "k_EAccountTypeIndividual","value": "1"} + ,{"name": "k_EAccountTypeMultiseat","value": "2"} + ,{"name": "k_EAccountTypeGameServer","value": "3"} + ,{"name": "k_EAccountTypeAnonGameServer","value": "4"} + ,{"name": "k_EAccountTypePending","value": "5"} + ,{"name": "k_EAccountTypeContentServer","value": "6"} + ,{"name": "k_EAccountTypeClan","value": "7"} + ,{"name": "k_EAccountTypeChat","value": "8"} + ,{"name": "k_EAccountTypeConsoleUser","value": "9"} + ,{"name": "k_EAccountTypeAnonUser","value": "10"} + ,{"name": "k_EAccountTypeMax","value": "11"} +]} +, {"enumname": "EAppReleaseState","values": [ + {"name": "k_EAppReleaseState_Unknown","value": "0"} + ,{"name": "k_EAppReleaseState_Unavailable","value": "1"} + ,{"name": "k_EAppReleaseState_Prerelease","value": "2"} + ,{"name": "k_EAppReleaseState_PreloadOnly","value": "3"} + ,{"name": "k_EAppReleaseState_Released","value": "4"} +]} +, {"enumname": "EAppOwnershipFlags","values": [ + {"name": "k_EAppOwnershipFlags_None","value": "0"} + ,{"name": "k_EAppOwnershipFlags_OwnsLicense","value": "1"} + ,{"name": "k_EAppOwnershipFlags_FreeLicense","value": "2"} + ,{"name": "k_EAppOwnershipFlags_RegionRestricted","value": "4"} + ,{"name": "k_EAppOwnershipFlags_LowViolence","value": "8"} + ,{"name": "k_EAppOwnershipFlags_InvalidPlatform","value": "16"} + ,{"name": "k_EAppOwnershipFlags_SharedLicense","value": "32"} + ,{"name": "k_EAppOwnershipFlags_FreeWeekend","value": "64"} + ,{"name": "k_EAppOwnershipFlags_RetailLicense","value": "128"} + ,{"name": "k_EAppOwnershipFlags_LicenseLocked","value": "256"} + ,{"name": "k_EAppOwnershipFlags_LicensePending","value": "512"} + ,{"name": "k_EAppOwnershipFlags_LicenseExpired","value": "1024"} + ,{"name": "k_EAppOwnershipFlags_LicensePermanent","value": "2048"} + ,{"name": "k_EAppOwnershipFlags_LicenseRecurring","value": "4096"} + ,{"name": "k_EAppOwnershipFlags_LicenseCanceled","value": "8192"} + ,{"name": "k_EAppOwnershipFlags_AutoGrant","value": "16384"} + ,{"name": "k_EAppOwnershipFlags_PendingGift","value": "32768"} +]} +, {"enumname": "EAppType","values": [ + {"name": "k_EAppType_Invalid","value": "0"} + ,{"name": "k_EAppType_Game","value": "1"} + ,{"name": "k_EAppType_Application","value": "2"} + ,{"name": "k_EAppType_Tool","value": "4"} + ,{"name": "k_EAppType_Demo","value": "8"} + ,{"name": "k_EAppType_Media_DEPRECATED","value": "16"} + ,{"name": "k_EAppType_DLC","value": "32"} + ,{"name": "k_EAppType_Guide","value": "64"} + ,{"name": "k_EAppType_Driver","value": "128"} + ,{"name": "k_EAppType_Config","value": "256"} + ,{"name": "k_EAppType_Hardware","value": "512"} + ,{"name": "k_EAppType_Video","value": "2048"} + ,{"name": "k_EAppType_Plugin","value": "4096"} + ,{"name": "k_EAppType_Music","value": "8192"} + ,{"name": "k_EAppType_Shortcut","value": "1073741824"} + ,{"name": "k_EAppType_DepotOnly","value": "-2147483648"} +]} +, {"enumname": "ESteamUserStatType","values": [ + {"name": "k_ESteamUserStatTypeINVALID","value": "0"} + ,{"name": "k_ESteamUserStatTypeINT","value": "1"} + ,{"name": "k_ESteamUserStatTypeFLOAT","value": "2"} + ,{"name": "k_ESteamUserStatTypeAVGRATE","value": "3"} + ,{"name": "k_ESteamUserStatTypeACHIEVEMENTS","value": "4"} + ,{"name": "k_ESteamUserStatTypeGROUPACHIEVEMENTS","value": "5"} + ,{"name": "k_ESteamUserStatTypeMAX","value": "6"} +]} +, {"enumname": "EChatEntryType","values": [ + {"name": "k_EChatEntryTypeInvalid","value": "0"} + ,{"name": "k_EChatEntryTypeChatMsg","value": "1"} + ,{"name": "k_EChatEntryTypeTyping","value": "2"} + ,{"name": "k_EChatEntryTypeInviteGame","value": "3"} + ,{"name": "k_EChatEntryTypeEmote","value": "4"} + ,{"name": "k_EChatEntryTypeLeftConversation","value": "6"} + ,{"name": "k_EChatEntryTypeEntered","value": "7"} + ,{"name": "k_EChatEntryTypeWasKicked","value": "8"} + ,{"name": "k_EChatEntryTypeWasBanned","value": "9"} + ,{"name": "k_EChatEntryTypeDisconnected","value": "10"} + ,{"name": "k_EChatEntryTypeHistoricalChat","value": "11"} + ,{"name": "k_EChatEntryTypeReserved1","value": "12"} + ,{"name": "k_EChatEntryTypeReserved2","value": "13"} + ,{"name": "k_EChatEntryTypeLinkBlocked","value": "14"} +]} +, {"enumname": "EChatRoomEnterResponse","values": [ + {"name": "k_EChatRoomEnterResponseSuccess","value": "1"} + ,{"name": "k_EChatRoomEnterResponseDoesntExist","value": "2"} + ,{"name": "k_EChatRoomEnterResponseNotAllowed","value": "3"} + ,{"name": "k_EChatRoomEnterResponseFull","value": "4"} + ,{"name": "k_EChatRoomEnterResponseError","value": "5"} + ,{"name": "k_EChatRoomEnterResponseBanned","value": "6"} + ,{"name": "k_EChatRoomEnterResponseLimited","value": "7"} + ,{"name": "k_EChatRoomEnterResponseClanDisabled","value": "8"} + ,{"name": "k_EChatRoomEnterResponseCommunityBan","value": "9"} + ,{"name": "k_EChatRoomEnterResponseMemberBlockedYou","value": "10"} + ,{"name": "k_EChatRoomEnterResponseYouBlockedMember","value": "11"} +]} +, {"enumname": "EChatSteamIDInstanceFlags","values": [ + {"name": "k_EChatAccountInstanceMask","value": "4095"} + ,{"name": "k_EChatInstanceFlagClan","value": "524288"} + ,{"name": "k_EChatInstanceFlagLobby","value": "262144"} + ,{"name": "k_EChatInstanceFlagMMSLobby","value": "131072"} +]} +, {"enumname": "EMarketingMessageFlags","values": [ + {"name": "k_EMarketingMessageFlagsNone","value": "0"} + ,{"name": "k_EMarketingMessageFlagsHighPriority","value": "1"} + ,{"name": "k_EMarketingMessageFlagsPlatformWindows","value": "2"} + ,{"name": "k_EMarketingMessageFlagsPlatformMac","value": "4"} + ,{"name": "k_EMarketingMessageFlagsPlatformLinux","value": "8"} + ,{"name": "k_EMarketingMessageFlagsPlatformRestrictions","value": "14"} +]} +, {"enumname": "ENotificationPosition","values": [ + {"name": "k_EPositionTopLeft","value": "0"} + ,{"name": "k_EPositionTopRight","value": "1"} + ,{"name": "k_EPositionBottomLeft","value": "2"} + ,{"name": "k_EPositionBottomRight","value": "3"} +]} +, {"enumname": "EBroadcastUploadResult","values": [ + {"name": "k_EBroadcastUploadResultNone","value": "0"} + ,{"name": "k_EBroadcastUploadResultOK","value": "1"} + ,{"name": "k_EBroadcastUploadResultInitFailed","value": "2"} + ,{"name": "k_EBroadcastUploadResultFrameFailed","value": "3"} + ,{"name": "k_EBroadcastUploadResultTimeout","value": "4"} + ,{"name": "k_EBroadcastUploadResultBandwidthExceeded","value": "5"} + ,{"name": "k_EBroadcastUploadResultLowFPS","value": "6"} + ,{"name": "k_EBroadcastUploadResultMissingKeyFrames","value": "7"} + ,{"name": "k_EBroadcastUploadResultNoConnection","value": "8"} + ,{"name": "k_EBroadcastUploadResultRelayFailed","value": "9"} + ,{"name": "k_EBroadcastUploadResultSettingsChanged","value": "10"} + ,{"name": "k_EBroadcastUploadResultMissingAudio","value": "11"} + ,{"name": "k_EBroadcastUploadResultTooFarBehind","value": "12"} + ,{"name": "k_EBroadcastUploadResultTranscodeBehind","value": "13"} +]} +, {"enumname": "ELaunchOptionType","values": [ + {"name": "k_ELaunchOptionType_None","value": "0"} + ,{"name": "k_ELaunchOptionType_Default","value": "1"} + ,{"name": "k_ELaunchOptionType_SafeMode","value": "2"} + ,{"name": "k_ELaunchOptionType_Multiplayer","value": "3"} + ,{"name": "k_ELaunchOptionType_Config","value": "4"} + ,{"name": "k_ELaunchOptionType_VR","value": "5"} + ,{"name": "k_ELaunchOptionType_Server","value": "6"} + ,{"name": "k_ELaunchOptionType_Editor","value": "7"} + ,{"name": "k_ELaunchOptionType_Manual","value": "8"} + ,{"name": "k_ELaunchOptionType_Benchmark","value": "9"} + ,{"name": "k_ELaunchOptionType_Option1","value": "10"} + ,{"name": "k_ELaunchOptionType_Option2","value": "11"} + ,{"name": "k_ELaunchOptionType_Option3","value": "12"} + ,{"name": "k_ELaunchOptionType_Dialog","value": "1000"} +]} +, {"enumname": "CGameID::EGameIDType","values": [ + {"name": "k_EGameIDTypeApp","value": "0"} + ,{"name": "k_EGameIDTypeGameMod","value": "1"} + ,{"name": "k_EGameIDTypeShortcut","value": "2"} + ,{"name": "k_EGameIDTypeP2P","value": "3"} +]} +, {"enumname": "IPCFailure_t::EFailureType","values": [ + {"name": "k_EFailureFlushedCallbackQueue","value": "0"} + ,{"name": "k_EFailurePipeFail","value": "1"} +]} +, {"enumname": "EFriendRelationship","values": [ + {"name": "k_EFriendRelationshipNone","value": "0"} + ,{"name": "k_EFriendRelationshipBlocked","value": "1"} + ,{"name": "k_EFriendRelationshipRequestRecipient","value": "2"} + ,{"name": "k_EFriendRelationshipFriend","value": "3"} + ,{"name": "k_EFriendRelationshipRequestInitiator","value": "4"} + ,{"name": "k_EFriendRelationshipIgnored","value": "5"} + ,{"name": "k_EFriendRelationshipIgnoredFriend","value": "6"} + ,{"name": "k_EFriendRelationshipSuggested","value": "7"} + ,{"name": "k_EFriendRelationshipMax","value": "8"} +]} +, {"enumname": "EPersonaState","values": [ + {"name": "k_EPersonaStateOffline","value": "0"} + ,{"name": "k_EPersonaStateOnline","value": "1"} + ,{"name": "k_EPersonaStateBusy","value": "2"} + ,{"name": "k_EPersonaStateAway","value": "3"} + ,{"name": "k_EPersonaStateSnooze","value": "4"} + ,{"name": "k_EPersonaStateLookingToTrade","value": "5"} + ,{"name": "k_EPersonaStateLookingToPlay","value": "6"} + ,{"name": "k_EPersonaStateMax","value": "7"} +]} +, {"enumname": "EFriendFlags","values": [ + {"name": "k_EFriendFlagNone","value": "0"} + ,{"name": "k_EFriendFlagBlocked","value": "1"} + ,{"name": "k_EFriendFlagFriendshipRequested","value": "2"} + ,{"name": "k_EFriendFlagImmediate","value": "4"} + ,{"name": "k_EFriendFlagClanMember","value": "8"} + ,{"name": "k_EFriendFlagOnGameServer","value": "16"} + ,{"name": "k_EFriendFlagRequestingFriendship","value": "128"} + ,{"name": "k_EFriendFlagRequestingInfo","value": "256"} + ,{"name": "k_EFriendFlagIgnored","value": "512"} + ,{"name": "k_EFriendFlagIgnoredFriend","value": "1024"} + ,{"name": "k_EFriendFlagSuggested","value": "2048"} + ,{"name": "k_EFriendFlagAll","value": "65535"} +]} +, {"enumname": "EUserRestriction","values": [ + {"name": "k_nUserRestrictionNone","value": "0"} + ,{"name": "k_nUserRestrictionUnknown","value": "1"} + ,{"name": "k_nUserRestrictionAnyChat","value": "2"} + ,{"name": "k_nUserRestrictionVoiceChat","value": "4"} + ,{"name": "k_nUserRestrictionGroupChat","value": "8"} + ,{"name": "k_nUserRestrictionRating","value": "16"} + ,{"name": "k_nUserRestrictionGameInvites","value": "32"} + ,{"name": "k_nUserRestrictionTrading","value": "64"} +]} +, {"enumname": "EOverlayToStoreFlag","values": [ + {"name": "k_EOverlayToStoreFlag_None","value": "0"} + ,{"name": "k_EOverlayToStoreFlag_AddToCart","value": "1"} + ,{"name": "k_EOverlayToStoreFlag_AddToCartAndShow","value": "2"} +]} +, {"enumname": "EPersonaChange","values": [ + {"name": "k_EPersonaChangeName","value": "1"} + ,{"name": "k_EPersonaChangeStatus","value": "2"} + ,{"name": "k_EPersonaChangeComeOnline","value": "4"} + ,{"name": "k_EPersonaChangeGoneOffline","value": "8"} + ,{"name": "k_EPersonaChangeGamePlayed","value": "16"} + ,{"name": "k_EPersonaChangeGameServer","value": "32"} + ,{"name": "k_EPersonaChangeAvatar","value": "64"} + ,{"name": "k_EPersonaChangeJoinedSource","value": "128"} + ,{"name": "k_EPersonaChangeLeftSource","value": "256"} + ,{"name": "k_EPersonaChangeRelationshipChanged","value": "512"} + ,{"name": "k_EPersonaChangeNameFirstSet","value": "1024"} + ,{"name": "k_EPersonaChangeFacebookInfo","value": "2048"} + ,{"name": "k_EPersonaChangeNickname","value": "4096"} + ,{"name": "k_EPersonaChangeSteamLevel","value": "8192"} +]} +, {"enumname": "ESteamAPICallFailure","values": [ + {"name": "k_ESteamAPICallFailureNone","value": "-1"} + ,{"name": "k_ESteamAPICallFailureSteamGone","value": "0"} + ,{"name": "k_ESteamAPICallFailureNetworkFailure","value": "1"} + ,{"name": "k_ESteamAPICallFailureInvalidHandle","value": "2"} + ,{"name": "k_ESteamAPICallFailureMismatchedCallback","value": "3"} +]} +, {"enumname": "EGamepadTextInputMode","values": [ + {"name": "k_EGamepadTextInputModeNormal","value": "0"} + ,{"name": "k_EGamepadTextInputModePassword","value": "1"} +]} +, {"enumname": "EGamepadTextInputLineMode","values": [ + {"name": "k_EGamepadTextInputLineModeSingleLine","value": "0"} + ,{"name": "k_EGamepadTextInputLineModeMultipleLines","value": "1"} +]} +, {"enumname": "ECheckFileSignature","values": [ + {"name": "k_ECheckFileSignatureInvalidSignature","value": "0"} + ,{"name": "k_ECheckFileSignatureValidSignature","value": "1"} + ,{"name": "k_ECheckFileSignatureFileNotFound","value": "2"} + ,{"name": "k_ECheckFileSignatureNoSignaturesFoundForThisApp","value": "3"} + ,{"name": "k_ECheckFileSignatureNoSignaturesFoundForThisFile","value": "4"} +]} +, {"enumname": "EMatchMakingServerResponse","values": [ + {"name": "eServerResponded","value": "0"} + ,{"name": "eServerFailedToRespond","value": "1"} + ,{"name": "eNoServersListedOnMasterServer","value": "2"} +]} +, {"enumname": "ELobbyType","values": [ + {"name": "k_ELobbyTypePrivate","value": "0"} + ,{"name": "k_ELobbyTypeFriendsOnly","value": "1"} + ,{"name": "k_ELobbyTypePublic","value": "2"} + ,{"name": "k_ELobbyTypeInvisible","value": "3"} +]} +, {"enumname": "ELobbyComparison","values": [ + {"name": "k_ELobbyComparisonEqualToOrLessThan","value": "-2"} + ,{"name": "k_ELobbyComparisonLessThan","value": "-1"} + ,{"name": "k_ELobbyComparisonEqual","value": "0"} + ,{"name": "k_ELobbyComparisonGreaterThan","value": "1"} + ,{"name": "k_ELobbyComparisonEqualToOrGreaterThan","value": "2"} + ,{"name": "k_ELobbyComparisonNotEqual","value": "3"} +]} +, {"enumname": "ELobbyDistanceFilter","values": [ + {"name": "k_ELobbyDistanceFilterClose","value": "0"} + ,{"name": "k_ELobbyDistanceFilterDefault","value": "1"} + ,{"name": "k_ELobbyDistanceFilterFar","value": "2"} + ,{"name": "k_ELobbyDistanceFilterWorldwide","value": "3"} +]} +, {"enumname": "EChatMemberStateChange","values": [ + {"name": "k_EChatMemberStateChangeEntered","value": "1"} + ,{"name": "k_EChatMemberStateChangeLeft","value": "2"} + ,{"name": "k_EChatMemberStateChangeDisconnected","value": "4"} + ,{"name": "k_EChatMemberStateChangeKicked","value": "8"} + ,{"name": "k_EChatMemberStateChangeBanned","value": "16"} +]} +, {"enumname": "EResolveConflict","values": [ + {"name": "k_EResolveConflictKeepClient","value": "1"} + ,{"name": "k_EResolveConflictKeepServer","value": "2"} +]} +, {"enumname": "ERemoteStoragePlatform","values": [ + {"name": "k_ERemoteStoragePlatformNone","value": "0"} + ,{"name": "k_ERemoteStoragePlatformWindows","value": "1"} + ,{"name": "k_ERemoteStoragePlatformOSX","value": "2"} + ,{"name": "k_ERemoteStoragePlatformPS3","value": "4"} + ,{"name": "k_ERemoteStoragePlatformLinux","value": "8"} + ,{"name": "k_ERemoteStoragePlatformReserved2","value": "16"} + ,{"name": "k_ERemoteStoragePlatformAll","value": "-1"} +]} +, {"enumname": "ERemoteStoragePublishedFileVisibility","values": [ + {"name": "k_ERemoteStoragePublishedFileVisibilityPublic","value": "0"} + ,{"name": "k_ERemoteStoragePublishedFileVisibilityFriendsOnly","value": "1"} + ,{"name": "k_ERemoteStoragePublishedFileVisibilityPrivate","value": "2"} +]} +, {"enumname": "EWorkshopFileType","values": [ + {"name": "k_EWorkshopFileTypeFirst","value": "0"} + ,{"name": "k_EWorkshopFileTypeCommunity","value": "0"} + ,{"name": "k_EWorkshopFileTypeMicrotransaction","value": "1"} + ,{"name": "k_EWorkshopFileTypeCollection","value": "2"} + ,{"name": "k_EWorkshopFileTypeArt","value": "3"} + ,{"name": "k_EWorkshopFileTypeVideo","value": "4"} + ,{"name": "k_EWorkshopFileTypeScreenshot","value": "5"} + ,{"name": "k_EWorkshopFileTypeGame","value": "6"} + ,{"name": "k_EWorkshopFileTypeSoftware","value": "7"} + ,{"name": "k_EWorkshopFileTypeConcept","value": "8"} + ,{"name": "k_EWorkshopFileTypeWebGuide","value": "9"} + ,{"name": "k_EWorkshopFileTypeIntegratedGuide","value": "10"} + ,{"name": "k_EWorkshopFileTypeMerch","value": "11"} + ,{"name": "k_EWorkshopFileTypeControllerBinding","value": "12"} + ,{"name": "k_EWorkshopFileTypeSteamworksAccessInvite","value": "13"} + ,{"name": "k_EWorkshopFileTypeSteamVideo","value": "14"} + ,{"name": "k_EWorkshopFileTypeGameManagedItem","value": "15"} + ,{"name": "k_EWorkshopFileTypeMax","value": "16"} +]} +, {"enumname": "EWorkshopVote","values": [ + {"name": "k_EWorkshopVoteUnvoted","value": "0"} + ,{"name": "k_EWorkshopVoteFor","value": "1"} + ,{"name": "k_EWorkshopVoteAgainst","value": "2"} + ,{"name": "k_EWorkshopVoteLater","value": "3"} +]} +, {"enumname": "EWorkshopFileAction","values": [ + {"name": "k_EWorkshopFileActionPlayed","value": "0"} + ,{"name": "k_EWorkshopFileActionCompleted","value": "1"} +]} +, {"enumname": "EWorkshopEnumerationType","values": [ + {"name": "k_EWorkshopEnumerationTypeRankedByVote","value": "0"} + ,{"name": "k_EWorkshopEnumerationTypeRecent","value": "1"} + ,{"name": "k_EWorkshopEnumerationTypeTrending","value": "2"} + ,{"name": "k_EWorkshopEnumerationTypeFavoritesOfFriends","value": "3"} + ,{"name": "k_EWorkshopEnumerationTypeVotedByFriends","value": "4"} + ,{"name": "k_EWorkshopEnumerationTypeContentByFriends","value": "5"} + ,{"name": "k_EWorkshopEnumerationTypeRecentFromFollowedUsers","value": "6"} +]} +, {"enumname": "EWorkshopVideoProvider","values": [ + {"name": "k_EWorkshopVideoProviderNone","value": "0"} + ,{"name": "k_EWorkshopVideoProviderYoutube","value": "1"} +]} +, {"enumname": "EUGCReadAction","values": [ + {"name": "k_EUGCRead_ContinueReadingUntilFinished","value": "0"} + ,{"name": "k_EUGCRead_ContinueReading","value": "1"} + ,{"name": "k_EUGCRead_Close","value": "2"} +]} +, {"enumname": "ELeaderboardDataRequest","values": [ + {"name": "k_ELeaderboardDataRequestGlobal","value": "0"} + ,{"name": "k_ELeaderboardDataRequestGlobalAroundUser","value": "1"} + ,{"name": "k_ELeaderboardDataRequestFriends","value": "2"} + ,{"name": "k_ELeaderboardDataRequestUsers","value": "3"} +]} +, {"enumname": "ELeaderboardSortMethod","values": [ + {"name": "k_ELeaderboardSortMethodNone","value": "0"} + ,{"name": "k_ELeaderboardSortMethodAscending","value": "1"} + ,{"name": "k_ELeaderboardSortMethodDescending","value": "2"} +]} +, {"enumname": "ELeaderboardDisplayType","values": [ + {"name": "k_ELeaderboardDisplayTypeNone","value": "0"} + ,{"name": "k_ELeaderboardDisplayTypeNumeric","value": "1"} + ,{"name": "k_ELeaderboardDisplayTypeTimeSeconds","value": "2"} + ,{"name": "k_ELeaderboardDisplayTypeTimeMilliSeconds","value": "3"} +]} +, {"enumname": "ELeaderboardUploadScoreMethod","values": [ + {"name": "k_ELeaderboardUploadScoreMethodNone","value": "0"} + ,{"name": "k_ELeaderboardUploadScoreMethodKeepBest","value": "1"} + ,{"name": "k_ELeaderboardUploadScoreMethodForceUpdate","value": "2"} +]} +, {"enumname": "ERegisterActivationCodeResult","values": [ + {"name": "k_ERegisterActivationCodeResultOK","value": "0"} + ,{"name": "k_ERegisterActivationCodeResultFail","value": "1"} + ,{"name": "k_ERegisterActivationCodeResultAlreadyRegistered","value": "2"} + ,{"name": "k_ERegisterActivationCodeResultTimeout","value": "3"} + ,{"name": "k_ERegisterActivationCodeAlreadyOwned","value": "4"} +]} +, {"enumname": "EP2PSessionError","values": [ + {"name": "k_EP2PSessionErrorNone","value": "0"} + ,{"name": "k_EP2PSessionErrorNotRunningApp","value": "1"} + ,{"name": "k_EP2PSessionErrorNoRightsToApp","value": "2"} + ,{"name": "k_EP2PSessionErrorDestinationNotLoggedIn","value": "3"} + ,{"name": "k_EP2PSessionErrorTimeout","value": "4"} + ,{"name": "k_EP2PSessionErrorMax","value": "5"} +]} +, {"enumname": "EP2PSend","values": [ + {"name": "k_EP2PSendUnreliable","value": "0"} + ,{"name": "k_EP2PSendUnreliableNoDelay","value": "1"} + ,{"name": "k_EP2PSendReliable","value": "2"} + ,{"name": "k_EP2PSendReliableWithBuffering","value": "3"} +]} +, {"enumname": "ESNetSocketState","values": [ + {"name": "k_ESNetSocketStateInvalid","value": "0"} + ,{"name": "k_ESNetSocketStateConnected","value": "1"} + ,{"name": "k_ESNetSocketStateInitiated","value": "10"} + ,{"name": "k_ESNetSocketStateLocalCandidatesFound","value": "11"} + ,{"name": "k_ESNetSocketStateReceivedRemoteCandidates","value": "12"} + ,{"name": "k_ESNetSocketStateChallengeHandshake","value": "15"} + ,{"name": "k_ESNetSocketStateDisconnecting","value": "21"} + ,{"name": "k_ESNetSocketStateLocalDisconnect","value": "22"} + ,{"name": "k_ESNetSocketStateTimeoutDuringConnect","value": "23"} + ,{"name": "k_ESNetSocketStateRemoteEndDisconnected","value": "24"} + ,{"name": "k_ESNetSocketStateConnectionBroken","value": "25"} +]} +, {"enumname": "ESNetSocketConnectionType","values": [ + {"name": "k_ESNetSocketConnectionTypeNotConnected","value": "0"} + ,{"name": "k_ESNetSocketConnectionTypeUDP","value": "1"} + ,{"name": "k_ESNetSocketConnectionTypeUDPRelay","value": "2"} +]} +, {"enumname": "AudioPlayback_Status","values": [ + {"name": "AudioPlayback_Undefined","value": "0"} + ,{"name": "AudioPlayback_Playing","value": "1"} + ,{"name": "AudioPlayback_Paused","value": "2"} + ,{"name": "AudioPlayback_Idle","value": "3"} +]} +, {"enumname": "EHTTPMethod","values": [ + {"name": "k_EHTTPMethodInvalid","value": "0"} + ,{"name": "k_EHTTPMethodGET","value": "1"} + ,{"name": "k_EHTTPMethodHEAD","value": "2"} + ,{"name": "k_EHTTPMethodPOST","value": "3"} + ,{"name": "k_EHTTPMethodPUT","value": "4"} + ,{"name": "k_EHTTPMethodDELETE","value": "5"} + ,{"name": "k_EHTTPMethodOPTIONS","value": "6"} +]} +, {"enumname": "EHTTPStatusCode","values": [ + {"name": "k_EHTTPStatusCodeInvalid","value": "0"} + ,{"name": "k_EHTTPStatusCode100Continue","value": "100"} + ,{"name": "k_EHTTPStatusCode101SwitchingProtocols","value": "101"} + ,{"name": "k_EHTTPStatusCode200OK","value": "200"} + ,{"name": "k_EHTTPStatusCode201Created","value": "201"} + ,{"name": "k_EHTTPStatusCode202Accepted","value": "202"} + ,{"name": "k_EHTTPStatusCode203NonAuthoritative","value": "203"} + ,{"name": "k_EHTTPStatusCode204NoContent","value": "204"} + ,{"name": "k_EHTTPStatusCode205ResetContent","value": "205"} + ,{"name": "k_EHTTPStatusCode206PartialContent","value": "206"} + ,{"name": "k_EHTTPStatusCode300MultipleChoices","value": "300"} + ,{"name": "k_EHTTPStatusCode301MovedPermanently","value": "301"} + ,{"name": "k_EHTTPStatusCode302Found","value": "302"} + ,{"name": "k_EHTTPStatusCode303SeeOther","value": "303"} + ,{"name": "k_EHTTPStatusCode304NotModified","value": "304"} + ,{"name": "k_EHTTPStatusCode305UseProxy","value": "305"} + ,{"name": "k_EHTTPStatusCode307TemporaryRedirect","value": "307"} + ,{"name": "k_EHTTPStatusCode400BadRequest","value": "400"} + ,{"name": "k_EHTTPStatusCode401Unauthorized","value": "401"} + ,{"name": "k_EHTTPStatusCode402PaymentRequired","value": "402"} + ,{"name": "k_EHTTPStatusCode403Forbidden","value": "403"} + ,{"name": "k_EHTTPStatusCode404NotFound","value": "404"} + ,{"name": "k_EHTTPStatusCode405MethodNotAllowed","value": "405"} + ,{"name": "k_EHTTPStatusCode406NotAcceptable","value": "406"} + ,{"name": "k_EHTTPStatusCode407ProxyAuthRequired","value": "407"} + ,{"name": "k_EHTTPStatusCode408RequestTimeout","value": "408"} + ,{"name": "k_EHTTPStatusCode409Conflict","value": "409"} + ,{"name": "k_EHTTPStatusCode410Gone","value": "410"} + ,{"name": "k_EHTTPStatusCode411LengthRequired","value": "411"} + ,{"name": "k_EHTTPStatusCode412PreconditionFailed","value": "412"} + ,{"name": "k_EHTTPStatusCode413RequestEntityTooLarge","value": "413"} + ,{"name": "k_EHTTPStatusCode414RequestURITooLong","value": "414"} + ,{"name": "k_EHTTPStatusCode415UnsupportedMediaType","value": "415"} + ,{"name": "k_EHTTPStatusCode416RequestedRangeNotSatisfiable","value": "416"} + ,{"name": "k_EHTTPStatusCode417ExpectationFailed","value": "417"} + ,{"name": "k_EHTTPStatusCode4xxUnknown","value": "418"} + ,{"name": "k_EHTTPStatusCode429TooManyRequests","value": "429"} + ,{"name": "k_EHTTPStatusCode500InternalServerError","value": "500"} + ,{"name": "k_EHTTPStatusCode501NotImplemented","value": "501"} + ,{"name": "k_EHTTPStatusCode502BadGateway","value": "502"} + ,{"name": "k_EHTTPStatusCode503ServiceUnavailable","value": "503"} + ,{"name": "k_EHTTPStatusCode504GatewayTimeout","value": "504"} + ,{"name": "k_EHTTPStatusCode505HTTPVersionNotSupported","value": "505"} + ,{"name": "k_EHTTPStatusCode5xxUnknown","value": "599"} +]} +, {"enumname": "ESteamControllerPad","values": [ + {"name": "k_ESteamControllerPad_Left","value": "0"} + ,{"name": "k_ESteamControllerPad_Right","value": "1"} +]} +, {"enumname": "EControllerSource","values": [ + {"name": "k_EControllerSource_None","value": "0"} + ,{"name": "k_EControllerSource_LeftTrackpad","value": "1"} + ,{"name": "k_EControllerSource_RightTrackpad","value": "2"} + ,{"name": "k_EControllerSource_Joystick","value": "3"} + ,{"name": "k_EControllerSource_ABXY","value": "4"} + ,{"name": "k_EControllerSource_Switch","value": "5"} + ,{"name": "k_EControllerSource_LeftTrigger","value": "6"} + ,{"name": "k_EControllerSource_RightTrigger","value": "7"} + ,{"name": "k_EControllerSource_Gyro","value": "8"} +]} +, {"enumname": "EControllerSourceMode","values": [ + {"name": "k_EControllerSourceMode_None","value": "0"} + ,{"name": "k_EControllerSourceMode_Dpad","value": "1"} + ,{"name": "k_EControllerSourceMode_Buttons","value": "2"} + ,{"name": "k_EControllerSourceMode_FourButtons","value": "3"} + ,{"name": "k_EControllerSourceMode_AbsoluteMouse","value": "4"} + ,{"name": "k_EControllerSourceMode_RelativeMouse","value": "5"} + ,{"name": "k_EControllerSourceMode_JoystickMove","value": "6"} + ,{"name": "k_EControllerSourceMode_JoystickCamera","value": "7"} + ,{"name": "k_EControllerSourceMode_ScrollWheel","value": "8"} + ,{"name": "k_EControllerSourceMode_Trigger","value": "9"} + ,{"name": "k_EControllerSourceMode_TouchMenu","value": "10"} +]} +, {"enumname": "EControllerActionOrigin","values": [ + {"name": "k_EControllerActionOrigin_None","value": "0"} + ,{"name": "k_EControllerActionOrigin_A","value": "1"} + ,{"name": "k_EControllerActionOrigin_B","value": "2"} + ,{"name": "k_EControllerActionOrigin_X","value": "3"} + ,{"name": "k_EControllerActionOrigin_Y","value": "4"} + ,{"name": "k_EControllerActionOrigin_LeftBumper","value": "5"} + ,{"name": "k_EControllerActionOrigin_RightBumper","value": "6"} + ,{"name": "k_EControllerActionOrigin_LeftGrip","value": "7"} + ,{"name": "k_EControllerActionOrigin_RightGrip","value": "8"} + ,{"name": "k_EControllerActionOrigin_Start","value": "9"} + ,{"name": "k_EControllerActionOrigin_Back","value": "10"} + ,{"name": "k_EControllerActionOrigin_LeftPad_Touch","value": "11"} + ,{"name": "k_EControllerActionOrigin_LeftPad_Swipe","value": "12"} + ,{"name": "k_EControllerActionOrigin_LeftPad_Click","value": "13"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadNorth","value": "14"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadSouth","value": "15"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadWest","value": "16"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadEast","value": "17"} + ,{"name": "k_EControllerActionOrigin_RightPad_Touch","value": "18"} + ,{"name": "k_EControllerActionOrigin_RightPad_Swipe","value": "19"} + ,{"name": "k_EControllerActionOrigin_RightPad_Click","value": "20"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadNorth","value": "21"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadSouth","value": "22"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadWest","value": "23"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadEast","value": "24"} + ,{"name": "k_EControllerActionOrigin_LeftTrigger_Pull","value": "25"} + ,{"name": "k_EControllerActionOrigin_LeftTrigger_Click","value": "26"} + ,{"name": "k_EControllerActionOrigin_RightTrigger_Pull","value": "27"} + ,{"name": "k_EControllerActionOrigin_RightTrigger_Click","value": "28"} + ,{"name": "k_EControllerActionOrigin_LeftStick_Move","value": "29"} + ,{"name": "k_EControllerActionOrigin_LeftStick_Click","value": "30"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadNorth","value": "31"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadSouth","value": "32"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadWest","value": "33"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadEast","value": "34"} + ,{"name": "k_EControllerActionOrigin_Gyro_Move","value": "35"} + ,{"name": "k_EControllerActionOrigin_Gyro_Pitch","value": "36"} + ,{"name": "k_EControllerActionOrigin_Gyro_Yaw","value": "37"} + ,{"name": "k_EControllerActionOrigin_Gyro_Roll","value": "38"} + ,{"name": "k_EControllerActionOrigin_Count","value": "39"} +]} +, {"enumname": "EUGCMatchingUGCType","values": [ + {"name": "k_EUGCMatchingUGCType_Items","value": "0"} + ,{"name": "k_EUGCMatchingUGCType_Items_Mtx","value": "1"} + ,{"name": "k_EUGCMatchingUGCType_Items_ReadyToUse","value": "2"} + ,{"name": "k_EUGCMatchingUGCType_Collections","value": "3"} + ,{"name": "k_EUGCMatchingUGCType_Artwork","value": "4"} + ,{"name": "k_EUGCMatchingUGCType_Videos","value": "5"} + ,{"name": "k_EUGCMatchingUGCType_Screenshots","value": "6"} + ,{"name": "k_EUGCMatchingUGCType_AllGuides","value": "7"} + ,{"name": "k_EUGCMatchingUGCType_WebGuides","value": "8"} + ,{"name": "k_EUGCMatchingUGCType_IntegratedGuides","value": "9"} + ,{"name": "k_EUGCMatchingUGCType_UsableInGame","value": "10"} + ,{"name": "k_EUGCMatchingUGCType_ControllerBindings","value": "11"} + ,{"name": "k_EUGCMatchingUGCType_GameManagedItems","value": "12"} + ,{"name": "k_EUGCMatchingUGCType_All","value": "-1"} +]} +, {"enumname": "EUserUGCList","values": [ + {"name": "k_EUserUGCList_Published","value": "0"} + ,{"name": "k_EUserUGCList_VotedOn","value": "1"} + ,{"name": "k_EUserUGCList_VotedUp","value": "2"} + ,{"name": "k_EUserUGCList_VotedDown","value": "3"} + ,{"name": "k_EUserUGCList_WillVoteLater","value": "4"} + ,{"name": "k_EUserUGCList_Favorited","value": "5"} + ,{"name": "k_EUserUGCList_Subscribed","value": "6"} + ,{"name": "k_EUserUGCList_UsedOrPlayed","value": "7"} + ,{"name": "k_EUserUGCList_Followed","value": "8"} +]} +, {"enumname": "EUserUGCListSortOrder","values": [ + {"name": "k_EUserUGCListSortOrder_CreationOrderDesc","value": "0"} + ,{"name": "k_EUserUGCListSortOrder_CreationOrderAsc","value": "1"} + ,{"name": "k_EUserUGCListSortOrder_TitleAsc","value": "2"} + ,{"name": "k_EUserUGCListSortOrder_LastUpdatedDesc","value": "3"} + ,{"name": "k_EUserUGCListSortOrder_SubscriptionDateDesc","value": "4"} + ,{"name": "k_EUserUGCListSortOrder_VoteScoreDesc","value": "5"} + ,{"name": "k_EUserUGCListSortOrder_ForModeration","value": "6"} +]} +, {"enumname": "EUGCQuery","values": [ + {"name": "k_EUGCQuery_RankedByVote","value": "0"} + ,{"name": "k_EUGCQuery_RankedByPublicationDate","value": "1"} + ,{"name": "k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate","value": "2"} + ,{"name": "k_EUGCQuery_RankedByTrend","value": "3"} + ,{"name": "k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate","value": "4"} + ,{"name": "k_EUGCQuery_CreatedByFriendsRankedByPublicationDate","value": "5"} + ,{"name": "k_EUGCQuery_RankedByNumTimesReported","value": "6"} + ,{"name": "k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate","value": "7"} + ,{"name": "k_EUGCQuery_NotYetRated","value": "8"} + ,{"name": "k_EUGCQuery_RankedByTotalVotesAsc","value": "9"} + ,{"name": "k_EUGCQuery_RankedByVotesUp","value": "10"} + ,{"name": "k_EUGCQuery_RankedByTextSearch","value": "11"} + ,{"name": "k_EUGCQuery_RankedByTotalUniqueSubscriptions","value": "12"} +]} +, {"enumname": "EItemUpdateStatus","values": [ + {"name": "k_EItemUpdateStatusInvalid","value": "0"} + ,{"name": "k_EItemUpdateStatusPreparingConfig","value": "1"} + ,{"name": "k_EItemUpdateStatusPreparingContent","value": "2"} + ,{"name": "k_EItemUpdateStatusUploadingContent","value": "3"} + ,{"name": "k_EItemUpdateStatusUploadingPreviewFile","value": "4"} + ,{"name": "k_EItemUpdateStatusCommittingChanges","value": "5"} +]} +, {"enumname": "EItemState","values": [ + {"name": "k_EItemStateNone","value": "0"} + ,{"name": "k_EItemStateSubscribed","value": "1"} + ,{"name": "k_EItemStateLegacyItem","value": "2"} + ,{"name": "k_EItemStateInstalled","value": "4"} + ,{"name": "k_EItemStateNeedsUpdate","value": "8"} + ,{"name": "k_EItemStateDownloading","value": "16"} + ,{"name": "k_EItemStateDownloadPending","value": "32"} +]} +, {"enumname": "EItemStatistic","values": [ + {"name": "k_EItemStatistic_NumSubscriptions","value": "0"} + ,{"name": "k_EItemStatistic_NumFavorites","value": "1"} + ,{"name": "k_EItemStatistic_NumFollowers","value": "2"} + ,{"name": "k_EItemStatistic_NumUniqueSubscriptions","value": "3"} + ,{"name": "k_EItemStatistic_NumUniqueFavorites","value": "4"} + ,{"name": "k_EItemStatistic_NumUniqueFollowers","value": "5"} + ,{"name": "k_EItemStatistic_NumUniqueWebsiteViews","value": "6"} + ,{"name": "k_EItemStatistic_ReportScore","value": "7"} +]} +, {"enumname": "ISteamHTMLSurface::EHTMLMouseButton","values": [ + {"name": "eHTMLMouseButton_Left","value": "0"} + ,{"name": "eHTMLMouseButton_Right","value": "1"} + ,{"name": "eHTMLMouseButton_Middle","value": "2"} +]} +, {"enumname": "ISteamHTMLSurface::EMouseCursor","values": [ + {"name": "dc_user","value": "0"} + ,{"name": "dc_none","value": "1"} + ,{"name": "dc_arrow","value": "2"} + ,{"name": "dc_ibeam","value": "3"} + ,{"name": "dc_hourglass","value": "4"} + ,{"name": "dc_waitarrow","value": "5"} + ,{"name": "dc_crosshair","value": "6"} + ,{"name": "dc_up","value": "7"} + ,{"name": "dc_sizenw","value": "8"} + ,{"name": "dc_sizese","value": "9"} + ,{"name": "dc_sizene","value": "10"} + ,{"name": "dc_sizesw","value": "11"} + ,{"name": "dc_sizew","value": "12"} + ,{"name": "dc_sizee","value": "13"} + ,{"name": "dc_sizen","value": "14"} + ,{"name": "dc_sizes","value": "15"} + ,{"name": "dc_sizewe","value": "16"} + ,{"name": "dc_sizens","value": "17"} + ,{"name": "dc_sizeall","value": "18"} + ,{"name": "dc_no","value": "19"} + ,{"name": "dc_hand","value": "20"} + ,{"name": "dc_blank","value": "21"} + ,{"name": "dc_middle_pan","value": "22"} + ,{"name": "dc_north_pan","value": "23"} + ,{"name": "dc_north_east_pan","value": "24"} + ,{"name": "dc_east_pan","value": "25"} + ,{"name": "dc_south_east_pan","value": "26"} + ,{"name": "dc_south_pan","value": "27"} + ,{"name": "dc_south_west_pan","value": "28"} + ,{"name": "dc_west_pan","value": "29"} + ,{"name": "dc_north_west_pan","value": "30"} + ,{"name": "dc_alias","value": "31"} + ,{"name": "dc_cell","value": "32"} + ,{"name": "dc_colresize","value": "33"} + ,{"name": "dc_copycur","value": "34"} + ,{"name": "dc_verticaltext","value": "35"} + ,{"name": "dc_rowresize","value": "36"} + ,{"name": "dc_zoomin","value": "37"} + ,{"name": "dc_zoomout","value": "38"} + ,{"name": "dc_help","value": "39"} + ,{"name": "dc_custom","value": "40"} + ,{"name": "dc_last","value": "41"} +]} +, {"enumname": "ISteamHTMLSurface::EHTMLKeyModifiers","values": [ + {"name": "k_eHTMLKeyModifier_None","value": "0"} + ,{"name": "k_eHTMLKeyModifier_AltDown","value": "1"} + ,{"name": "k_eHTMLKeyModifier_CtrlDown","value": "2"} + ,{"name": "k_eHTMLKeyModifier_ShiftDown","value": "4"} +]} +, {"enumname": "ESteamItemFlags","values": [ + {"name": "k_ESteamItemNoTrade","value": "1"} + ,{"name": "k_ESteamItemRemoved","value": "256"} + ,{"name": "k_ESteamItemConsumed","value": "512"} +]} +], +"consts":[{ + "constname": "k_iSteamUserCallbacks","consttype": "int", "constval": "100"} +,{ + "constname": "k_iSteamGameServerCallbacks","consttype": "int", "constval": "200"} +,{ + "constname": "k_iSteamFriendsCallbacks","consttype": "int", "constval": "300"} +,{ + "constname": "k_iSteamBillingCallbacks","consttype": "int", "constval": "400"} +,{ + "constname": "k_iSteamMatchmakingCallbacks","consttype": "int", "constval": "500"} +,{ + "constname": "k_iSteamContentServerCallbacks","consttype": "int", "constval": "600"} +,{ + "constname": "k_iSteamUtilsCallbacks","consttype": "int", "constval": "700"} +,{ + "constname": "k_iClientFriendsCallbacks","consttype": "int", "constval": "800"} +,{ + "constname": "k_iClientUserCallbacks","consttype": "int", "constval": "900"} +,{ + "constname": "k_iSteamAppsCallbacks","consttype": "int", "constval": "1000"} +,{ + "constname": "k_iSteamUserStatsCallbacks","consttype": "int", "constval": "1100"} +,{ + "constname": "k_iSteamNetworkingCallbacks","consttype": "int", "constval": "1200"} +,{ + "constname": "k_iClientRemoteStorageCallbacks","consttype": "int", "constval": "1300"} +,{ + "constname": "k_iClientDepotBuilderCallbacks","consttype": "int", "constval": "1400"} +,{ + "constname": "k_iSteamGameServerItemsCallbacks","consttype": "int", "constval": "1500"} +,{ + "constname": "k_iClientUtilsCallbacks","consttype": "int", "constval": "1600"} +,{ + "constname": "k_iSteamGameCoordinatorCallbacks","consttype": "int", "constval": "1700"} +,{ + "constname": "k_iSteamGameServerStatsCallbacks","consttype": "int", "constval": "1800"} +,{ + "constname": "k_iSteam2AsyncCallbacks","consttype": "int", "constval": "1900"} +,{ + "constname": "k_iSteamGameStatsCallbacks","consttype": "int", "constval": "2000"} +,{ + "constname": "k_iClientHTTPCallbacks","consttype": "int", "constval": "2100"} +,{ + "constname": "k_iClientScreenshotsCallbacks","consttype": "int", "constval": "2200"} +,{ + "constname": "k_iSteamScreenshotsCallbacks","consttype": "int", "constval": "2300"} +,{ + "constname": "k_iClientAudioCallbacks","consttype": "int", "constval": "2400"} +,{ + "constname": "k_iClientUnifiedMessagesCallbacks","consttype": "int", "constval": "2500"} +,{ + "constname": "k_iSteamStreamLauncherCallbacks","consttype": "int", "constval": "2600"} +,{ + "constname": "k_iClientControllerCallbacks","consttype": "int", "constval": "2700"} +,{ + "constname": "k_iSteamControllerCallbacks","consttype": "int", "constval": "2800"} +,{ + "constname": "k_iClientParentalSettingsCallbacks","consttype": "int", "constval": "2900"} +,{ + "constname": "k_iClientDeviceAuthCallbacks","consttype": "int", "constval": "3000"} +,{ + "constname": "k_iClientNetworkDeviceManagerCallbacks","consttype": "int", "constval": "3100"} +,{ + "constname": "k_iClientMusicCallbacks","consttype": "int", "constval": "3200"} +,{ + "constname": "k_iClientRemoteClientManagerCallbacks","consttype": "int", "constval": "3300"} +,{ + "constname": "k_iClientUGCCallbacks","consttype": "int", "constval": "3400"} +,{ + "constname": "k_iSteamStreamClientCallbacks","consttype": "int", "constval": "3500"} +,{ + "constname": "k_IClientProductBuilderCallbacks","consttype": "int", "constval": "3600"} +,{ + "constname": "k_iClientShortcutsCallbacks","consttype": "int", "constval": "3700"} +,{ + "constname": "k_iClientRemoteControlManagerCallbacks","consttype": "int", "constval": "3800"} +,{ + "constname": "k_iSteamAppListCallbacks","consttype": "int", "constval": "3900"} +,{ + "constname": "k_iSteamMusicCallbacks","consttype": "int", "constval": "4000"} +,{ + "constname": "k_iSteamMusicRemoteCallbacks","consttype": "int", "constval": "4100"} +,{ + "constname": "k_iClientVRCallbacks","consttype": "int", "constval": "4200"} +,{ + "constname": "k_iClientReservedCallbacks","consttype": "int", "constval": "4300"} +,{ + "constname": "k_iSteamReservedCallbacks","consttype": "int", "constval": "4400"} +,{ + "constname": "k_iSteamHTMLSurfaceCallbacks","consttype": "int", "constval": "4500"} +,{ + "constname": "k_iClientVideoCallbacks","consttype": "int", "constval": "4600"} +,{ + "constname": "k_iClientInventoryCallbacks","consttype": "int", "constval": "4700"} +,{ + "constname": "k_cchPersonaNameMax","consttype": "int", "constval": "128"} +,{ + "constname": "k_cwchPersonaNameMax","consttype": "int", "constval": "32"} +,{ + "constname": "k_cchMaxRichPresenceKeys","consttype": "int", "constval": "20"} +,{ + "constname": "k_cchMaxRichPresenceKeyLength","consttype": "int", "constval": "64"} +,{ + "constname": "k_cchMaxRichPresenceValueLength","consttype": "int", "constval": "256"} +,{ + "constname": "k_cchStatNameMax","consttype": "int", "constval": "128"} +,{ + "constname": "k_cchLeaderboardNameMax","consttype": "int", "constval": "128"} +,{ + "constname": "k_cLeaderboardDetailsMax","consttype": "int", "constval": "64"} +,{ + "constname": "k_InvalidUnifiedMessageHandle","consttype": "const ClientUnifiedMessageHandle", "constval": "0"} +,{ + "constname": "k_SteamItemInstanceIDInvalid","consttype": "const SteamItemInstanceID_t", "constval": "18446744073709551615"} +,{ + "constname": "k_SteamInventoryResultInvalid","consttype": "const SteamInventoryResult_t", "constval": "-1"} +], +"structs":[{"struct": "CSteamID","fields": [ +{ "fieldname": "m_steamid", "fieldtype": "union SteamID_t"}]} +,{"struct": "CSteamID::SteamID_t","fields": [ +{ "fieldname": "m_comp", "fieldtype": "struct SteamIDComponent_t"}, +{ "fieldname": "m_unAll64Bits", "fieldtype": "uint64"}]} +,{"struct": "CSteamID::SteamID_t::SteamIDComponent_t","fields": [ +{ "fieldname": "m_unAccountID", "fieldtype": "uint32"}, +{ "fieldname": "m_unAccountInstance", "fieldtype": "unsigned int"}, +{ "fieldname": "m_EAccountType", "fieldtype": "unsigned int"}, +{ "fieldname": "m_EUniverse", "fieldtype": "enum EUniverse"}]} +,{"struct": "CGameID::GameID_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "unsigned int"}, +{ "fieldname": "m_nType", "fieldtype": "unsigned int"}, +{ "fieldname": "m_nModID", "fieldtype": "unsigned int"}]} +,{"struct": "CGameID::(anonymous)","fields": [ +{ "fieldname": "m_ulGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_gameID", "fieldtype": "struct CGameID::GameID_t"}]} +,{"struct": "ValvePackingSentinel_t","fields": [ +{ "fieldname": "m_u32", "fieldtype": "uint32"}, +{ "fieldname": "m_u64", "fieldtype": "uint64"}, +{ "fieldname": "m_u16", "fieldtype": "uint16"}, +{ "fieldname": "m_d", "fieldtype": "double"}]} +,{"struct": "CallbackMsg_t","fields": [ +{ "fieldname": "m_hSteamUser", "fieldtype": "HSteamUser"}, +{ "fieldname": "m_iCallback", "fieldtype": "int"}, +{ "fieldname": "m_pubParam", "fieldtype": "uint8 *"}, +{ "fieldname": "m_cubParam", "fieldtype": "int"}]} +,{"struct": "SteamServerConnectFailure_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_bStillRetrying", "fieldtype": "_Bool"}]} +,{"struct": "SteamServersDisconnected_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "ClientGameServerDeny_t","fields": [ +{ "fieldname": "m_uAppID", "fieldtype": "uint32"}, +{ "fieldname": "m_unGameServerIP", "fieldtype": "uint32"}, +{ "fieldname": "m_usGameServerPort", "fieldtype": "uint16"}, +{ "fieldname": "m_bSecure", "fieldtype": "uint16"}, +{ "fieldname": "m_uReason", "fieldtype": "uint32"}]} +,{"struct": "ValidateAuthTicketResponse_t","fields": [ +{ "fieldname": "m_SteamID", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_eAuthSessionResponse", "fieldtype": "enum EAuthSessionResponse"}, +{ "fieldname": "m_OwnerSteamID", "fieldtype": "class CSteamID"}]} +,{"struct": "MicroTxnAuthorizationResponse_t","fields": [ +{ "fieldname": "m_unAppID", "fieldtype": "uint32"}, +{ "fieldname": "m_ulOrderID", "fieldtype": "uint64"}, +{ "fieldname": "m_bAuthorized", "fieldtype": "uint8"}]} +,{"struct": "EncryptedAppTicketResponse_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "GetAuthSessionTicketResponse_t","fields": [ +{ "fieldname": "m_hAuthTicket", "fieldtype": "HAuthTicket"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "GameWebCallback_t","fields": [ +{ "fieldname": "m_szURL", "fieldtype": "char [256]"}]} +,{"struct": "StoreAuthURLResponse_t","fields": [ +{ "fieldname": "m_szURL", "fieldtype": "char [512]"}]} +,{"struct": "FriendGameInfo_t","fields": [ +{ "fieldname": "m_gameID", "fieldtype": "class CGameID"}, +{ "fieldname": "m_unGameIP", "fieldtype": "uint32"}, +{ "fieldname": "m_usGamePort", "fieldtype": "uint16"}, +{ "fieldname": "m_usQueryPort", "fieldtype": "uint16"}, +{ "fieldname": "m_steamIDLobby", "fieldtype": "class CSteamID"}]} +,{"struct": "FriendSessionStateInfo_t","fields": [ +{ "fieldname": "m_uiOnlineSessionInstances", "fieldtype": "uint32"}, +{ "fieldname": "m_uiPublishedToFriendsSessionInstance", "fieldtype": "uint8"}]} +,{"struct": "PersonaStateChange_t","fields": [ +{ "fieldname": "m_ulSteamID", "fieldtype": "uint64"}, +{ "fieldname": "m_nChangeFlags", "fieldtype": "int"}]} +,{"struct": "GameOverlayActivated_t","fields": [ +{ "fieldname": "m_bActive", "fieldtype": "uint8"}]} +,{"struct": "GameServerChangeRequested_t","fields": [ +{ "fieldname": "m_rgchServer", "fieldtype": "char [64]"}, +{ "fieldname": "m_rgchPassword", "fieldtype": "char [64]"}]} +,{"struct": "GameLobbyJoinRequested_t","fields": [ +{ "fieldname": "m_steamIDLobby", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_steamIDFriend", "fieldtype": "class CSteamID"}]} +,{"struct": "AvatarImageLoaded_t","fields": [ +{ "fieldname": "m_steamID", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_iImage", "fieldtype": "int"}, +{ "fieldname": "m_iWide", "fieldtype": "int"}, +{ "fieldname": "m_iTall", "fieldtype": "int"}]} +,{"struct": "ClanOfficerListResponse_t","fields": [ +{ "fieldname": "m_steamIDClan", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_cOfficers", "fieldtype": "int"}, +{ "fieldname": "m_bSuccess", "fieldtype": "uint8"}]} +,{"struct": "FriendRichPresenceUpdate_t","fields": [ +{ "fieldname": "m_steamIDFriend", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}]} +,{"struct": "GameRichPresenceJoinRequested_t","fields": [ +{ "fieldname": "m_steamIDFriend", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_rgchConnect", "fieldtype": "char [256]"}]} +,{"struct": "GameConnectedClanChatMsg_t","fields": [ +{ "fieldname": "m_steamIDClanChat", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_iMessageID", "fieldtype": "int"}]} +,{"struct": "GameConnectedChatJoin_t","fields": [ +{ "fieldname": "m_steamIDClanChat", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}]} +,{"struct": "GameConnectedChatLeave_t","fields": [ +{ "fieldname": "m_steamIDClanChat", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_bKicked", "fieldtype": "_Bool"}, +{ "fieldname": "m_bDropped", "fieldtype": "_Bool"}]} +,{"struct": "DownloadClanActivityCountsResult_t","fields": [ +{ "fieldname": "m_bSuccess", "fieldtype": "_Bool"}]} +,{"struct": "JoinClanChatRoomCompletionResult_t","fields": [ +{ "fieldname": "m_steamIDClanChat", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_eChatRoomEnterResponse", "fieldtype": "enum EChatRoomEnterResponse"}]} +,{"struct": "GameConnectedFriendChatMsg_t","fields": [ +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_iMessageID", "fieldtype": "int"}]} +,{"struct": "FriendsGetFollowerCount_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_steamID", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_nCount", "fieldtype": "int"}]} +,{"struct": "FriendsIsFollowing_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_steamID", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_bIsFollowing", "fieldtype": "_Bool"}]} +,{"struct": "FriendsEnumerateFollowingList_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_rgSteamID", "fieldtype": "class CSteamID [50]"}, +{ "fieldname": "m_nResultsReturned", "fieldtype": "int32"}, +{ "fieldname": "m_nTotalResultCount", "fieldtype": "int32"}]} +,{"struct": "SetPersonaNameResponse_t","fields": [ +{ "fieldname": "m_bSuccess", "fieldtype": "_Bool"}, +{ "fieldname": "m_bLocalSuccess", "fieldtype": "_Bool"}, +{ "fieldname": "m_result", "fieldtype": "enum EResult"}]} +,{"struct": "LowBatteryPower_t","fields": [ +{ "fieldname": "m_nMinutesBatteryLeft", "fieldtype": "uint8"}]} +,{"struct": "SteamAPICallCompleted_t","fields": [ +{ "fieldname": "m_hAsyncCall", "fieldtype": "SteamAPICall_t"}]} +,{"struct": "CheckFileSignature_t","fields": [ +{ "fieldname": "m_eCheckFileSignature", "fieldtype": "enum ECheckFileSignature"}]} +,{"struct": "GamepadTextInputDismissed_t","fields": [ +{ "fieldname": "m_bSubmitted", "fieldtype": "_Bool"}, +{ "fieldname": "m_unSubmittedText", "fieldtype": "uint32"}]} +,{"struct": "MatchMakingKeyValuePair_t","fields": [ +{ "fieldname": "m_szKey", "fieldtype": "char [256]"}, +{ "fieldname": "m_szValue", "fieldtype": "char [256]"}]} +,{"struct": "servernetadr_t","fields": [ +{ "fieldname": "m_usConnectionPort", "fieldtype": "uint16"}, +{ "fieldname": "m_usQueryPort", "fieldtype": "uint16"}, +{ "fieldname": "m_unIP", "fieldtype": "uint32"}]} +,{"struct": "gameserveritem_t","fields": [ +{ "fieldname": "m_NetAdr", "fieldtype": "class servernetadr_t"}, +{ "fieldname": "m_nPing", "fieldtype": "int"}, +{ "fieldname": "m_bHadSuccessfulResponse", "fieldtype": "_Bool"}, +{ "fieldname": "m_bDoNotRefresh", "fieldtype": "_Bool"}, +{ "fieldname": "m_szGameDir", "fieldtype": "char [32]"}, +{ "fieldname": "m_szMap", "fieldtype": "char [32]"}, +{ "fieldname": "m_szGameDescription", "fieldtype": "char [64]"}, +{ "fieldname": "m_nAppID", "fieldtype": "uint32"}, +{ "fieldname": "m_nPlayers", "fieldtype": "int"}, +{ "fieldname": "m_nMaxPlayers", "fieldtype": "int"}, +{ "fieldname": "m_nBotPlayers", "fieldtype": "int"}, +{ "fieldname": "m_bPassword", "fieldtype": "_Bool"}, +{ "fieldname": "m_bSecure", "fieldtype": "_Bool"}, +{ "fieldname": "m_ulTimeLastPlayed", "fieldtype": "uint32"}, +{ "fieldname": "m_nServerVersion", "fieldtype": "int"}, +{ "fieldname": "m_szServerName", "fieldtype": "char [64]"}, +{ "fieldname": "m_szGameTags", "fieldtype": "char [128]"}, +{ "fieldname": "m_steamID", "fieldtype": "class CSteamID"}]} +,{"struct": "FavoritesListChanged_t","fields": [ +{ "fieldname": "m_nIP", "fieldtype": "uint32"}, +{ "fieldname": "m_nQueryPort", "fieldtype": "uint32"}, +{ "fieldname": "m_nConnPort", "fieldtype": "uint32"}, +{ "fieldname": "m_nAppID", "fieldtype": "uint32"}, +{ "fieldname": "m_nFlags", "fieldtype": "uint32"}, +{ "fieldname": "m_bAdd", "fieldtype": "_Bool"}, +{ "fieldname": "m_unAccountId", "fieldtype": "AccountID_t"}]} +,{"struct": "LobbyInvite_t","fields": [ +{ "fieldname": "m_ulSteamIDUser", "fieldtype": "uint64"}, +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}, +{ "fieldname": "m_ulGameID", "fieldtype": "uint64"}]} +,{"struct": "LobbyEnter_t","fields": [ +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}, +{ "fieldname": "m_rgfChatPermissions", "fieldtype": "uint32"}, +{ "fieldname": "m_bLocked", "fieldtype": "_Bool"}, +{ "fieldname": "m_EChatRoomEnterResponse", "fieldtype": "uint32"}]} +,{"struct": "LobbyDataUpdate_t","fields": [ +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}, +{ "fieldname": "m_ulSteamIDMember", "fieldtype": "uint64"}, +{ "fieldname": "m_bSuccess", "fieldtype": "uint8"}]} +,{"struct": "LobbyChatUpdate_t","fields": [ +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}, +{ "fieldname": "m_ulSteamIDUserChanged", "fieldtype": "uint64"}, +{ "fieldname": "m_ulSteamIDMakingChange", "fieldtype": "uint64"}, +{ "fieldname": "m_rgfChatMemberStateChange", "fieldtype": "uint32"}]} +,{"struct": "LobbyChatMsg_t","fields": [ +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}, +{ "fieldname": "m_ulSteamIDUser", "fieldtype": "uint64"}, +{ "fieldname": "m_eChatEntryType", "fieldtype": "uint8"}, +{ "fieldname": "m_iChatID", "fieldtype": "uint32"}]} +,{"struct": "LobbyGameCreated_t","fields": [ +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}, +{ "fieldname": "m_ulSteamIDGameServer", "fieldtype": "uint64"}, +{ "fieldname": "m_unIP", "fieldtype": "uint32"}, +{ "fieldname": "m_usPort", "fieldtype": "uint16"}]} +,{"struct": "LobbyMatchList_t","fields": [ +{ "fieldname": "m_nLobbiesMatching", "fieldtype": "uint32"}]} +,{"struct": "LobbyKicked_t","fields": [ +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}, +{ "fieldname": "m_ulSteamIDAdmin", "fieldtype": "uint64"}, +{ "fieldname": "m_bKickedDueToDisconnect", "fieldtype": "uint8"}]} +,{"struct": "LobbyCreated_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_ulSteamIDLobby", "fieldtype": "uint64"}]} +,{"struct": "PSNGameBootInviteResult_t","fields": [ +{ "fieldname": "m_bGameBootInviteExists", "fieldtype": "_Bool"}, +{ "fieldname": "m_steamIDLobby", "fieldtype": "class CSteamID"}]} +,{"struct": "FavoritesListAccountsUpdated_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "SteamParamStringArray_t","fields": [ +{ "fieldname": "m_ppStrings", "fieldtype": "const char **"}, +{ "fieldname": "m_nNumStrings", "fieldtype": "int32"}]} +,{"struct": "RemoteStorageAppSyncedClient_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_unNumDownloads", "fieldtype": "int"}]} +,{"struct": "RemoteStorageAppSyncedServer_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_unNumUploads", "fieldtype": "int"}]} +,{"struct": "RemoteStorageAppSyncProgress_t","fields": [ +{ "fieldname": "m_rgchCurrentFile", "fieldtype": "char [260]"}, +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_uBytesTransferredThisChunk", "fieldtype": "uint32"}, +{ "fieldname": "m_dAppPercentComplete", "fieldtype": "double"}, +{ "fieldname": "m_bUploading", "fieldtype": "_Bool"}]} +,{"struct": "RemoteStorageAppSyncStatusCheck_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "RemoteStorageConflictResolution_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "RemoteStorageFileShareResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_hFile", "fieldtype": "UGCHandle_t"}, +{ "fieldname": "m_rgchFilename", "fieldtype": "char [260]"}]} +,{"struct": "RemoteStoragePublishFileResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_bUserNeedsToAcceptWorkshopLegalAgreement", "fieldtype": "_Bool"}]} +,{"struct": "RemoteStorageDeletePublishedFileResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}]} +,{"struct": "RemoteStorageEnumerateUserPublishedFilesResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nResultsReturned", "fieldtype": "int32"}, +{ "fieldname": "m_nTotalResultCount", "fieldtype": "int32"}, +{ "fieldname": "m_rgPublishedFileId", "fieldtype": "PublishedFileId_t [50]"}]} +,{"struct": "RemoteStorageSubscribePublishedFileResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}]} +,{"struct": "RemoteStorageEnumerateUserSubscribedFilesResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nResultsReturned", "fieldtype": "int32"}, +{ "fieldname": "m_nTotalResultCount", "fieldtype": "int32"}, +{ "fieldname": "m_rgPublishedFileId", "fieldtype": "PublishedFileId_t [50]"}, +{ "fieldname": "m_rgRTimeSubscribed", "fieldtype": "uint32 [50]"}]} +,{"struct": "RemoteStorageUnsubscribePublishedFileResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}]} +,{"struct": "RemoteStorageUpdatePublishedFileResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_bUserNeedsToAcceptWorkshopLegalAgreement", "fieldtype": "_Bool"}]} +,{"struct": "RemoteStorageDownloadUGCResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_hFile", "fieldtype": "UGCHandle_t"}, +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_nSizeInBytes", "fieldtype": "int32"}, +{ "fieldname": "m_pchFileName", "fieldtype": "char [260]"}, +{ "fieldname": "m_ulSteamIDOwner", "fieldtype": "uint64"}]} +,{"struct": "RemoteStorageGetPublishedFileDetailsResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_nCreatorAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_nConsumerAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_rgchTitle", "fieldtype": "char [129]"}, +{ "fieldname": "m_rgchDescription", "fieldtype": "char [8000]"}, +{ "fieldname": "m_hFile", "fieldtype": "UGCHandle_t"}, +{ "fieldname": "m_hPreviewFile", "fieldtype": "UGCHandle_t"}, +{ "fieldname": "m_ulSteamIDOwner", "fieldtype": "uint64"}, +{ "fieldname": "m_rtimeCreated", "fieldtype": "uint32"}, +{ "fieldname": "m_rtimeUpdated", "fieldtype": "uint32"}, +{ "fieldname": "m_eVisibility", "fieldtype": "enum ERemoteStoragePublishedFileVisibility"}, +{ "fieldname": "m_bBanned", "fieldtype": "_Bool"}, +{ "fieldname": "m_rgchTags", "fieldtype": "char [1025]"}, +{ "fieldname": "m_bTagsTruncated", "fieldtype": "_Bool"}, +{ "fieldname": "m_pchFileName", "fieldtype": "char [260]"}, +{ "fieldname": "m_nFileSize", "fieldtype": "int32"}, +{ "fieldname": "m_nPreviewFileSize", "fieldtype": "int32"}, +{ "fieldname": "m_rgchURL", "fieldtype": "char [256]"}, +{ "fieldname": "m_eFileType", "fieldtype": "enum EWorkshopFileType"}, +{ "fieldname": "m_bAcceptedForUse", "fieldtype": "_Bool"}]} +,{"struct": "RemoteStorageEnumerateWorkshopFilesResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nResultsReturned", "fieldtype": "int32"}, +{ "fieldname": "m_nTotalResultCount", "fieldtype": "int32"}, +{ "fieldname": "m_rgPublishedFileId", "fieldtype": "PublishedFileId_t [50]"}, +{ "fieldname": "m_rgScore", "fieldtype": "float [50]"}, +{ "fieldname": "m_nAppId", "fieldtype": "AppId_t"}, +{ "fieldname": "m_unStartIndex", "fieldtype": "uint32"}]} +,{"struct": "RemoteStorageGetPublishedItemVoteDetailsResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_unPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_nVotesFor", "fieldtype": "int32"}, +{ "fieldname": "m_nVotesAgainst", "fieldtype": "int32"}, +{ "fieldname": "m_nReports", "fieldtype": "int32"}, +{ "fieldname": "m_fScore", "fieldtype": "float"}]} +,{"struct": "RemoteStoragePublishedFileSubscribed_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}]} +,{"struct": "RemoteStoragePublishedFileUnsubscribed_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}]} +,{"struct": "RemoteStoragePublishedFileDeleted_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}]} +,{"struct": "RemoteStorageUpdateUserPublishedItemVoteResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}]} +,{"struct": "RemoteStorageUserVoteDetails_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_eVote", "fieldtype": "enum EWorkshopVote"}]} +,{"struct": "RemoteStorageEnumerateUserSharedWorkshopFilesResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nResultsReturned", "fieldtype": "int32"}, +{ "fieldname": "m_nTotalResultCount", "fieldtype": "int32"}, +{ "fieldname": "m_rgPublishedFileId", "fieldtype": "PublishedFileId_t [50]"}]} +,{"struct": "RemoteStorageSetUserPublishedFileActionResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_eAction", "fieldtype": "enum EWorkshopFileAction"}]} +,{"struct": "RemoteStorageEnumeratePublishedFilesByUserActionResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_eAction", "fieldtype": "enum EWorkshopFileAction"}, +{ "fieldname": "m_nResultsReturned", "fieldtype": "int32"}, +{ "fieldname": "m_nTotalResultCount", "fieldtype": "int32"}, +{ "fieldname": "m_rgPublishedFileId", "fieldtype": "PublishedFileId_t [50]"}, +{ "fieldname": "m_rgRTimeUpdated", "fieldtype": "uint32 [50]"}]} +,{"struct": "RemoteStoragePublishFileProgress_t","fields": [ +{ "fieldname": "m_dPercentFile", "fieldtype": "double"}, +{ "fieldname": "m_bPreview", "fieldtype": "_Bool"}]} +,{"struct": "RemoteStoragePublishedFileUpdated_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_hFile", "fieldtype": "UGCHandle_t"}]} +,{"struct": "RemoteStorageFileWriteAsyncComplete_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "RemoteStorageFileReadAsyncComplete_t","fields": [ +{ "fieldname": "m_hFileReadAsync", "fieldtype": "SteamAPICall_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nOffset", "fieldtype": "uint32"}, +{ "fieldname": "m_cubRead", "fieldtype": "uint32"}]} +,{"struct": "LeaderboardEntry_t","fields": [ +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_nGlobalRank", "fieldtype": "int32"}, +{ "fieldname": "m_nScore", "fieldtype": "int32"}, +{ "fieldname": "m_cDetails", "fieldtype": "int32"}, +{ "fieldname": "m_hUGC", "fieldtype": "UGCHandle_t"}]} +,{"struct": "UserStatsReceived_t","fields": [ +{ "fieldname": "m_nGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}]} +,{"struct": "UserStatsStored_t","fields": [ +{ "fieldname": "m_nGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "UserAchievementStored_t","fields": [ +{ "fieldname": "m_nGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_bGroupAchievement", "fieldtype": "_Bool"}, +{ "fieldname": "m_rgchAchievementName", "fieldtype": "char [128]"}, +{ "fieldname": "m_nCurProgress", "fieldtype": "uint32"}, +{ "fieldname": "m_nMaxProgress", "fieldtype": "uint32"}]} +,{"struct": "LeaderboardFindResult_t","fields": [ +{ "fieldname": "m_hSteamLeaderboard", "fieldtype": "SteamLeaderboard_t"}, +{ "fieldname": "m_bLeaderboardFound", "fieldtype": "uint8"}]} +,{"struct": "LeaderboardScoresDownloaded_t","fields": [ +{ "fieldname": "m_hSteamLeaderboard", "fieldtype": "SteamLeaderboard_t"}, +{ "fieldname": "m_hSteamLeaderboardEntries", "fieldtype": "SteamLeaderboardEntries_t"}, +{ "fieldname": "m_cEntryCount", "fieldtype": "int"}]} +,{"struct": "LeaderboardScoreUploaded_t","fields": [ +{ "fieldname": "m_bSuccess", "fieldtype": "uint8"}, +{ "fieldname": "m_hSteamLeaderboard", "fieldtype": "SteamLeaderboard_t"}, +{ "fieldname": "m_nScore", "fieldtype": "int32"}, +{ "fieldname": "m_bScoreChanged", "fieldtype": "uint8"}, +{ "fieldname": "m_nGlobalRankNew", "fieldtype": "int"}, +{ "fieldname": "m_nGlobalRankPrevious", "fieldtype": "int"}]} +,{"struct": "NumberOfCurrentPlayers_t","fields": [ +{ "fieldname": "m_bSuccess", "fieldtype": "uint8"}, +{ "fieldname": "m_cPlayers", "fieldtype": "int32"}]} +,{"struct": "UserStatsUnloaded_t","fields": [ +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}]} +,{"struct": "UserAchievementIconFetched_t","fields": [ +{ "fieldname": "m_nGameID", "fieldtype": "class CGameID"}, +{ "fieldname": "m_rgchAchievementName", "fieldtype": "char [128]"}, +{ "fieldname": "m_bAchieved", "fieldtype": "_Bool"}, +{ "fieldname": "m_nIconHandle", "fieldtype": "int"}]} +,{"struct": "GlobalAchievementPercentagesReady_t","fields": [ +{ "fieldname": "m_nGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "LeaderboardUGCSet_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_hSteamLeaderboard", "fieldtype": "SteamLeaderboard_t"}]} +,{"struct": "PS3TrophiesInstalled_t","fields": [ +{ "fieldname": "m_nGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_ulRequiredDiskSpace", "fieldtype": "uint64"}]} +,{"struct": "GlobalStatsReceived_t","fields": [ +{ "fieldname": "m_nGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "DlcInstalled_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}]} +,{"struct": "RegisterActivationCodeResponse_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum ERegisterActivationCodeResult"}, +{ "fieldname": "m_unPackageRegistered", "fieldtype": "uint32"}]} +,{"struct": "AppProofOfPurchaseKeyResponse_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nAppID", "fieldtype": "uint32"}, +{ "fieldname": "m_rgchKey", "fieldtype": "char [64]"}]} +,{"struct": "P2PSessionState_t","fields": [ +{ "fieldname": "m_bConnectionActive", "fieldtype": "uint8"}, +{ "fieldname": "m_bConnecting", "fieldtype": "uint8"}, +{ "fieldname": "m_eP2PSessionError", "fieldtype": "uint8"}, +{ "fieldname": "m_bUsingRelay", "fieldtype": "uint8"}, +{ "fieldname": "m_nBytesQueuedForSend", "fieldtype": "int32"}, +{ "fieldname": "m_nPacketsQueuedForSend", "fieldtype": "int32"}, +{ "fieldname": "m_nRemoteIP", "fieldtype": "uint32"}, +{ "fieldname": "m_nRemotePort", "fieldtype": "uint16"}]} +,{"struct": "P2PSessionRequest_t","fields": [ +{ "fieldname": "m_steamIDRemote", "fieldtype": "class CSteamID"}]} +,{"struct": "P2PSessionConnectFail_t","fields": [ +{ "fieldname": "m_steamIDRemote", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_eP2PSessionError", "fieldtype": "uint8"}]} +,{"struct": "SocketStatusCallback_t","fields": [ +{ "fieldname": "m_hSocket", "fieldtype": "SNetSocket_t"}, +{ "fieldname": "m_hListenSocket", "fieldtype": "SNetListenSocket_t"}, +{ "fieldname": "m_steamIDRemote", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_eSNetSocketState", "fieldtype": "int"}]} +,{"struct": "ScreenshotReady_t","fields": [ +{ "fieldname": "m_hLocal", "fieldtype": "ScreenshotHandle"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "VolumeHasChanged_t","fields": [ +{ "fieldname": "m_flNewVolume", "fieldtype": "float"}]} +,{"struct": "MusicPlayerWantsShuffled_t","fields": [ +{ "fieldname": "m_bShuffled", "fieldtype": "_Bool"}]} +,{"struct": "MusicPlayerWantsLooped_t","fields": [ +{ "fieldname": "m_bLooped", "fieldtype": "_Bool"}]} +,{"struct": "MusicPlayerWantsVolume_t","fields": [ +{ "fieldname": "m_flNewVolume", "fieldtype": "float"}]} +,{"struct": "MusicPlayerSelectsQueueEntry_t","fields": [ +{ "fieldname": "nID", "fieldtype": "int"}]} +,{"struct": "MusicPlayerSelectsPlaylistEntry_t","fields": [ +{ "fieldname": "nID", "fieldtype": "int"}]} +,{"struct": "MusicPlayerWantsPlayingRepeatStatus_t","fields": [ +{ "fieldname": "m_nPlayingRepeatStatus", "fieldtype": "int"}]} +,{"struct": "HTTPRequestCompleted_t","fields": [ +{ "fieldname": "m_hRequest", "fieldtype": "HTTPRequestHandle"}, +{ "fieldname": "m_ulContextValue", "fieldtype": "uint64"}, +{ "fieldname": "m_bRequestSuccessful", "fieldtype": "_Bool"}, +{ "fieldname": "m_eStatusCode", "fieldtype": "enum EHTTPStatusCode"}, +{ "fieldname": "m_unBodySize", "fieldtype": "uint32"}]} +,{"struct": "HTTPRequestHeadersReceived_t","fields": [ +{ "fieldname": "m_hRequest", "fieldtype": "HTTPRequestHandle"}, +{ "fieldname": "m_ulContextValue", "fieldtype": "uint64"}]} +,{"struct": "HTTPRequestDataReceived_t","fields": [ +{ "fieldname": "m_hRequest", "fieldtype": "HTTPRequestHandle"}, +{ "fieldname": "m_ulContextValue", "fieldtype": "uint64"}, +{ "fieldname": "m_cOffset", "fieldtype": "uint32"}, +{ "fieldname": "m_cBytesReceived", "fieldtype": "uint32"}]} +,{"struct": "SteamUnifiedMessagesSendMethodResult_t","fields": [ +{ "fieldname": "m_hHandle", "fieldtype": "ClientUnifiedMessageHandle"}, +{ "fieldname": "m_unContext", "fieldtype": "uint64"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_unResponseSize", "fieldtype": "uint32"}]} +,{"struct": "ControllerAnalogActionData_t","fields": [ +{ "fieldname": "eMode", "fieldtype": "enum EControllerSourceMode"}, +{ "fieldname": "x", "fieldtype": "float"}, +{ "fieldname": "y", "fieldtype": "float"}, +{ "fieldname": "bActive", "fieldtype": "_Bool"}]} +,{"struct": "ControllerDigitalActionData_t","fields": [ +{ "fieldname": "bState", "fieldtype": "_Bool"}, +{ "fieldname": "bActive", "fieldtype": "_Bool"}]} +,{"struct": "SteamUGCDetails_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_eFileType", "fieldtype": "enum EWorkshopFileType"}, +{ "fieldname": "m_nCreatorAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_nConsumerAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_rgchTitle", "fieldtype": "char [129]"}, +{ "fieldname": "m_rgchDescription", "fieldtype": "char [8000]"}, +{ "fieldname": "m_ulSteamIDOwner", "fieldtype": "uint64"}, +{ "fieldname": "m_rtimeCreated", "fieldtype": "uint32"}, +{ "fieldname": "m_rtimeUpdated", "fieldtype": "uint32"}, +{ "fieldname": "m_rtimeAddedToUserList", "fieldtype": "uint32"}, +{ "fieldname": "m_eVisibility", "fieldtype": "enum ERemoteStoragePublishedFileVisibility"}, +{ "fieldname": "m_bBanned", "fieldtype": "_Bool"}, +{ "fieldname": "m_bAcceptedForUse", "fieldtype": "_Bool"}, +{ "fieldname": "m_bTagsTruncated", "fieldtype": "_Bool"}, +{ "fieldname": "m_rgchTags", "fieldtype": "char [1025]"}, +{ "fieldname": "m_hFile", "fieldtype": "UGCHandle_t"}, +{ "fieldname": "m_hPreviewFile", "fieldtype": "UGCHandle_t"}, +{ "fieldname": "m_pchFileName", "fieldtype": "char [260]"}, +{ "fieldname": "m_nFileSize", "fieldtype": "int32"}, +{ "fieldname": "m_nPreviewFileSize", "fieldtype": "int32"}, +{ "fieldname": "m_rgchURL", "fieldtype": "char [256]"}, +{ "fieldname": "m_unVotesUp", "fieldtype": "uint32"}, +{ "fieldname": "m_unVotesDown", "fieldtype": "uint32"}, +{ "fieldname": "m_flScore", "fieldtype": "float"}, +{ "fieldname": "m_unNumChildren", "fieldtype": "uint32"}]} +,{"struct": "SteamUGCQueryCompleted_t","fields": [ +{ "fieldname": "m_handle", "fieldtype": "UGCQueryHandle_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_unNumResultsReturned", "fieldtype": "uint32"}, +{ "fieldname": "m_unTotalMatchingResults", "fieldtype": "uint32"}, +{ "fieldname": "m_bCachedData", "fieldtype": "_Bool"}]} +,{"struct": "SteamUGCRequestUGCDetailsResult_t","fields": [ +{ "fieldname": "m_details", "fieldtype": "struct SteamUGCDetails_t"}, +{ "fieldname": "m_bCachedData", "fieldtype": "_Bool"}]} +,{"struct": "CreateItemResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_bUserNeedsToAcceptWorkshopLegalAgreement", "fieldtype": "_Bool"}]} +,{"struct": "SubmitItemUpdateResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_bUserNeedsToAcceptWorkshopLegalAgreement", "fieldtype": "_Bool"}]} +,{"struct": "DownloadItemResult_t","fields": [ +{ "fieldname": "m_unAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "UserFavoriteItemsListChanged_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_bWasAddRequest", "fieldtype": "_Bool"}]} +,{"struct": "SetUserItemVoteResult_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_bVoteUp", "fieldtype": "_Bool"}]} +,{"struct": "GetUserItemVoteResult_t","fields": [ +{ "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_bVotedUp", "fieldtype": "_Bool"}, +{ "fieldname": "m_bVotedDown", "fieldtype": "_Bool"}, +{ "fieldname": "m_bVoteSkipped", "fieldtype": "_Bool"}]} +,{"struct": "SteamAppInstalled_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}]} +,{"struct": "SteamAppUninstalled_t","fields": [ +{ "fieldname": "m_nAppID", "fieldtype": "AppId_t"}]} +,{"struct": "HTML_BrowserReady_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}]} +,{"struct": "HTML_NeedsPaint_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pBGRA", "fieldtype": "const char *"}, +{ "fieldname": "unWide", "fieldtype": "uint32"}, +{ "fieldname": "unTall", "fieldtype": "uint32"}, +{ "fieldname": "unUpdateX", "fieldtype": "uint32"}, +{ "fieldname": "unUpdateY", "fieldtype": "uint32"}, +{ "fieldname": "unUpdateWide", "fieldtype": "uint32"}, +{ "fieldname": "unUpdateTall", "fieldtype": "uint32"}, +{ "fieldname": "unScrollX", "fieldtype": "uint32"}, +{ "fieldname": "unScrollY", "fieldtype": "uint32"}, +{ "fieldname": "flPageScale", "fieldtype": "float"}, +{ "fieldname": "unPageSerial", "fieldtype": "uint32"}]} +,{"struct": "HTML_StartRequest_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchURL", "fieldtype": "const char *"}, +{ "fieldname": "pchTarget", "fieldtype": "const char *"}, +{ "fieldname": "pchPostData", "fieldtype": "const char *"}, +{ "fieldname": "bIsRedirect", "fieldtype": "_Bool"}]} +,{"struct": "HTML_CloseBrowser_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}]} +,{"struct": "HTML_URLChanged_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchURL", "fieldtype": "const char *"}, +{ "fieldname": "pchPostData", "fieldtype": "const char *"}, +{ "fieldname": "bIsRedirect", "fieldtype": "_Bool"}, +{ "fieldname": "pchPageTitle", "fieldtype": "const char *"}, +{ "fieldname": "bNewNavigation", "fieldtype": "_Bool"}]} +,{"struct": "HTML_FinishedRequest_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchURL", "fieldtype": "const char *"}, +{ "fieldname": "pchPageTitle", "fieldtype": "const char *"}]} +,{"struct": "HTML_OpenLinkInNewTab_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchURL", "fieldtype": "const char *"}]} +,{"struct": "HTML_ChangedTitle_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchTitle", "fieldtype": "const char *"}]} +,{"struct": "HTML_SearchResults_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "unResults", "fieldtype": "uint32"}, +{ "fieldname": "unCurrentMatch", "fieldtype": "uint32"}]} +,{"struct": "HTML_CanGoBackAndForward_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "bCanGoBack", "fieldtype": "_Bool"}, +{ "fieldname": "bCanGoForward", "fieldtype": "_Bool"}]} +,{"struct": "HTML_HorizontalScroll_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "unScrollMax", "fieldtype": "uint32"}, +{ "fieldname": "unScrollCurrent", "fieldtype": "uint32"}, +{ "fieldname": "flPageScale", "fieldtype": "float"}, +{ "fieldname": "bVisible", "fieldtype": "_Bool"}, +{ "fieldname": "unPageSize", "fieldtype": "uint32"}]} +,{"struct": "HTML_VerticalScroll_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "unScrollMax", "fieldtype": "uint32"}, +{ "fieldname": "unScrollCurrent", "fieldtype": "uint32"}, +{ "fieldname": "flPageScale", "fieldtype": "float"}, +{ "fieldname": "bVisible", "fieldtype": "_Bool"}, +{ "fieldname": "unPageSize", "fieldtype": "uint32"}]} +,{"struct": "HTML_LinkAtPosition_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "x", "fieldtype": "uint32"}, +{ "fieldname": "y", "fieldtype": "uint32"}, +{ "fieldname": "pchURL", "fieldtype": "const char *"}, +{ "fieldname": "bInput", "fieldtype": "_Bool"}, +{ "fieldname": "bLiveLink", "fieldtype": "_Bool"}]} +,{"struct": "HTML_JSAlert_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchMessage", "fieldtype": "const char *"}]} +,{"struct": "HTML_JSConfirm_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchMessage", "fieldtype": "const char *"}]} +,{"struct": "HTML_FileOpenDialog_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchTitle", "fieldtype": "const char *"}, +{ "fieldname": "pchInitialFile", "fieldtype": "const char *"}]} +,{"struct": "HTML_NewWindow_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchURL", "fieldtype": "const char *"}, +{ "fieldname": "unX", "fieldtype": "uint32"}, +{ "fieldname": "unY", "fieldtype": "uint32"}, +{ "fieldname": "unWide", "fieldtype": "uint32"}, +{ "fieldname": "unTall", "fieldtype": "uint32"}, +{ "fieldname": "unNewWindow_BrowserHandle", "fieldtype": "HHTMLBrowser"}]} +,{"struct": "HTML_SetCursor_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "eMouseCursor", "fieldtype": "uint32"}]} +,{"struct": "HTML_StatusText_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchMsg", "fieldtype": "const char *"}]} +,{"struct": "HTML_ShowToolTip_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchMsg", "fieldtype": "const char *"}]} +,{"struct": "HTML_UpdateToolTip_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}, +{ "fieldname": "pchMsg", "fieldtype": "const char *"}]} +,{"struct": "HTML_HideToolTip_t","fields": [ +{ "fieldname": "unBrowserHandle", "fieldtype": "HHTMLBrowser"}]} +,{"struct": "SteamItemDetails_t","fields": [ +{ "fieldname": "m_itemId", "fieldtype": "SteamItemInstanceID_t"}, +{ "fieldname": "m_iDefinition", "fieldtype": "SteamItemDef_t"}, +{ "fieldname": "m_unQuantity", "fieldtype": "uint16"}, +{ "fieldname": "m_unFlags", "fieldtype": "uint16"}]} +,{"struct": "SteamInventoryResultReady_t","fields": [ +{ "fieldname": "m_handle", "fieldtype": "SteamInventoryResult_t"}, +{ "fieldname": "m_result", "fieldtype": "enum EResult"}]} +,{"struct": "SteamInventoryFullUpdate_t","fields": [ +{ "fieldname": "m_handle", "fieldtype": "SteamInventoryResult_t"}]} +,{"struct": "BroadcastUploadStop_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EBroadcastUploadResult"}]} +,{"struct": "GetVideoURLResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_unVideoAppID", "fieldtype": "AppId_t"}, +{ "fieldname": "m_rgchURL", "fieldtype": "char [256]"}]} +,{"struct": "CCallbackBase","fields": [ +{ "fieldname": "m_nCallbackFlags", "fieldtype": "uint8"}, +{ "fieldname": "m_iCallback", "fieldtype": "int"}]} +,{"struct": "CCallResult","fields": [ +{ "fieldname": "m_hAPICall", "fieldtype": "SteamAPICall_t"}, +{ "fieldname": "m_pObj", "fieldtype": "T *"}, +{ "fieldname": "m_Func", "fieldtype": "func_t"}]} +,{"struct": "CCallback","fields": [ +{ "fieldname": "m_pObj", "fieldtype": "T *"}, +{ "fieldname": "m_Func", "fieldtype": "func_t"}]} +,{"struct": "CSteamAPIContext","fields": [ +{ "fieldname": "m_pSteamUser", "fieldtype": "class ISteamUser *"}, +{ "fieldname": "m_pSteamFriends", "fieldtype": "class ISteamFriends *"}, +{ "fieldname": "m_pSteamUtils", "fieldtype": "class ISteamUtils *"}, +{ "fieldname": "m_pSteamMatchmaking", "fieldtype": "class ISteamMatchmaking *"}, +{ "fieldname": "m_pSteamUserStats", "fieldtype": "class ISteamUserStats *"}, +{ "fieldname": "m_pSteamApps", "fieldtype": "class ISteamApps *"}, +{ "fieldname": "m_pSteamMatchmakingServers", "fieldtype": "class ISteamMatchmakingServers *"}, +{ "fieldname": "m_pSteamNetworking", "fieldtype": "class ISteamNetworking *"}, +{ "fieldname": "m_pSteamRemoteStorage", "fieldtype": "class ISteamRemoteStorage *"}, +{ "fieldname": "m_pSteamScreenshots", "fieldtype": "class ISteamScreenshots *"}, +{ "fieldname": "m_pSteamHTTP", "fieldtype": "class ISteamHTTP *"}, +{ "fieldname": "m_pSteamUnifiedMessages", "fieldtype": "class ISteamUnifiedMessages *"}, +{ "fieldname": "m_pController", "fieldtype": "class ISteamController *"}, +{ "fieldname": "m_pSteamUGC", "fieldtype": "class ISteamUGC *"}, +{ "fieldname": "m_pSteamAppList", "fieldtype": "class ISteamAppList *"}, +{ "fieldname": "m_pSteamMusic", "fieldtype": "class ISteamMusic *"}, +{ "fieldname": "m_pSteamMusicRemote", "fieldtype": "class ISteamMusicRemote *"}, +{ "fieldname": "m_pSteamHTMLSurface", "fieldtype": "class ISteamHTMLSurface *"}, +{ "fieldname": "m_pSteamInventory", "fieldtype": "class ISteamInventory *"}, +{ "fieldname": "m_pSteamVideo", "fieldtype": "class ISteamVideo *"}]} +,{"struct": "GSClientApprove_t","fields": [ +{ "fieldname": "m_SteamID", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_OwnerSteamID", "fieldtype": "class CSteamID"}]} +,{"struct": "GSClientDeny_t","fields": [ +{ "fieldname": "m_SteamID", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_eDenyReason", "fieldtype": "enum EDenyReason"}, +{ "fieldname": "m_rgchOptionalText", "fieldtype": "char [128]"}]} +,{"struct": "GSClientKick_t","fields": [ +{ "fieldname": "m_SteamID", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_eDenyReason", "fieldtype": "enum EDenyReason"}]} +,{"struct": "GSClientAchievementStatus_t","fields": [ +{ "fieldname": "m_SteamID", "fieldtype": "uint64"}, +{ "fieldname": "m_pchAchievement", "fieldtype": "char [128]"}, +{ "fieldname": "m_bUnlocked", "fieldtype": "_Bool"}]} +,{"struct": "GSPolicyResponse_t","fields": [ +{ "fieldname": "m_bSecure", "fieldtype": "uint8"}]} +,{"struct": "GSGameplayStats_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nRank", "fieldtype": "int32"}, +{ "fieldname": "m_unTotalConnects", "fieldtype": "uint32"}, +{ "fieldname": "m_unTotalMinutesPlayed", "fieldtype": "uint32"}]} +,{"struct": "GSClientGroupStatus_t","fields": [ +{ "fieldname": "m_SteamIDUser", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_SteamIDGroup", "fieldtype": "class CSteamID"}, +{ "fieldname": "m_bMember", "fieldtype": "_Bool"}, +{ "fieldname": "m_bOfficer", "fieldtype": "_Bool"}]} +,{"struct": "GSReputation_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_unReputationScore", "fieldtype": "uint32"}, +{ "fieldname": "m_bBanned", "fieldtype": "_Bool"}, +{ "fieldname": "m_unBannedIP", "fieldtype": "uint32"}, +{ "fieldname": "m_usBannedPort", "fieldtype": "uint16"}, +{ "fieldname": "m_ulBannedGameID", "fieldtype": "uint64"}, +{ "fieldname": "m_unBanExpires", "fieldtype": "uint32"}]} +,{"struct": "AssociateWithClanResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "ComputeNewPlayerCompatibilityResult_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_cPlayersThatDontLikeCandidate", "fieldtype": "int"}, +{ "fieldname": "m_cPlayersThatCandidateDoesntLike", "fieldtype": "int"}, +{ "fieldname": "m_cClanPlayersThatDontLikeCandidate", "fieldtype": "int"}, +{ "fieldname": "m_SteamIDCandidate", "fieldtype": "class CSteamID"}]} +,{"struct": "GSStatsReceived_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}]} +,{"struct": "GSStatsStored_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}]} +,{"struct": "GSStatsUnloaded_t","fields": [ +{ "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}]} +], +"methods":[{ + "classname": "ISteamClient", + "methodname": "CreateSteamPipe", + "returntype": "HSteamPipe" +} +,{ + "classname": "ISteamClient", + "methodname": "BReleaseSteamPipe", + "returntype": "bool", + "params": [ +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "ConnectToGlobalUser", + "returntype": "HSteamUser", + "params": [ +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "CreateLocalUser", + "returntype": "HSteamUser", + "params": [ +{ "paramname": "phSteamPipe" ,"paramtype": "HSteamPipe *"}, +{ "paramname": "eAccountType" ,"paramtype": "EAccountType"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "ReleaseUser", + "returntype": "void", + "params": [ +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "hUser" ,"paramtype": "HSteamUser"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamUser", + "returntype": "class ISteamUser *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamGameServer", + "returntype": "class ISteamGameServer *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "SetLocalIPBinding", + "returntype": "void", + "params": [ +{ "paramname": "unIP" ,"paramtype": "uint32"}, +{ "paramname": "usPort" ,"paramtype": "uint16"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamFriends", + "returntype": "class ISteamFriends *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamUtils", + "returntype": "class ISteamUtils *", + "params": [ +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamMatchmaking", + "returntype": "class ISteamMatchmaking *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamMatchmakingServers", + "returntype": "class ISteamMatchmakingServers *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamGenericInterface", + "returntype": "void *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamUserStats", + "returntype": "class ISteamUserStats *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamGameServerStats", + "returntype": "class ISteamGameServerStats *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamApps", + "returntype": "class ISteamApps *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamNetworking", + "returntype": "class ISteamNetworking *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamRemoteStorage", + "returntype": "class ISteamRemoteStorage *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamScreenshots", + "returntype": "class ISteamScreenshots *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "RunFrame", + "returntype": "void" +} +,{ + "classname": "ISteamClient", + "methodname": "GetIPCCallCount", + "returntype": "uint32" +} +,{ + "classname": "ISteamClient", + "methodname": "SetWarningMessageHook", + "returntype": "void", + "params": [ +{ "paramname": "pFunction" ,"paramtype": "SteamAPIWarningMessageHook_t"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "BShutdownIfAllPipesClosed", + "returntype": "bool" +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamHTTP", + "returntype": "class ISteamHTTP *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamUnifiedMessages", + "returntype": "class ISteamUnifiedMessages *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamController", + "returntype": "class ISteamController *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamUGC", + "returntype": "class ISteamUGC *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamAppList", + "returntype": "class ISteamAppList *", + "params": [ +{ "paramname": "hSteamUser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamMusic", + "returntype": "class ISteamMusic *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamMusicRemote", + "returntype": "class ISteamMusicRemote *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamHTMLSurface", + "returntype": "class ISteamHTMLSurface *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "Set_SteamAPI_CPostAPIResultInProcess", + "returntype": "void", + "params": [ +{ "paramname": "func" ,"paramtype": "SteamAPI_PostAPIResultInProcess_t"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "Remove_SteamAPI_CPostAPIResultInProcess", + "returntype": "void", + "params": [ +{ "paramname": "func" ,"paramtype": "SteamAPI_PostAPIResultInProcess_t"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "Set_SteamAPI_CCheckCallbackRegisteredInProcess", + "returntype": "void", + "params": [ +{ "paramname": "func" ,"paramtype": "SteamAPI_CheckCallbackRegistered_t"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamInventory", + "returntype": "class ISteamInventory *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamClient", + "methodname": "GetISteamVideo", + "returntype": "class ISteamVideo *", + "params": [ +{ "paramname": "hSteamuser" ,"paramtype": "HSteamUser"}, +{ "paramname": "hSteamPipe" ,"paramtype": "HSteamPipe"}, +{ "paramname": "pchVersion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "GetHSteamUser", + "returntype": "HSteamUser" +} +,{ + "classname": "ISteamUser", + "methodname": "BLoggedOn", + "returntype": "bool" +} +,{ + "classname": "ISteamUser", + "methodname": "GetSteamID", + "returntype": "class CSteamID" +} +,{ + "classname": "ISteamUser", + "methodname": "InitiateGameConnection", + "returntype": "int", + "params": [ +{ "paramname": "pAuthBlob" ,"paramtype": "void *"}, +{ "paramname": "cbMaxAuthBlob" ,"paramtype": "int"}, +{ "paramname": "steamIDGameServer" ,"paramtype": "class CSteamID"}, +{ "paramname": "unIPServer" ,"paramtype": "uint32"}, +{ "paramname": "usPortServer" ,"paramtype": "uint16"}, +{ "paramname": "bSecure" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "TerminateGameConnection", + "returntype": "void", + "params": [ +{ "paramname": "unIPServer" ,"paramtype": "uint32"}, +{ "paramname": "usPortServer" ,"paramtype": "uint16"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "TrackAppUsageEvent", + "returntype": "void", + "params": [ +{ "paramname": "gameID" ,"paramtype": "class CGameID"}, +{ "paramname": "eAppUsageEvent" ,"paramtype": "int"}, +{ "paramname": "pchExtraInfo" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "GetUserDataFolder", + "returntype": "bool", + "params": [ +{ "paramname": "pchBuffer" ,"paramtype": "char *"}, +{ "paramname": "cubBuffer" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "StartVoiceRecording", + "returntype": "void" +} +,{ + "classname": "ISteamUser", + "methodname": "StopVoiceRecording", + "returntype": "void" +} +,{ + "classname": "ISteamUser", + "methodname": "GetAvailableVoice", + "returntype": "EVoiceResult", + "params": [ +{ "paramname": "pcbCompressed" ,"paramtype": "uint32 *"}, +{ "paramname": "pcbUncompressed" ,"paramtype": "uint32 *"}, +{ "paramname": "nUncompressedVoiceDesiredSampleRate" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "GetVoice", + "returntype": "EVoiceResult", + "params": [ +{ "paramname": "bWantCompressed" ,"paramtype": "bool"}, +{ "paramname": "pDestBuffer" ,"paramtype": "void *"}, +{ "paramname": "cbDestBufferSize" ,"paramtype": "uint32"}, +{ "paramname": "nBytesWritten" ,"paramtype": "uint32 *"}, +{ "paramname": "bWantUncompressed" ,"paramtype": "bool"}, +{ "paramname": "pUncompressedDestBuffer" ,"paramtype": "void *"}, +{ "paramname": "cbUncompressedDestBufferSize" ,"paramtype": "uint32"}, +{ "paramname": "nUncompressBytesWritten" ,"paramtype": "uint32 *"}, +{ "paramname": "nUncompressedVoiceDesiredSampleRate" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "DecompressVoice", + "returntype": "EVoiceResult", + "params": [ +{ "paramname": "pCompressed" ,"paramtype": "const void *"}, +{ "paramname": "cbCompressed" ,"paramtype": "uint32"}, +{ "paramname": "pDestBuffer" ,"paramtype": "void *"}, +{ "paramname": "cbDestBufferSize" ,"paramtype": "uint32"}, +{ "paramname": "nBytesWritten" ,"paramtype": "uint32 *"}, +{ "paramname": "nDesiredSampleRate" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "GetVoiceOptimalSampleRate", + "returntype": "uint32" +} +,{ + "classname": "ISteamUser", + "methodname": "GetAuthSessionTicket", + "returntype": "HAuthTicket", + "params": [ +{ "paramname": "pTicket" ,"paramtype": "void *"}, +{ "paramname": "cbMaxTicket" ,"paramtype": "int"}, +{ "paramname": "pcbTicket" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "BeginAuthSession", + "returntype": "EBeginAuthSessionResult", + "params": [ +{ "paramname": "pAuthTicket" ,"paramtype": "const void *"}, +{ "paramname": "cbAuthTicket" ,"paramtype": "int"}, +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "EndAuthSession", + "returntype": "void", + "params": [ +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "CancelAuthTicket", + "returntype": "void", + "params": [ +{ "paramname": "hAuthTicket" ,"paramtype": "HAuthTicket"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "UserHasLicenseForApp", + "returntype": "EUserHasLicenseForAppResult", + "params": [ +{ "paramname": "steamID" ,"paramtype": "class CSteamID"}, +{ "paramname": "appID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "BIsBehindNAT", + "returntype": "bool" +} +,{ + "classname": "ISteamUser", + "methodname": "AdvertiseGame", + "returntype": "void", + "params": [ +{ "paramname": "steamIDGameServer" ,"paramtype": "class CSteamID"}, +{ "paramname": "unIPServer" ,"paramtype": "uint32"}, +{ "paramname": "usPortServer" ,"paramtype": "uint16"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "RequestEncryptedAppTicket", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pDataToInclude" ,"paramtype": "void *"}, +{ "paramname": "cbDataToInclude" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "GetEncryptedAppTicket", + "returntype": "bool", + "params": [ +{ "paramname": "pTicket" ,"paramtype": "void *"}, +{ "paramname": "cbMaxTicket" ,"paramtype": "int"}, +{ "paramname": "pcbTicket" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "GetGameBadgeLevel", + "returntype": "int", + "params": [ +{ "paramname": "nSeries" ,"paramtype": "int"}, +{ "paramname": "bFoil" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUser", + "methodname": "GetPlayerSteamLevel", + "returntype": "int" +} +,{ + "classname": "ISteamUser", + "methodname": "RequestStoreAuthURL", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchRedirectURL" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetPersonaName", + "returntype": "const char *" +} +,{ + "classname": "ISteamFriends", + "methodname": "SetPersonaName", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchPersonaName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetPersonaState", + "returntype": "EPersonaState" +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendCount", + "returntype": "int", + "params": [ +{ "paramname": "iFriendFlags" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendByIndex", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "iFriend" ,"paramtype": "int"}, +{ "paramname": "iFriendFlags" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendRelationship", + "returntype": "EFriendRelationship", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendPersonaState", + "returntype": "EPersonaState", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendPersonaName", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendGamePlayed", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "pFriendGameInfo" ,"out_struct": " " ,"paramtype": "struct FriendGameInfo_t *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendPersonaNameHistory", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "iPersonaName" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendSteamLevel", + "returntype": "int", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetPlayerNickname", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDPlayer" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendsGroupCount", + "returntype": "int" +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendsGroupIDByIndex", + "returntype": "FriendsGroupID_t", + "params": [ +{ "paramname": "iFG" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendsGroupName", + "returntype": "const char *", + "params": [ +{ "paramname": "friendsGroupID" ,"paramtype": "FriendsGroupID_t"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendsGroupMembersCount", + "returntype": "int", + "params": [ +{ "paramname": "friendsGroupID" ,"paramtype": "FriendsGroupID_t"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendsGroupMembersList", + "returntype": "void", + "params": [ +{ "paramname": "friendsGroupID" ,"paramtype": "FriendsGroupID_t"}, +{ "paramname": "pOutSteamIDMembers" ,"out_array_call": "nMembersCount,GetFriendsGroupMembersCount,friendsGroupID" ,"paramtype": "class CSteamID *"}, +{ "paramname": "nMembersCount" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "HasFriend", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "iFriendFlags" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanCount", + "returntype": "int" +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanByIndex", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "iClan" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanName", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanTag", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanActivityCounts", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"}, +{ "paramname": "pnOnline" ,"paramtype": "int *"}, +{ "paramname": "pnInGame" ,"paramtype": "int *"}, +{ "paramname": "pnChatting" ,"paramtype": "int *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "DownloadClanActivityCounts", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "psteamIDClans" ,"array_count": "cClansToRequest" ,"paramtype": "class CSteamID *"}, +{ "paramname": "cClansToRequest" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendCountFromSource", + "returntype": "int", + "params": [ +{ "paramname": "steamIDSource" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendFromSourceByIndex", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "steamIDSource" ,"paramtype": "class CSteamID"}, +{ "paramname": "iFriend" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "IsUserInSource", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "steamIDSource" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "SetInGameVoiceSpeaking", + "returntype": "void", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "bSpeaking" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "ActivateGameOverlay", + "returntype": "void", + "params": [ +{ "paramname": "pchDialog" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "ActivateGameOverlayToUser", + "returntype": "void", + "params": [ +{ "paramname": "pchDialog" ,"paramtype": "const char *"}, +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "ActivateGameOverlayToWebPage", + "returntype": "void", + "params": [ +{ "paramname": "pchURL" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "ActivateGameOverlayToStore", + "returntype": "void", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "eFlag" ,"paramtype": "EOverlayToStoreFlag"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "SetPlayedWith", + "returntype": "void", + "params": [ +{ "paramname": "steamIDUserPlayedWith" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "ActivateGameOverlayInviteDialog", + "returntype": "void", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetSmallFriendAvatar", + "returntype": "int", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetMediumFriendAvatar", + "returntype": "int", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetLargeFriendAvatar", + "returntype": "int", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "RequestUserInformation", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "bRequireNameOnly" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "RequestClanOfficerList", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanOwner", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanOfficerCount", + "returntype": "int", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanOfficerByIndex", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"}, +{ "paramname": "iOfficer" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetUserRestrictions", + "returntype": "uint32" +} +,{ + "classname": "ISteamFriends", + "methodname": "SetRichPresence", + "returntype": "bool", + "params": [ +{ "paramname": "pchKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "ClearRichPresence", + "returntype": "void" +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendRichPresence", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendRichPresenceKeyCount", + "returntype": "int", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendRichPresenceKeyByIndex", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "iKey" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "RequestFriendRichPresence", + "returntype": "void", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "InviteUserToGame", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchConnectString" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetCoplayFriendCount", + "returntype": "int" +} +,{ + "classname": "ISteamFriends", + "methodname": "GetCoplayFriend", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "iCoplayFriend" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendCoplayTime", + "returntype": "int", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendCoplayGame", + "returntype": "AppId_t", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "JoinClanChatRoom", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "LeaveClanChatRoom", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanChatMemberCount", + "returntype": "int", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetChatMemberByIndex", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"}, +{ "paramname": "iUser" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "SendClanChatMessage", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDClanChat" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchText" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetClanChatMessage", + "returntype": "int", + "params": [ +{ "paramname": "steamIDClanChat" ,"paramtype": "class CSteamID"}, +{ "paramname": "iMessage" ,"paramtype": "int"}, +{ "paramname": "prgchText" ,"paramtype": "void *"}, +{ "paramname": "cchTextMax" ,"paramtype": "int"}, +{ "paramname": "peChatEntryType" ,"paramtype": "EChatEntryType *"}, +{ "paramname": "psteamidChatter" ,"out_struct": " " ,"paramtype": "class CSteamID *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "IsClanChatAdmin", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDClanChat" ,"paramtype": "class CSteamID"}, +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "IsClanChatWindowOpenInSteam", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDClanChat" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "OpenClanChatWindowInSteam", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDClanChat" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "CloseClanChatWindowInSteam", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDClanChat" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "SetListenForFriendsMessages", + "returntype": "bool", + "params": [ +{ "paramname": "bInterceptEnabled" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "ReplyToFriendMessage", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchMsgToSend" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFriendMessage", + "returntype": "int", + "params": [ +{ "paramname": "steamIDFriend" ,"paramtype": "class CSteamID"}, +{ "paramname": "iMessageID" ,"paramtype": "int"}, +{ "paramname": "pvData" ,"paramtype": "void *"}, +{ "paramname": "cubData" ,"paramtype": "int"}, +{ "paramname": "peChatEntryType" ,"paramtype": "EChatEntryType *"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "GetFollowerCount", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "IsFollowing", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamFriends", + "methodname": "EnumerateFollowingList", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unStartIndex" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetSecondsSinceAppActive", + "returntype": "uint32" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetSecondsSinceComputerActive", + "returntype": "uint32" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetConnectedUniverse", + "returntype": "EUniverse" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetServerRealTime", + "returntype": "uint32" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetIPCountry", + "returntype": "const char *" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetImageSize", + "returntype": "bool", + "params": [ +{ "paramname": "iImage" ,"paramtype": "int"}, +{ "paramname": "pnWidth" ,"paramtype": "uint32 *"}, +{ "paramname": "pnHeight" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetImageRGBA", + "returntype": "bool", + "params": [ +{ "paramname": "iImage" ,"paramtype": "int"}, +{ "paramname": "pubDest" ,"paramtype": "uint8 *"}, +{ "paramname": "nDestBufferSize" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetCSERIPPort", + "returntype": "bool", + "params": [ +{ "paramname": "unIP" ,"paramtype": "uint32 *"}, +{ "paramname": "usPort" ,"paramtype": "uint16 *"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetCurrentBatteryPower", + "returntype": "uint8" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetAppID", + "returntype": "uint32" +} +,{ + "classname": "ISteamUtils", + "methodname": "SetOverlayNotificationPosition", + "returntype": "void", + "params": [ +{ "paramname": "eNotificationPosition" ,"paramtype": "ENotificationPosition"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "IsAPICallCompleted", + "returntype": "bool", + "params": [ +{ "paramname": "hSteamAPICall" ,"paramtype": "SteamAPICall_t"}, +{ "paramname": "pbFailed" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetAPICallFailureReason", + "returntype": "ESteamAPICallFailure", + "params": [ +{ "paramname": "hSteamAPICall" ,"paramtype": "SteamAPICall_t"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetAPICallResult", + "returntype": "bool", + "params": [ +{ "paramname": "hSteamAPICall" ,"paramtype": "SteamAPICall_t"}, +{ "paramname": "pCallback" ,"paramtype": "void *"}, +{ "paramname": "cubCallback" ,"paramtype": "int"}, +{ "paramname": "iCallbackExpected" ,"paramtype": "int"}, +{ "paramname": "pbFailed" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "RunFrame", + "returntype": "void" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetIPCCallCount", + "returntype": "uint32" +} +,{ + "classname": "ISteamUtils", + "methodname": "SetWarningMessageHook", + "returntype": "void", + "params": [ +{ "paramname": "pFunction" ,"paramtype": "SteamAPIWarningMessageHook_t"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "IsOverlayEnabled", + "returntype": "bool" +} +,{ + "classname": "ISteamUtils", + "methodname": "BOverlayNeedsPresent", + "returntype": "bool" +} +,{ + "classname": "ISteamUtils", + "methodname": "CheckFileSignature", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "szFileName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "ShowGamepadTextInput", + "returntype": "bool", + "params": [ +{ "paramname": "eInputMode" ,"paramtype": "EGamepadTextInputMode"}, +{ "paramname": "eLineInputMode" ,"paramtype": "EGamepadTextInputLineMode"}, +{ "paramname": "pchDescription" ,"paramtype": "const char *"}, +{ "paramname": "unCharMax" ,"paramtype": "uint32"}, +{ "paramname": "pchExistingText" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetEnteredGamepadTextLength", + "returntype": "uint32" +} +,{ + "classname": "ISteamUtils", + "methodname": "GetEnteredGamepadTextInput", + "returntype": "bool", + "params": [ +{ "paramname": "pchText" ,"paramtype": "char *"}, +{ "paramname": "cchText" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUtils", + "methodname": "GetSteamUILanguage", + "returntype": "const char *" +} +,{ + "classname": "ISteamUtils", + "methodname": "IsSteamRunningInVR", + "returntype": "bool" +} +,{ + "classname": "ISteamUtils", + "methodname": "SetOverlayNotificationInset", + "returntype": "void", + "params": [ +{ "paramname": "nHorizontalInset" ,"paramtype": "int"}, +{ "paramname": "nVerticalInset" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetFavoriteGameCount", + "returntype": "int" +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetFavoriteGame", + "returntype": "bool", + "params": [ +{ "paramname": "iGame" ,"paramtype": "int"}, +{ "paramname": "pnAppID" ,"paramtype": "AppId_t *"}, +{ "paramname": "pnIP" ,"paramtype": "uint32 *"}, +{ "paramname": "pnConnPort" ,"paramtype": "uint16 *"}, +{ "paramname": "pnQueryPort" ,"paramtype": "uint16 *"}, +{ "paramname": "punFlags" ,"paramtype": "uint32 *"}, +{ "paramname": "pRTime32LastPlayedOnServer" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddFavoriteGame", + "returntype": "int", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "nIP" ,"paramtype": "uint32"}, +{ "paramname": "nConnPort" ,"paramtype": "uint16"}, +{ "paramname": "nQueryPort" ,"paramtype": "uint16"}, +{ "paramname": "unFlags" ,"paramtype": "uint32"}, +{ "paramname": "rTime32LastPlayedOnServer" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "RemoveFavoriteGame", + "returntype": "bool", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "nIP" ,"paramtype": "uint32"}, +{ "paramname": "nConnPort" ,"paramtype": "uint16"}, +{ "paramname": "nQueryPort" ,"paramtype": "uint16"}, +{ "paramname": "unFlags" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "RequestLobbyList", + "returntype": "SteamAPICall_t" +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddRequestLobbyListStringFilter", + "returntype": "void", + "params": [ +{ "paramname": "pchKeyToMatch" ,"paramtype": "const char *"}, +{ "paramname": "pchValueToMatch" ,"paramtype": "const char *"}, +{ "paramname": "eComparisonType" ,"paramtype": "ELobbyComparison"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddRequestLobbyListNumericalFilter", + "returntype": "void", + "params": [ +{ "paramname": "pchKeyToMatch" ,"paramtype": "const char *"}, +{ "paramname": "nValueToMatch" ,"paramtype": "int"}, +{ "paramname": "eComparisonType" ,"paramtype": "ELobbyComparison"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddRequestLobbyListNearValueFilter", + "returntype": "void", + "params": [ +{ "paramname": "pchKeyToMatch" ,"paramtype": "const char *"}, +{ "paramname": "nValueToBeCloseTo" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddRequestLobbyListFilterSlotsAvailable", + "returntype": "void", + "params": [ +{ "paramname": "nSlotsAvailable" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddRequestLobbyListDistanceFilter", + "returntype": "void", + "params": [ +{ "paramname": "eLobbyDistanceFilter" ,"paramtype": "ELobbyDistanceFilter"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddRequestLobbyListResultCountFilter", + "returntype": "void", + "params": [ +{ "paramname": "cMaxResults" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "AddRequestLobbyListCompatibleMembersFilter", + "returntype": "void", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyByIndex", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "iLobby" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "CreateLobby", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "eLobbyType" ,"paramtype": "ELobbyType"}, +{ "paramname": "cMaxMembers" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "JoinLobby", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "LeaveLobby", + "returntype": "void", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "InviteUserToLobby", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "steamIDInvitee" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetNumLobbyMembers", + "returntype": "int", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyMemberByIndex", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "iMember" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyData", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLobbyData", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyDataCount", + "returntype": "int", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyDataByIndex", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "iLobbyData" ,"paramtype": "int"}, +{ "paramname": "pchKey" ,"paramtype": "char *"}, +{ "paramname": "cchKeyBufferSize" ,"paramtype": "int"}, +{ "paramname": "pchValue" ,"paramtype": "char *"}, +{ "paramname": "cchValueBufferSize" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "DeleteLobbyData", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyMemberData", + "returntype": "const char *", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLobbyMemberData", + "returntype": "void", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SendLobbyChatMsg", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "pvMsgBody" ,"paramtype": "const void *"}, +{ "paramname": "cubMsgBody" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyChatEntry", + "returntype": "int", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "iChatID" ,"paramtype": "int"}, +{ "paramname": "pSteamIDUser" ,"out_struct": " " ,"paramtype": "class CSteamID *"}, +{ "paramname": "pvData" ,"paramtype": "void *"}, +{ "paramname": "cubData" ,"paramtype": "int"}, +{ "paramname": "peChatEntryType" ,"paramtype": "EChatEntryType *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "RequestLobbyData", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLobbyGameServer", + "returntype": "void", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "unGameServerIP" ,"paramtype": "uint32"}, +{ "paramname": "unGameServerPort" ,"paramtype": "uint16"}, +{ "paramname": "steamIDGameServer" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyGameServer", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "punGameServerIP" ,"paramtype": "uint32 *"}, +{ "paramname": "punGameServerPort" ,"paramtype": "uint16 *"}, +{ "paramname": "psteamIDGameServer" ,"out_struct": " " ,"paramtype": "class CSteamID *"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLobbyMemberLimit", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "cMaxMembers" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyMemberLimit", + "returntype": "int", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLobbyType", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "eLobbyType" ,"paramtype": "ELobbyType"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLobbyJoinable", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "bLobbyJoinable" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "GetLobbyOwner", + "returntype": "class CSteamID", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLobbyOwner", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "steamIDNewOwner" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmaking", + "methodname": "SetLinkedLobby", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDLobby" ,"paramtype": "class CSteamID"}, +{ "paramname": "steamIDLobbyDependent" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamMatchmakingServerListResponse", + "methodname": "ServerResponded", + "returntype": "void", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"}, +{ "paramname": "iServer" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmakingServerListResponse", + "methodname": "ServerFailedToRespond", + "returntype": "void", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"}, +{ "paramname": "iServer" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmakingServerListResponse", + "methodname": "RefreshComplete", + "returntype": "void", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"}, +{ "paramname": "response" ,"paramtype": "EMatchMakingServerResponse"} + ] +} +,{ + "classname": "ISteamMatchmakingPingResponse", + "methodname": "ServerResponded", + "returntype": "void", + "params": [ +{ "paramname": "server" ,"paramtype": "class gameserveritem_t &"} + ] +} +,{ + "classname": "ISteamMatchmakingPingResponse", + "methodname": "ServerFailedToRespond", + "returntype": "void" +} +,{ + "classname": "ISteamMatchmakingPlayersResponse", + "methodname": "AddPlayerToList", + "returntype": "void", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "nScore" ,"paramtype": "int"}, +{ "paramname": "flTimePlayed" ,"paramtype": "float"} + ] +} +,{ + "classname": "ISteamMatchmakingPlayersResponse", + "methodname": "PlayersFailedToRespond", + "returntype": "void" +} +,{ + "classname": "ISteamMatchmakingPlayersResponse", + "methodname": "PlayersRefreshComplete", + "returntype": "void" +} +,{ + "classname": "ISteamMatchmakingRulesResponse", + "methodname": "RulesResponded", + "returntype": "void", + "params": [ +{ "paramname": "pchRule" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMatchmakingRulesResponse", + "methodname": "RulesFailedToRespond", + "returntype": "void" +} +,{ + "classname": "ISteamMatchmakingRulesResponse", + "methodname": "RulesRefreshComplete", + "returntype": "void" +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RequestInternetServerList", + "returntype": "HServerListRequest", + "params": [ +{ "paramname": "iApp" ,"paramtype": "AppId_t"}, +{ "paramname": "ppchFilters" ,"array_count": "nFilters" ,"paramtype": "struct MatchMakingKeyValuePair_t **"}, +{ "paramname": "nFilters" ,"paramtype": "uint32"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingServerListResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RequestLANServerList", + "returntype": "HServerListRequest", + "params": [ +{ "paramname": "iApp" ,"paramtype": "AppId_t"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingServerListResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RequestFriendsServerList", + "returntype": "HServerListRequest", + "params": [ +{ "paramname": "iApp" ,"paramtype": "AppId_t"}, +{ "paramname": "ppchFilters" ,"array_count": "nFilters" ,"paramtype": "struct MatchMakingKeyValuePair_t **"}, +{ "paramname": "nFilters" ,"paramtype": "uint32"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingServerListResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RequestFavoritesServerList", + "returntype": "HServerListRequest", + "params": [ +{ "paramname": "iApp" ,"paramtype": "AppId_t"}, +{ "paramname": "ppchFilters" ,"array_count": "nFilters" ,"paramtype": "struct MatchMakingKeyValuePair_t **"}, +{ "paramname": "nFilters" ,"paramtype": "uint32"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingServerListResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RequestHistoryServerList", + "returntype": "HServerListRequest", + "params": [ +{ "paramname": "iApp" ,"paramtype": "AppId_t"}, +{ "paramname": "ppchFilters" ,"array_count": "nFilters" ,"paramtype": "struct MatchMakingKeyValuePair_t **"}, +{ "paramname": "nFilters" ,"paramtype": "uint32"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingServerListResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RequestSpectatorServerList", + "returntype": "HServerListRequest", + "params": [ +{ "paramname": "iApp" ,"paramtype": "AppId_t"}, +{ "paramname": "ppchFilters" ,"array_count": "nFilters" ,"paramtype": "struct MatchMakingKeyValuePair_t **"}, +{ "paramname": "nFilters" ,"paramtype": "uint32"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingServerListResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "ReleaseRequest", + "returntype": "void", + "params": [ +{ "paramname": "hServerListRequest" ,"paramtype": "HServerListRequest"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "GetServerDetails", + "returntype": "class gameserveritem_t *", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"}, +{ "paramname": "iServer" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "CancelQuery", + "returntype": "void", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RefreshQuery", + "returntype": "void", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "IsRefreshing", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "GetServerCount", + "returntype": "int", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "RefreshServer", + "returntype": "void", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HServerListRequest"}, +{ "paramname": "iServer" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "PingServer", + "returntype": "HServerQuery", + "params": [ +{ "paramname": "unIP" ,"paramtype": "uint32"}, +{ "paramname": "usPort" ,"paramtype": "uint16"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingPingResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "PlayerDetails", + "returntype": "HServerQuery", + "params": [ +{ "paramname": "unIP" ,"paramtype": "uint32"}, +{ "paramname": "usPort" ,"paramtype": "uint16"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingPlayersResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "ServerRules", + "returntype": "HServerQuery", + "params": [ +{ "paramname": "unIP" ,"paramtype": "uint32"}, +{ "paramname": "usPort" ,"paramtype": "uint16"}, +{ "paramname": "pRequestServersResponse" ,"paramtype": "class ISteamMatchmakingRulesResponse *"} + ] +} +,{ + "classname": "ISteamMatchmakingServers", + "methodname": "CancelServerQuery", + "returntype": "void", + "params": [ +{ "paramname": "hServerQuery" ,"paramtype": "HServerQuery"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileWrite", + "returntype": "bool", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "pvData" ,"paramtype": "const void *"}, +{ "paramname": "cubData" ,"paramtype": "int32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileRead", + "returntype": "int32", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "pvData" ,"paramtype": "void *"}, +{ "paramname": "cubDataToRead" ,"paramtype": "int32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileWriteAsync", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "pvData" ,"paramtype": "const void *"}, +{ "paramname": "cubData" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileReadAsync", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "nOffset" ,"paramtype": "uint32"}, +{ "paramname": "cubToRead" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileReadAsyncComplete", + "returntype": "bool", + "params": [ +{ "paramname": "hReadCall" ,"paramtype": "SteamAPICall_t"}, +{ "paramname": "pvBuffer" ,"paramtype": "void *"}, +{ "paramname": "cubToRead" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileForget", + "returntype": "bool", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileDelete", + "returntype": "bool", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileShare", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "SetSyncPlatforms", + "returntype": "bool", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "eRemoteStoragePlatform" ,"paramtype": "ERemoteStoragePlatform"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileWriteStreamOpen", + "returntype": "UGCFileWriteStreamHandle_t", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileWriteStreamWriteChunk", + "returntype": "bool", + "params": [ +{ "paramname": "writeHandle" ,"paramtype": "UGCFileWriteStreamHandle_t"}, +{ "paramname": "pvData" ,"paramtype": "const void *"}, +{ "paramname": "cubData" ,"paramtype": "int32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileWriteStreamClose", + "returntype": "bool", + "params": [ +{ "paramname": "writeHandle" ,"paramtype": "UGCFileWriteStreamHandle_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileWriteStreamCancel", + "returntype": "bool", + "params": [ +{ "paramname": "writeHandle" ,"paramtype": "UGCFileWriteStreamHandle_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileExists", + "returntype": "bool", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FilePersisted", + "returntype": "bool", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetFileSize", + "returntype": "int32", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetFileTimestamp", + "returntype": "int64", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetSyncPlatforms", + "returntype": "ERemoteStoragePlatform", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetFileCount", + "returntype": "int32" +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetFileNameAndSize", + "returntype": "const char *", + "params": [ +{ "paramname": "iFile" ,"paramtype": "int"}, +{ "paramname": "pnFileSizeInBytes" ,"paramtype": "int32 *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetQuota", + "returntype": "bool", + "params": [ +{ "paramname": "pnTotalBytes" ,"paramtype": "int32 *"}, +{ "paramname": "puAvailableBytes" ,"paramtype": "int32 *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "IsCloudEnabledForAccount", + "returntype": "bool" +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "IsCloudEnabledForApp", + "returntype": "bool" +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "SetCloudEnabledForApp", + "returntype": "void", + "params": [ +{ "paramname": "bEnabled" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UGCDownload", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "hContent" ,"paramtype": "UGCHandle_t"}, +{ "paramname": "unPriority" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetUGCDownloadProgress", + "returntype": "bool", + "params": [ +{ "paramname": "hContent" ,"paramtype": "UGCHandle_t"}, +{ "paramname": "pnBytesDownloaded" ,"paramtype": "int32 *"}, +{ "paramname": "pnBytesExpected" ,"paramtype": "int32 *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetUGCDetails", + "returntype": "bool", + "params": [ +{ "paramname": "hContent" ,"paramtype": "UGCHandle_t"}, +{ "paramname": "pnAppID" ,"paramtype": "AppId_t *"}, +{ "paramname": "ppchName" ,"paramtype": "char **"}, +{ "paramname": "pnFileSizeInBytes" ,"paramtype": "int32 *"}, +{ "paramname": "pSteamIDOwner" ,"out_struct": " " ,"paramtype": "class CSteamID *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UGCRead", + "returntype": "int32", + "params": [ +{ "paramname": "hContent" ,"paramtype": "UGCHandle_t"}, +{ "paramname": "pvData" ,"paramtype": "void *"}, +{ "paramname": "cubDataToRead" ,"paramtype": "int32"}, +{ "paramname": "cOffset" ,"paramtype": "uint32"}, +{ "paramname": "eAction" ,"paramtype": "EUGCReadAction"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetCachedUGCCount", + "returntype": "int32" +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetCachedUGCHandle", + "returntype": "UGCHandle_t", + "params": [ +{ "paramname": "iCachedContent" ,"paramtype": "int32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "PublishWorkshopFile", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "pchPreviewFile" ,"paramtype": "const char *"}, +{ "paramname": "nConsumerAppId" ,"paramtype": "AppId_t"}, +{ "paramname": "pchTitle" ,"paramtype": "const char *"}, +{ "paramname": "pchDescription" ,"paramtype": "const char *"}, +{ "paramname": "eVisibility" ,"paramtype": "ERemoteStoragePublishedFileVisibility"}, +{ "paramname": "pTags" ,"paramtype": "struct SteamParamStringArray_t *"}, +{ "paramname": "eWorkshopFileType" ,"paramtype": "EWorkshopFileType"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "CreatePublishedFileUpdateRequest", + "returntype": "PublishedFileUpdateHandle_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdatePublishedFileFile", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"}, +{ "paramname": "pchFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdatePublishedFilePreviewFile", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"}, +{ "paramname": "pchPreviewFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdatePublishedFileTitle", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"}, +{ "paramname": "pchTitle" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdatePublishedFileDescription", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"}, +{ "paramname": "pchDescription" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdatePublishedFileVisibility", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"}, +{ "paramname": "eVisibility" ,"paramtype": "ERemoteStoragePublishedFileVisibility"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdatePublishedFileTags", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"}, +{ "paramname": "pTags" ,"paramtype": "struct SteamParamStringArray_t *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "CommitPublishedFileUpdate", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetPublishedFileDetails", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "unMaxSecondsOld" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "DeletePublishedFile", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "EnumerateUserPublishedFiles", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unStartIndex" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "SubscribePublishedFile", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "EnumerateUserSubscribedFiles", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unStartIndex" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UnsubscribePublishedFile", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdatePublishedFileSetChangeDescription", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "PublishedFileUpdateHandle_t"}, +{ "paramname": "pchChangeDescription" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetPublishedItemVoteDetails", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UpdateUserPublishedItemVote", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "bVoteUp" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "GetUserPublishedItemVoteDetails", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "EnumerateUserSharedWorkshopFiles", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamId" ,"paramtype": "class CSteamID"}, +{ "paramname": "unStartIndex" ,"paramtype": "uint32"}, +{ "paramname": "pRequiredTags" ,"paramtype": "struct SteamParamStringArray_t *"}, +{ "paramname": "pExcludedTags" ,"paramtype": "struct SteamParamStringArray_t *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "PublishVideo", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "eVideoProvider" ,"paramtype": "EWorkshopVideoProvider"}, +{ "paramname": "pchVideoAccount" ,"paramtype": "const char *"}, +{ "paramname": "pchVideoIdentifier" ,"paramtype": "const char *"}, +{ "paramname": "pchPreviewFile" ,"paramtype": "const char *"}, +{ "paramname": "nConsumerAppId" ,"paramtype": "AppId_t"}, +{ "paramname": "pchTitle" ,"paramtype": "const char *"}, +{ "paramname": "pchDescription" ,"paramtype": "const char *"}, +{ "paramname": "eVisibility" ,"paramtype": "ERemoteStoragePublishedFileVisibility"}, +{ "paramname": "pTags" ,"paramtype": "struct SteamParamStringArray_t *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "SetUserPublishedFileAction", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "unPublishedFileId" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "eAction" ,"paramtype": "EWorkshopFileAction"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "EnumeratePublishedFilesByUserAction", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "eAction" ,"paramtype": "EWorkshopFileAction"}, +{ "paramname": "unStartIndex" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "EnumeratePublishedWorkshopFiles", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "eEnumerationType" ,"paramtype": "EWorkshopEnumerationType"}, +{ "paramname": "unStartIndex" ,"paramtype": "uint32"}, +{ "paramname": "unCount" ,"paramtype": "uint32"}, +{ "paramname": "unDays" ,"paramtype": "uint32"}, +{ "paramname": "pTags" ,"paramtype": "struct SteamParamStringArray_t *"}, +{ "paramname": "pUserTags" ,"paramtype": "struct SteamParamStringArray_t *"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "UGCDownloadToLocation", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "hContent" ,"paramtype": "UGCHandle_t"}, +{ "paramname": "pchLocation" ,"paramtype": "const char *"}, +{ "paramname": "unPriority" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "RequestCurrentStats", + "returntype": "bool" +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetStat", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "int32 *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetStat", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "float *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "SetStat", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "nData" ,"paramtype": "int32"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "SetStat", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "fData" ,"paramtype": "float"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "UpdateAvgRateStat", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "flCountThisSession" ,"paramtype": "float"}, +{ "paramname": "dSessionLength" ,"paramtype": "double"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetAchievement", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pbAchieved" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "SetAchievement", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "ClearAchievement", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetAchievementAndUnlockTime", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pbAchieved" ,"paramtype": "bool *"}, +{ "paramname": "punUnlockTime" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "StoreStats", + "returntype": "bool" +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetAchievementIcon", + "returntype": "int", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetAchievementDisplayAttribute", + "returntype": "const char *", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "IndicateAchievementProgress", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "nCurProgress" ,"paramtype": "uint32"}, +{ "paramname": "nMaxProgress" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetNumAchievements", + "returntype": "uint32" +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetAchievementName", + "returntype": "const char *", + "params": [ +{ "paramname": "iAchievement" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "RequestUserStats", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetUserStat", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "int32 *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetUserStat", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "float *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetUserAchievement", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pbAchieved" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetUserAchievementAndUnlockTime", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pbAchieved" ,"paramtype": "bool *"}, +{ "paramname": "punUnlockTime" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "ResetAllStats", + "returntype": "bool", + "params": [ +{ "paramname": "bAchievementsToo" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "FindOrCreateLeaderboard", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchLeaderboardName" ,"paramtype": "const char *"}, +{ "paramname": "eLeaderboardSortMethod" ,"paramtype": "ELeaderboardSortMethod"}, +{ "paramname": "eLeaderboardDisplayType" ,"paramtype": "ELeaderboardDisplayType"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "FindLeaderboard", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchLeaderboardName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetLeaderboardName", + "returntype": "const char *", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetLeaderboardEntryCount", + "returntype": "int", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetLeaderboardSortMethod", + "returntype": "ELeaderboardSortMethod", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetLeaderboardDisplayType", + "returntype": "ELeaderboardDisplayType", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "DownloadLeaderboardEntries", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"}, +{ "paramname": "eLeaderboardDataRequest" ,"paramtype": "ELeaderboardDataRequest"}, +{ "paramname": "nRangeStart" ,"paramtype": "int"}, +{ "paramname": "nRangeEnd" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "DownloadLeaderboardEntriesForUsers", "desc": "Downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"}, +{ "paramname": "prgUsers" ,"array_count": "cUsers" ,"desc": "Array of users to retrieve" ,"paramtype": "class CSteamID *"}, +{ "paramname": "cUsers" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetDownloadedLeaderboardEntry", + "returntype": "bool", + "params": [ +{ "paramname": "hSteamLeaderboardEntries" ,"paramtype": "SteamLeaderboardEntries_t"}, +{ "paramname": "index" ,"paramtype": "int"}, +{ "paramname": "pLeaderboardEntry" ,"paramtype": "struct LeaderboardEntry_t *"}, +{ "paramname": "pDetails" ,"paramtype": "int32 *"}, +{ "paramname": "cDetailsMax" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "UploadLeaderboardScore", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"}, +{ "paramname": "eLeaderboardUploadScoreMethod" ,"paramtype": "ELeaderboardUploadScoreMethod"}, +{ "paramname": "nScore" ,"paramtype": "int32"}, +{ "paramname": "pScoreDetails" ,"paramtype": "const int32 *"}, +{ "paramname": "cScoreDetailsCount" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "AttachLeaderboardUGC", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "hSteamLeaderboard" ,"paramtype": "SteamLeaderboard_t"}, +{ "paramname": "hUGC" ,"paramtype": "UGCHandle_t"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetNumberOfCurrentPlayers", + "returntype": "SteamAPICall_t" +} +,{ + "classname": "ISteamUserStats", + "methodname": "RequestGlobalAchievementPercentages", + "returntype": "SteamAPICall_t" +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetMostAchievedAchievementInfo", + "returntype": "int", + "params": [ +{ "paramname": "pchName" ,"paramtype": "char *"}, +{ "paramname": "unNameBufLen" ,"paramtype": "uint32"}, +{ "paramname": "pflPercent" ,"paramtype": "float *"}, +{ "paramname": "pbAchieved" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetNextMostAchievedAchievementInfo", + "returntype": "int", + "params": [ +{ "paramname": "iIteratorPrevious" ,"paramtype": "int"}, +{ "paramname": "pchName" ,"paramtype": "char *"}, +{ "paramname": "unNameBufLen" ,"paramtype": "uint32"}, +{ "paramname": "pflPercent" ,"paramtype": "float *"}, +{ "paramname": "pbAchieved" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetAchievementAchievedPercent", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pflPercent" ,"paramtype": "float *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "RequestGlobalStats", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nHistoryDays" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetGlobalStat", + "returntype": "bool", + "params": [ +{ "paramname": "pchStatName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "int64 *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetGlobalStat", + "returntype": "bool", + "params": [ +{ "paramname": "pchStatName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "double *"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetGlobalStatHistory", + "returntype": "int32", + "params": [ +{ "paramname": "pchStatName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"array_count": "cubData" ,"paramtype": "int64 *"}, +{ "paramname": "cubData" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUserStats", + "methodname": "GetGlobalStatHistory", + "returntype": "int32", + "params": [ +{ "paramname": "pchStatName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"array_count": "cubData" ,"paramtype": "double *"}, +{ "paramname": "cubData" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "BIsSubscribed", + "returntype": "bool" +} +,{ + "classname": "ISteamApps", + "methodname": "BIsLowViolence", + "returntype": "bool" +} +,{ + "classname": "ISteamApps", + "methodname": "BIsCybercafe", + "returntype": "bool" +} +,{ + "classname": "ISteamApps", + "methodname": "BIsVACBanned", + "returntype": "bool" +} +,{ + "classname": "ISteamApps", + "methodname": "GetCurrentGameLanguage", + "returntype": "const char *" +} +,{ + "classname": "ISteamApps", + "methodname": "GetAvailableGameLanguages", + "returntype": "const char *" +} +,{ + "classname": "ISteamApps", + "methodname": "BIsSubscribedApp", + "returntype": "bool", + "params": [ +{ "paramname": "appID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "BIsDlcInstalled", + "returntype": "bool", + "params": [ +{ "paramname": "appID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "GetEarliestPurchaseUnixTime", + "returntype": "uint32", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "BIsSubscribedFromFreeWeekend", + "returntype": "bool" +} +,{ + "classname": "ISteamApps", + "methodname": "GetDLCCount", + "returntype": "int" +} +,{ + "classname": "ISteamApps", + "methodname": "BGetDLCDataByIndex", + "returntype": "bool", + "params": [ +{ "paramname": "iDLC" ,"paramtype": "int"}, +{ "paramname": "pAppID" ,"paramtype": "AppId_t *"}, +{ "paramname": "pbAvailable" ,"paramtype": "bool *"}, +{ "paramname": "pchName" ,"paramtype": "char *"}, +{ "paramname": "cchNameBufferSize" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "InstallDLC", + "returntype": "void", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "UninstallDLC", + "returntype": "void", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "RequestAppProofOfPurchaseKey", + "returntype": "void", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "GetCurrentBetaName", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "char *"}, +{ "paramname": "cchNameBufferSize" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "MarkContentCorrupt", + "returntype": "bool", + "params": [ +{ "paramname": "bMissingFilesOnly" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "GetInstalledDepots", + "returntype": "uint32", + "params": [ +{ "paramname": "appID" ,"paramtype": "AppId_t"}, +{ "paramname": "pvecDepots" ,"paramtype": "DepotId_t *"}, +{ "paramname": "cMaxDepots" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "GetAppInstallDir", + "returntype": "uint32", + "params": [ +{ "paramname": "appID" ,"paramtype": "AppId_t"}, +{ "paramname": "pchFolder" ,"paramtype": "char *"}, +{ "paramname": "cchFolderBufferSize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "BIsAppInstalled", + "returntype": "bool", + "params": [ +{ "paramname": "appID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "GetAppOwner", + "returntype": "class CSteamID" +} +,{ + "classname": "ISteamApps", + "methodname": "GetLaunchQueryParam", + "returntype": "const char *", + "params": [ +{ "paramname": "pchKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "GetDlcDownloadProgress", + "returntype": "bool", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "punBytesDownloaded" ,"paramtype": "uint64 *"}, +{ "paramname": "punBytesTotal" ,"paramtype": "uint64 *"} + ] +} +,{ + "classname": "ISteamApps", + "methodname": "GetAppBuildId", + "returntype": "int" +} +,{ + "classname": "ISteamNetworking", + "methodname": "SendP2PPacket", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDRemote" ,"paramtype": "class CSteamID"}, +{ "paramname": "pubData" ,"paramtype": "const void *"}, +{ "paramname": "cubData" ,"paramtype": "uint32"}, +{ "paramname": "eP2PSendType" ,"paramtype": "EP2PSend"}, +{ "paramname": "nChannel" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "IsP2PPacketAvailable", + "returntype": "bool", + "params": [ +{ "paramname": "pcubMsgSize" ,"paramtype": "uint32 *"}, +{ "paramname": "nChannel" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "ReadP2PPacket", + "returntype": "bool", + "params": [ +{ "paramname": "pubDest" ,"paramtype": "void *"}, +{ "paramname": "cubDest" ,"paramtype": "uint32"}, +{ "paramname": "pcubMsgSize" ,"paramtype": "uint32 *"}, +{ "paramname": "psteamIDRemote" ,"paramtype": "class CSteamID *"}, +{ "paramname": "nChannel" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "AcceptP2PSessionWithUser", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDRemote" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "CloseP2PSessionWithUser", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDRemote" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "CloseP2PChannelWithUser", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDRemote" ,"paramtype": "class CSteamID"}, +{ "paramname": "nChannel" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "GetP2PSessionState", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDRemote" ,"paramtype": "class CSteamID"}, +{ "paramname": "pConnectionState" ,"paramtype": "struct P2PSessionState_t *"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "AllowP2PPacketRelay", + "returntype": "bool", + "params": [ +{ "paramname": "bAllow" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "CreateListenSocket", + "returntype": "SNetListenSocket_t", + "params": [ +{ "paramname": "nVirtualP2PPort" ,"paramtype": "int"}, +{ "paramname": "nIP" ,"paramtype": "uint32"}, +{ "paramname": "nPort" ,"paramtype": "uint16"}, +{ "paramname": "bAllowUseOfPacketRelay" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "CreateP2PConnectionSocket", + "returntype": "SNetSocket_t", + "params": [ +{ "paramname": "steamIDTarget" ,"paramtype": "class CSteamID"}, +{ "paramname": "nVirtualPort" ,"paramtype": "int"}, +{ "paramname": "nTimeoutSec" ,"paramtype": "int"}, +{ "paramname": "bAllowUseOfPacketRelay" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "CreateConnectionSocket", + "returntype": "SNetSocket_t", + "params": [ +{ "paramname": "nIP" ,"paramtype": "uint32"}, +{ "paramname": "nPort" ,"paramtype": "uint16"}, +{ "paramname": "nTimeoutSec" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "DestroySocket", + "returntype": "bool", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetSocket_t"}, +{ "paramname": "bNotifyRemoteEnd" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "DestroyListenSocket", + "returntype": "bool", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetListenSocket_t"}, +{ "paramname": "bNotifyRemoteEnd" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "SendDataOnSocket", + "returntype": "bool", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetSocket_t"}, +{ "paramname": "pubData" ,"paramtype": "void *"}, +{ "paramname": "cubData" ,"paramtype": "uint32"}, +{ "paramname": "bReliable" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "IsDataAvailableOnSocket", + "returntype": "bool", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetSocket_t"}, +{ "paramname": "pcubMsgSize" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "RetrieveDataFromSocket", + "returntype": "bool", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetSocket_t"}, +{ "paramname": "pubDest" ,"paramtype": "void *"}, +{ "paramname": "cubDest" ,"paramtype": "uint32"}, +{ "paramname": "pcubMsgSize" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "IsDataAvailable", + "returntype": "bool", + "params": [ +{ "paramname": "hListenSocket" ,"paramtype": "SNetListenSocket_t"}, +{ "paramname": "pcubMsgSize" ,"paramtype": "uint32 *"}, +{ "paramname": "phSocket" ,"paramtype": "SNetSocket_t *"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "RetrieveData", + "returntype": "bool", + "params": [ +{ "paramname": "hListenSocket" ,"paramtype": "SNetListenSocket_t"}, +{ "paramname": "pubDest" ,"paramtype": "void *"}, +{ "paramname": "cubDest" ,"paramtype": "uint32"}, +{ "paramname": "pcubMsgSize" ,"paramtype": "uint32 *"}, +{ "paramname": "phSocket" ,"paramtype": "SNetSocket_t *"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "GetSocketInfo", + "returntype": "bool", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetSocket_t"}, +{ "paramname": "pSteamIDRemote" ,"paramtype": "class CSteamID *"}, +{ "paramname": "peSocketStatus" ,"paramtype": "int *"}, +{ "paramname": "punIPRemote" ,"paramtype": "uint32 *"}, +{ "paramname": "punPortRemote" ,"paramtype": "uint16 *"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "GetListenSocketInfo", + "returntype": "bool", + "params": [ +{ "paramname": "hListenSocket" ,"paramtype": "SNetListenSocket_t"}, +{ "paramname": "pnIP" ,"paramtype": "uint32 *"}, +{ "paramname": "pnPort" ,"paramtype": "uint16 *"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "GetSocketConnectionType", + "returntype": "ESNetSocketConnectionType", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetSocket_t"} + ] +} +,{ + "classname": "ISteamNetworking", + "methodname": "GetMaxPacketSize", + "returntype": "int", + "params": [ +{ "paramname": "hSocket" ,"paramtype": "SNetSocket_t"} + ] +} +,{ + "classname": "ISteamScreenshots", + "methodname": "WriteScreenshot", + "returntype": "ScreenshotHandle", + "params": [ +{ "paramname": "pubRGB" ,"paramtype": "void *"}, +{ "paramname": "cubRGB" ,"paramtype": "uint32"}, +{ "paramname": "nWidth" ,"paramtype": "int"}, +{ "paramname": "nHeight" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamScreenshots", + "methodname": "AddScreenshotToLibrary", + "returntype": "ScreenshotHandle", + "params": [ +{ "paramname": "pchFilename" ,"paramtype": "const char *"}, +{ "paramname": "pchThumbnailFilename" ,"paramtype": "const char *"}, +{ "paramname": "nWidth" ,"paramtype": "int"}, +{ "paramname": "nHeight" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamScreenshots", + "methodname": "TriggerScreenshot", + "returntype": "void" +} +,{ + "classname": "ISteamScreenshots", + "methodname": "HookScreenshots", + "returntype": "void", + "params": [ +{ "paramname": "bHook" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamScreenshots", + "methodname": "SetLocation", + "returntype": "bool", + "params": [ +{ "paramname": "hScreenshot" ,"paramtype": "ScreenshotHandle"}, +{ "paramname": "pchLocation" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamScreenshots", + "methodname": "TagUser", + "returntype": "bool", + "params": [ +{ "paramname": "hScreenshot" ,"paramtype": "ScreenshotHandle"}, +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamScreenshots", + "methodname": "TagPublishedFile", + "returntype": "bool", + "params": [ +{ "paramname": "hScreenshot" ,"paramtype": "ScreenshotHandle"}, +{ "paramname": "unPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamMusic", + "methodname": "BIsEnabled", + "returntype": "bool" +} +,{ + "classname": "ISteamMusic", + "methodname": "BIsPlaying", + "returntype": "bool" +} +,{ + "classname": "ISteamMusic", + "methodname": "GetPlaybackStatus", + "returntype": "AudioPlayback_Status" +} +,{ + "classname": "ISteamMusic", + "methodname": "Play", + "returntype": "void" +} +,{ + "classname": "ISteamMusic", + "methodname": "Pause", + "returntype": "void" +} +,{ + "classname": "ISteamMusic", + "methodname": "PlayPrevious", + "returntype": "void" +} +,{ + "classname": "ISteamMusic", + "methodname": "PlayNext", + "returntype": "void" +} +,{ + "classname": "ISteamMusic", + "methodname": "SetVolume", + "returntype": "void", + "params": [ +{ "paramname": "flVolume" ,"paramtype": "float"} + ] +} +,{ + "classname": "ISteamMusic", + "methodname": "GetVolume", + "returntype": "float" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "RegisterSteamMusicRemote", + "returntype": "bool", + "params": [ +{ "paramname": "pchName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "DeregisterSteamMusicRemote", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "BIsCurrentMusicRemote", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "BActivationSuccess", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "SetDisplayName", + "returntype": "bool", + "params": [ +{ "paramname": "pchDisplayName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "SetPNGIcon_64x64", + "returntype": "bool", + "params": [ +{ "paramname": "pvBuffer" ,"paramtype": "void *"}, +{ "paramname": "cbBufferLength" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "EnablePlayPrevious", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "EnablePlayNext", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "EnableShuffled", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "EnableLooped", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "EnableQueue", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "EnablePlaylists", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "UpdatePlaybackStatus", + "returntype": "bool", + "params": [ +{ "paramname": "nStatus" ,"paramtype": "AudioPlayback_Status"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "UpdateShuffled", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "UpdateLooped", + "returntype": "bool", + "params": [ +{ "paramname": "bValue" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "UpdateVolume", + "returntype": "bool", + "params": [ +{ "paramname": "flValue" ,"paramtype": "float"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "CurrentEntryWillChange", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "CurrentEntryIsAvailable", + "returntype": "bool", + "params": [ +{ "paramname": "bAvailable" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "UpdateCurrentEntryText", + "returntype": "bool", + "params": [ +{ "paramname": "pchText" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "UpdateCurrentEntryElapsedSeconds", + "returntype": "bool", + "params": [ +{ "paramname": "nValue" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "UpdateCurrentEntryCoverArt", + "returntype": "bool", + "params": [ +{ "paramname": "pvBuffer" ,"paramtype": "void *"}, +{ "paramname": "cbBufferLength" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "CurrentEntryDidChange", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "QueueWillChange", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "ResetQueueEntries", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "SetQueueEntry", + "returntype": "bool", + "params": [ +{ "paramname": "nID" ,"paramtype": "int"}, +{ "paramname": "nPosition" ,"paramtype": "int"}, +{ "paramname": "pchEntryText" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "SetCurrentQueueEntry", + "returntype": "bool", + "params": [ +{ "paramname": "nID" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "QueueDidChange", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "PlaylistWillChange", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "ResetPlaylistEntries", + "returntype": "bool" +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "SetPlaylistEntry", + "returntype": "bool", + "params": [ +{ "paramname": "nID" ,"paramtype": "int"}, +{ "paramname": "nPosition" ,"paramtype": "int"}, +{ "paramname": "pchEntryText" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "SetCurrentPlaylistEntry", + "returntype": "bool", + "params": [ +{ "paramname": "nID" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamMusicRemote", + "methodname": "PlaylistDidChange", + "returntype": "bool" +} +,{ + "classname": "ISteamHTTP", + "methodname": "CreateHTTPRequest", + "returntype": "HTTPRequestHandle", + "params": [ +{ "paramname": "eHTTPRequestMethod" ,"paramtype": "EHTTPMethod"}, +{ "paramname": "pchAbsoluteURL" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestContextValue", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "ulContextValue" ,"paramtype": "uint64"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestNetworkActivityTimeout", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "unTimeoutSeconds" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestHeaderValue", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pchHeaderName" ,"paramtype": "const char *"}, +{ "paramname": "pchHeaderValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestGetOrPostParameter", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pchParamName" ,"paramtype": "const char *"}, +{ "paramname": "pchParamValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SendHTTPRequest", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pCallHandle" ,"paramtype": "SteamAPICall_t *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SendHTTPRequestAndStreamResponse", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pCallHandle" ,"paramtype": "SteamAPICall_t *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "DeferHTTPRequest", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "PrioritizeHTTPRequest", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "GetHTTPResponseHeaderSize", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pchHeaderName" ,"paramtype": "const char *"}, +{ "paramname": "unResponseHeaderSize" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "GetHTTPResponseHeaderValue", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pchHeaderName" ,"paramtype": "const char *"}, +{ "paramname": "pHeaderValueBuffer" ,"paramtype": "uint8 *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "GetHTTPResponseBodySize", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "unBodySize" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "GetHTTPResponseBodyData", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pBodyDataBuffer" ,"paramtype": "uint8 *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "GetHTTPStreamingResponseBodyData", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "cOffset" ,"paramtype": "uint32"}, +{ "paramname": "pBodyDataBuffer" ,"paramtype": "uint8 *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "ReleaseHTTPRequest", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "GetHTTPDownloadProgressPct", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pflPercentOut" ,"paramtype": "float *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestRawPostBody", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pchContentType" ,"paramtype": "const char *"}, +{ "paramname": "pubBody" ,"paramtype": "uint8 *"}, +{ "paramname": "unBodyLen" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "CreateCookieContainer", + "returntype": "HTTPCookieContainerHandle", + "params": [ +{ "paramname": "bAllowResponsesToModify" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "ReleaseCookieContainer", + "returntype": "bool", + "params": [ +{ "paramname": "hCookieContainer" ,"paramtype": "HTTPCookieContainerHandle"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetCookie", + "returntype": "bool", + "params": [ +{ "paramname": "hCookieContainer" ,"paramtype": "HTTPCookieContainerHandle"}, +{ "paramname": "pchHost" ,"paramtype": "const char *"}, +{ "paramname": "pchUrl" ,"paramtype": "const char *"}, +{ "paramname": "pchCookie" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestCookieContainer", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "hCookieContainer" ,"paramtype": "HTTPCookieContainerHandle"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestUserAgentInfo", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pchUserAgentInfo" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestRequiresVerifiedCertificate", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "bRequireVerifiedCertificate" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "SetHTTPRequestAbsoluteTimeoutMS", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "unMilliseconds" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTTP", + "methodname": "GetHTTPRequestWasTimedOut", + "returntype": "bool", + "params": [ +{ "paramname": "hRequest" ,"paramtype": "HTTPRequestHandle"}, +{ "paramname": "pbWasTimedOut" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUnifiedMessages", + "methodname": "SendMethod", + "returntype": "ClientUnifiedMessageHandle", + "params": [ +{ "paramname": "pchServiceMethod" ,"paramtype": "const char *"}, +{ "paramname": "pRequestBuffer" ,"paramtype": "const void *"}, +{ "paramname": "unRequestBufferSize" ,"paramtype": "uint32"}, +{ "paramname": "unContext" ,"paramtype": "uint64"} + ] +} +,{ + "classname": "ISteamUnifiedMessages", + "methodname": "GetMethodResponseInfo", + "returntype": "bool", + "params": [ +{ "paramname": "hHandle" ,"paramtype": "ClientUnifiedMessageHandle"}, +{ "paramname": "punResponseSize" ,"paramtype": "uint32 *"}, +{ "paramname": "peResult" ,"paramtype": "EResult *"} + ] +} +,{ + "classname": "ISteamUnifiedMessages", + "methodname": "GetMethodResponseData", + "returntype": "bool", + "params": [ +{ "paramname": "hHandle" ,"paramtype": "ClientUnifiedMessageHandle"}, +{ "paramname": "pResponseBuffer" ,"paramtype": "void *"}, +{ "paramname": "unResponseBufferSize" ,"paramtype": "uint32"}, +{ "paramname": "bAutoRelease" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUnifiedMessages", + "methodname": "ReleaseMethod", + "returntype": "bool", + "params": [ +{ "paramname": "hHandle" ,"paramtype": "ClientUnifiedMessageHandle"} + ] +} +,{ + "classname": "ISteamUnifiedMessages", + "methodname": "SendNotification", + "returntype": "bool", + "params": [ +{ "paramname": "pchServiceNotification" ,"paramtype": "const char *"}, +{ "paramname": "pNotificationBuffer" ,"paramtype": "const void *"}, +{ "paramname": "unNotificationBufferSize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "Init", + "returntype": "bool" +} +,{ + "classname": "ISteamController", + "methodname": "Shutdown", + "returntype": "bool" +} +,{ + "classname": "ISteamController", + "methodname": "RunFrame", + "returntype": "void" +} +,{ + "classname": "ISteamController", + "methodname": "GetConnectedControllers", + "returntype": "int", + "params": [ +{ "paramname": "handlesOut" ,"paramtype": "ControllerHandle_t *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "ShowBindingPanel", + "returntype": "bool", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetActionSetHandle", + "returntype": "ControllerActionSetHandle_t", + "params": [ +{ "paramname": "pszActionSetName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "ActivateActionSet", + "returntype": "void", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "actionSetHandle" ,"paramtype": "ControllerActionSetHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetCurrentActionSet", + "returntype": "ControllerActionSetHandle_t", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetDigitalActionHandle", + "returntype": "ControllerDigitalActionHandle_t", + "params": [ +{ "paramname": "pszActionName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetDigitalActionData", + "returntype": "struct ControllerDigitalActionData_t", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "digitalActionHandle" ,"paramtype": "ControllerDigitalActionHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetDigitalActionOrigins", + "returntype": "int", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "actionSetHandle" ,"paramtype": "ControllerActionSetHandle_t"}, +{ "paramname": "digitalActionHandle" ,"paramtype": "ControllerDigitalActionHandle_t"}, +{ "paramname": "originsOut" ,"paramtype": "EControllerActionOrigin *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetAnalogActionHandle", + "returntype": "ControllerAnalogActionHandle_t", + "params": [ +{ "paramname": "pszActionName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetAnalogActionData", + "returntype": "struct ControllerAnalogActionData_t", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "analogActionHandle" ,"paramtype": "ControllerAnalogActionHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetAnalogActionOrigins", + "returntype": "int", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "actionSetHandle" ,"paramtype": "ControllerActionSetHandle_t"}, +{ "paramname": "analogActionHandle" ,"paramtype": "ControllerAnalogActionHandle_t"}, +{ "paramname": "originsOut" ,"paramtype": "EControllerActionOrigin *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "StopAnalogActionMomentum", + "returntype": "void", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "eAction" ,"paramtype": "ControllerAnalogActionHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "TriggerHapticPulse", + "returntype": "void", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "eTargetPad" ,"paramtype": "ESteamControllerPad"}, +{ "paramname": "usDurationMicroSec" ,"paramtype": "unsigned short"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "CreateQueryUserUGCRequest", + "returntype": "UGCQueryHandle_t", + "params": [ +{ "paramname": "unAccountID" ,"paramtype": "AccountID_t"}, +{ "paramname": "eListType" ,"paramtype": "EUserUGCList"}, +{ "paramname": "eMatchingUGCType" ,"paramtype": "EUGCMatchingUGCType"}, +{ "paramname": "eSortOrder" ,"paramtype": "EUserUGCListSortOrder"}, +{ "paramname": "nCreatorAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "nConsumerAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "unPage" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "CreateQueryAllUGCRequest", + "returntype": "UGCQueryHandle_t", + "params": [ +{ "paramname": "eQueryType" ,"paramtype": "EUGCQuery"}, +{ "paramname": "eMatchingeMatchingUGCTypeFileType" ,"paramtype": "EUGCMatchingUGCType"}, +{ "paramname": "nCreatorAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "nConsumerAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "unPage" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "CreateQueryUGCDetailsRequest", + "returntype": "UGCQueryHandle_t", + "params": [ +{ "paramname": "pvecPublishedFileID" ,"paramtype": "PublishedFileId_t *"}, +{ "paramname": "unNumPublishedFileIDs" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SendQueryUGCRequest", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCResult", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"}, +{ "paramname": "pDetails" ,"paramtype": "struct SteamUGCDetails_t *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCPreviewURL", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"}, +{ "paramname": "pchURL" ,"paramtype": "char *"}, +{ "paramname": "cchURLSize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCMetadata", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"}, +{ "paramname": "pchMetadata" ,"paramtype": "char *"}, +{ "paramname": "cchMetadatasize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCChildren", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"}, +{ "paramname": "pvecPublishedFileID" ,"paramtype": "PublishedFileId_t *"}, +{ "paramname": "cMaxEntries" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCStatistic", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"}, +{ "paramname": "eStatType" ,"paramtype": "EItemStatistic"}, +{ "paramname": "pStatValue" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCNumAdditionalPreviews", + "returntype": "uint32", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCAdditionalPreview", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"}, +{ "paramname": "previewIndex" ,"paramtype": "uint32"}, +{ "paramname": "pchURLOrVideoID" ,"paramtype": "char *"}, +{ "paramname": "cchURLSize" ,"paramtype": "uint32"}, +{ "paramname": "pbIsImage" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCNumKeyValueTags", + "returntype": "uint32", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetQueryUGCKeyValueTag", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "index" ,"paramtype": "uint32"}, +{ "paramname": "keyValueTagIndex" ,"paramtype": "uint32"}, +{ "paramname": "pchKey" ,"paramtype": "char *"}, +{ "paramname": "cchKeySize" ,"paramtype": "uint32"}, +{ "paramname": "pchValue" ,"paramtype": "char *"}, +{ "paramname": "cchValueSize" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "ReleaseQueryUGCRequest", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "AddRequiredTag", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "pTagName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "AddExcludedTag", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "pTagName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetReturnKeyValueTags", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "bReturnKeyValueTags" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetReturnLongDescription", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "bReturnLongDescription" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetReturnMetadata", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "bReturnMetadata" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetReturnChildren", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "bReturnChildren" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetReturnAdditionalPreviews", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "bReturnAdditionalPreviews" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetReturnTotalOnly", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "bReturnTotalOnly" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetLanguage", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "pchLanguage" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetAllowCachedResponse", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "unMaxAgeSeconds" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetCloudFileNameFilter", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "pMatchCloudFileName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetMatchAnyTag", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "bMatchAnyTag" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetSearchText", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "pSearchText" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetRankedByTrendDays", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "unDays" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "AddRequiredKeyValueTag", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCQueryHandle_t"}, +{ "paramname": "pKey" ,"paramtype": "const char *"}, +{ "paramname": "pValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "RequestUGCDetails", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "unMaxAgeSeconds" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "CreateItem", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nConsumerAppId" ,"paramtype": "AppId_t"}, +{ "paramname": "eFileType" ,"paramtype": "EWorkshopFileType"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "StartItemUpdate", + "returntype": "UGCUpdateHandle_t", + "params": [ +{ "paramname": "nConsumerAppId" ,"paramtype": "AppId_t"}, +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemTitle", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pchTitle" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemDescription", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pchDescription" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemUpdateLanguage", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pchLanguage" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemMetadata", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pchMetaData" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemVisibility", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "eVisibility" ,"paramtype": "ERemoteStoragePublishedFileVisibility"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemTags", + "returntype": "bool", + "params": [ +{ "paramname": "updateHandle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pTags" ,"paramtype": "const struct SteamParamStringArray_t *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemContent", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pszContentFolder" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetItemPreview", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pszPreviewFile" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "RemoveItemKeyValueTags", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "AddItemKeyValueTag", + "returntype": "bool", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SubmitItemUpdate", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "pchChangeNote" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetItemUpdateProgress", + "returntype": "EItemUpdateStatus", + "params": [ +{ "paramname": "handle" ,"paramtype": "UGCUpdateHandle_t"}, +{ "paramname": "punBytesProcessed" ,"paramtype": "uint64 *"}, +{ "paramname": "punBytesTotal" ,"paramtype": "uint64 *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SetUserItemVote", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "bVoteUp" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetUserItemVote", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "AddItemToFavorites", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nAppId" ,"paramtype": "AppId_t"}, +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "RemoveItemFromFavorites", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nAppId" ,"paramtype": "AppId_t"}, +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SubscribeItem", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "UnsubscribeItem", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetNumSubscribedItems", + "returntype": "uint32" +} +,{ + "classname": "ISteamUGC", + "methodname": "GetSubscribedItems", + "returntype": "uint32", + "params": [ +{ "paramname": "pvecPublishedFileID" ,"paramtype": "PublishedFileId_t *"}, +{ "paramname": "cMaxEntries" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetItemState", + "returntype": "uint32", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetItemInstallInfo", + "returntype": "bool", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "punSizeOnDisk" ,"paramtype": "uint64 *"}, +{ "paramname": "pchFolder" ,"paramtype": "char *"}, +{ "paramname": "cchFolderSize" ,"paramtype": "uint32"}, +{ "paramname": "punTimeStamp" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "GetItemDownloadInfo", + "returntype": "bool", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "punBytesDownloaded" ,"paramtype": "uint64 *"}, +{ "paramname": "punBytesTotal" ,"paramtype": "uint64 *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "DownloadItem", + "returntype": "bool", + "params": [ +{ "paramname": "nPublishedFileID" ,"paramtype": "PublishedFileId_t"}, +{ "paramname": "bHighPriority" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "BInitWorkshopForGameServer", + "returntype": "bool", + "params": [ +{ "paramname": "unWorkshopDepotID" ,"paramtype": "DepotId_t"}, +{ "paramname": "pszFolder" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SuspendDownloads", + "returntype": "void", + "params": [ +{ "paramname": "bSuspend" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamAppList", + "methodname": "GetNumInstalledApps", + "returntype": "uint32" +} +,{ + "classname": "ISteamAppList", + "methodname": "GetInstalledApps", + "returntype": "uint32", + "params": [ +{ "paramname": "pvecAppID" ,"paramtype": "AppId_t *"}, +{ "paramname": "unMaxAppIDs" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamAppList", + "methodname": "GetAppName", + "returntype": "int", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "pchName" ,"paramtype": "char *"}, +{ "paramname": "cchNameMax" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamAppList", + "methodname": "GetAppInstallDir", + "returntype": "int", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"}, +{ "paramname": "pchDirectory" ,"paramtype": "char *"}, +{ "paramname": "cchNameMax" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamAppList", + "methodname": "GetAppBuildId", + "returntype": "int", + "params": [ +{ "paramname": "nAppID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "DestructISteamHTMLSurface", + "returntype": "void" +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "Init", + "returntype": "bool" +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "Shutdown", + "returntype": "bool" +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "CreateBrowser", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchUserAgent" ,"paramtype": "const char *"}, +{ "paramname": "pchUserCSS" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "RemoveBrowser", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "LoadURL", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "pchURL" ,"paramtype": "const char *"}, +{ "paramname": "pchPostData" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "SetSize", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "unWidth" ,"paramtype": "uint32"}, +{ "paramname": "unHeight" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "StopLoad", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "Reload", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "GoBack", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "GoForward", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "AddHeader", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "ExecuteJavascript", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "pchScript" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "MouseUp", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "eMouseButton" ,"paramtype": "ISteamHTMLSurface::EHTMLMouseButton"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "MouseDown", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "eMouseButton" ,"paramtype": "ISteamHTMLSurface::EHTMLMouseButton"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "MouseDoubleClick", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "eMouseButton" ,"paramtype": "ISteamHTMLSurface::EHTMLMouseButton"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "MouseMove", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "x" ,"paramtype": "int"}, +{ "paramname": "y" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "MouseWheel", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "nDelta" ,"paramtype": "int32"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "KeyDown", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "nNativeKeyCode" ,"paramtype": "uint32"}, +{ "paramname": "eHTMLKeyModifiers" ,"paramtype": "ISteamHTMLSurface::EHTMLKeyModifiers"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "KeyUp", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "nNativeKeyCode" ,"paramtype": "uint32"}, +{ "paramname": "eHTMLKeyModifiers" ,"paramtype": "ISteamHTMLSurface::EHTMLKeyModifiers"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "KeyChar", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "cUnicodeChar" ,"paramtype": "uint32"}, +{ "paramname": "eHTMLKeyModifiers" ,"paramtype": "ISteamHTMLSurface::EHTMLKeyModifiers"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "SetHorizontalScroll", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "nAbsolutePixelScroll" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "SetVerticalScroll", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "nAbsolutePixelScroll" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "SetKeyFocus", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "bHasKeyFocus" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "ViewSource", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "CopyToClipboard", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "PasteFromClipboard", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "Find", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "pchSearchStr" ,"paramtype": "const char *"}, +{ "paramname": "bCurrentlyInFind" ,"paramtype": "bool"}, +{ "paramname": "bReverse" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "StopFind", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "GetLinkAtPosition", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "x" ,"paramtype": "int"}, +{ "paramname": "y" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "SetCookie", + "returntype": "void", + "params": [ +{ "paramname": "pchHostname" ,"paramtype": "const char *"}, +{ "paramname": "pchKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"}, +{ "paramname": "pchPath" ,"paramtype": "const char *"}, +{ "paramname": "nExpires" ,"paramtype": "RTime32"}, +{ "paramname": "bSecure" ,"paramtype": "bool"}, +{ "paramname": "bHTTPOnly" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "SetPageScaleFactor", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "flZoom" ,"paramtype": "float"}, +{ "paramname": "nPointX" ,"paramtype": "int"}, +{ "paramname": "nPointY" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "SetBackgroundMode", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "bBackgroundMode" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "AllowStartRequest", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "bAllowed" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "JSDialogResponse", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "bResult" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamHTMLSurface", + "methodname": "FileLoadDialogResponse", + "returntype": "void", + "params": [ +{ "paramname": "unBrowserHandle" ,"paramtype": "HHTMLBrowser"}, +{ "paramname": "pchSelectedFiles" ,"paramtype": "const char **"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GetResultStatus", "desc": "Find out the status of an asynchronous inventory result handle.", + "returntype": "EResult", + "params": [ +{ "paramname": "resultHandle" ,"paramtype": "SteamInventoryResult_t"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GetResultItems", "desc": "Copies the contents of a result set into a flat array. The specific contents of the result set depend on which query which was used.", + "returntype": "bool", + "params": [ +{ "paramname": "resultHandle" ,"paramtype": "SteamInventoryResult_t"}, +{ "paramname": "pOutItemsArray" ,"out_array_count": "punOutItemsArraySize" ,"desc": "Output array" ,"paramtype": "struct SteamItemDetails_t *"}, +{ "paramname": "punOutItemsArraySize" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GetResultTimestamp", "desc": "Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.", + "returntype": "uint32", + "params": [ +{ "paramname": "resultHandle" ,"paramtype": "SteamInventoryResult_t"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "CheckResultSteamID", "desc": "Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.", + "returntype": "bool", + "params": [ +{ "paramname": "resultHandle" ,"paramtype": "SteamInventoryResult_t"}, +{ "paramname": "steamIDExpected" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "DestroyResult", "desc": "Destroys a result handle and frees all associated memory.", + "returntype": "void", + "params": [ +{ "paramname": "resultHandle" ,"paramtype": "SteamInventoryResult_t"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GetAllItems", "desc": "Captures the entire state of the current users Steam inventory.", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GetItemsByID", "desc": "Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "pInstanceIDs" ,"array_count": "unCountInstanceIDs" ,"paramtype": "const SteamItemInstanceID_t *"}, +{ "paramname": "unCountInstanceIDs" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "SerializeResult", + "returntype": "bool", + "params": [ +{ "paramname": "resultHandle" ,"paramtype": "SteamInventoryResult_t"}, +{ "paramname": "pOutBuffer" ,"out_buffer_count": "punOutBufferSize" ,"paramtype": "void *"}, +{ "paramname": "punOutBufferSize" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "DeserializeResult", + "returntype": "bool", + "params": [ +{ "paramname": "pOutResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "pBuffer" ,"buffer_count": "punOutBufferSize" ,"paramtype": "const void *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32"}, +{ "paramname": "bRESERVED_MUST_BE_FALSE" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GenerateItems", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "pArrayItemDefs" ,"array_count": "unArrayLength" ,"paramtype": "const SteamItemDef_t *"}, +{ "paramname": "punArrayQuantity" ,"array_count": "unArrayLength" ,"paramtype": "const uint32 *"}, +{ "paramname": "unArrayLength" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GrantPromoItems", "desc": "GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "AddPromoItem", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "itemDef" ,"paramtype": "SteamItemDef_t"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "AddPromoItems", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "pArrayItemDefs" ,"array_count": "unArrayLength" ,"paramtype": "const SteamItemDef_t *"}, +{ "paramname": "unArrayLength" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "ConsumeItem", "desc": "ConsumeItem() removes items from the inventory permanently.", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "itemConsume" ,"paramtype": "SteamItemInstanceID_t"}, +{ "paramname": "unQuantity" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "ExchangeItems", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "pArrayGenerate" ,"array_count": "unArrayGenerateLength" ,"paramtype": "const SteamItemDef_t *"}, +{ "paramname": "punArrayGenerateQuantity" ,"array_count": "unArrayGenerateLength" ,"paramtype": "const uint32 *"}, +{ "paramname": "unArrayGenerateLength" ,"paramtype": "uint32"}, +{ "paramname": "pArrayDestroy" ,"array_count": "unArrayDestroyLength" ,"paramtype": "const SteamItemInstanceID_t *"}, +{ "paramname": "punArrayDestroyQuantity" ,"array_count": "unArrayDestroyLength" ,"paramtype": "const uint32 *"}, +{ "paramname": "unArrayDestroyLength" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "TransferItemQuantity", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "itemIdSource" ,"paramtype": "SteamItemInstanceID_t"}, +{ "paramname": "unQuantity" ,"paramtype": "uint32"}, +{ "paramname": "itemIdDest" ,"paramtype": "SteamItemInstanceID_t"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "SendItemDropHeartbeat", "desc": "Applications which use timed-drop mechanics should call SendItemDropHeartbeat() when active gameplay begins and at least once every two minutes afterwards.", + "returntype": "void" +} +,{ + "classname": "ISteamInventory", + "methodname": "TriggerItemDrop", "desc": "Playtime credit must be consumed and turned into item drops by your game.", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "dropListDefinition" ,"paramtype": "SteamItemDef_t"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "TradeItems", + "returntype": "bool", + "params": [ +{ "paramname": "pResultHandle" ,"paramtype": "SteamInventoryResult_t *"}, +{ "paramname": "steamIDTradePartner" ,"paramtype": "class CSteamID"}, +{ "paramname": "pArrayGive" ,"array_count": "nArrayGiveLength" ,"paramtype": "const SteamItemInstanceID_t *"}, +{ "paramname": "pArrayGiveQuantity" ,"array_count": "nArrayGiveLength" ,"paramtype": "const uint32 *"}, +{ "paramname": "nArrayGiveLength" ,"paramtype": "uint32"}, +{ "paramname": "pArrayGet" ,"array_count": "nArrayGetLength" ,"paramtype": "const SteamItemInstanceID_t *"}, +{ "paramname": "pArrayGetQuantity" ,"array_count": "nArrayGetLength" ,"paramtype": "const uint32 *"}, +{ "paramname": "nArrayGetLength" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "LoadItemDefinitions", "desc": "LoadItemDefinitions triggers the automatic load and refresh of item definitions.", + "returntype": "bool" +} +,{ + "classname": "ISteamInventory", + "methodname": "GetItemDefinitionIDs", + "returntype": "bool", + "params": [ +{ "paramname": "pItemDefIDs" ,"out_array_count": "punItemDefIDsArraySize" ,"desc": "List of item definition IDs" ,"paramtype": "SteamItemDef_t *"}, +{ "paramname": "punItemDefIDsArraySize" ,"desc": "Size of array is passed in and actual size used is returned in this param" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamInventory", + "methodname": "GetItemDefinitionProperty", + "returntype": "bool", + "params": [ +{ "paramname": "iDefinition" ,"paramtype": "SteamItemDef_t"}, +{ "paramname": "pchPropertyName" ,"paramtype": "const char *"}, +{ "paramname": "pchValueBuffer" ,"out_string_count": "punValueBufferSize" ,"paramtype": "char *"}, +{ "paramname": "punValueBufferSize" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamVideo", + "methodname": "GetVideoURL", + "returntype": "void", + "params": [ +{ "paramname": "unVideoAppID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamVideo", + "methodname": "IsBroadcasting", + "returntype": "bool", + "params": [ +{ "paramname": "pnNumViewers" ,"paramtype": "int *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "InitGameServer", + "returntype": "bool", + "params": [ +{ "paramname": "unIP" ,"paramtype": "uint32"}, +{ "paramname": "usGamePort" ,"paramtype": "uint16"}, +{ "paramname": "usQueryPort" ,"paramtype": "uint16"}, +{ "paramname": "unFlags" ,"paramtype": "uint32"}, +{ "paramname": "nGameAppId" ,"paramtype": "AppId_t"}, +{ "paramname": "pchVersionString" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetProduct", + "returntype": "void", + "params": [ +{ "paramname": "pszProduct" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetGameDescription", + "returntype": "void", + "params": [ +{ "paramname": "pszGameDescription" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetModDir", + "returntype": "void", + "params": [ +{ "paramname": "pszModDir" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetDedicatedServer", + "returntype": "void", + "params": [ +{ "paramname": "bDedicated" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "LogOn", + "returntype": "void", + "params": [ +{ "paramname": "pszToken" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "LogOnAnonymous", + "returntype": "void" +} +,{ + "classname": "ISteamGameServer", + "methodname": "LogOff", + "returntype": "void" +} +,{ + "classname": "ISteamGameServer", + "methodname": "BLoggedOn", + "returntype": "bool" +} +,{ + "classname": "ISteamGameServer", + "methodname": "BSecure", + "returntype": "bool" +} +,{ + "classname": "ISteamGameServer", + "methodname": "GetSteamID", + "returntype": "class CSteamID" +} +,{ + "classname": "ISteamGameServer", + "methodname": "WasRestartRequested", + "returntype": "bool" +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetMaxPlayerCount", + "returntype": "void", + "params": [ +{ "paramname": "cPlayersMax" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetBotPlayerCount", + "returntype": "void", + "params": [ +{ "paramname": "cBotplayers" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetServerName", + "returntype": "void", + "params": [ +{ "paramname": "pszServerName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetMapName", + "returntype": "void", + "params": [ +{ "paramname": "pszMapName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetPasswordProtected", + "returntype": "void", + "params": [ +{ "paramname": "bPasswordProtected" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetSpectatorPort", + "returntype": "void", + "params": [ +{ "paramname": "unSpectatorPort" ,"paramtype": "uint16"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetSpectatorServerName", + "returntype": "void", + "params": [ +{ "paramname": "pszSpectatorServerName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "ClearAllKeyValues", + "returntype": "void" +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetKeyValue", + "returntype": "void", + "params": [ +{ "paramname": "pKey" ,"paramtype": "const char *"}, +{ "paramname": "pValue" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetGameTags", + "returntype": "void", + "params": [ +{ "paramname": "pchGameTags" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetGameData", + "returntype": "void", + "params": [ +{ "paramname": "pchGameData" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetRegion", + "returntype": "void", + "params": [ +{ "paramname": "pszRegion" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SendUserConnectAndAuthenticate", + "returntype": "bool", + "params": [ +{ "paramname": "unIPClient" ,"paramtype": "uint32"}, +{ "paramname": "pvAuthBlob" ,"paramtype": "const void *"}, +{ "paramname": "cubAuthBlobSize" ,"paramtype": "uint32"}, +{ "paramname": "pSteamIDUser" ,"paramtype": "class CSteamID *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "CreateUnauthenticatedUserConnection", + "returntype": "class CSteamID" +} +,{ + "classname": "ISteamGameServer", + "methodname": "SendUserDisconnect", + "returntype": "void", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "BUpdateUserData", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchPlayerName" ,"paramtype": "const char *"}, +{ "paramname": "uScore" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "GetAuthSessionTicket", + "returntype": "HAuthTicket", + "params": [ +{ "paramname": "pTicket" ,"paramtype": "void *"}, +{ "paramname": "cbMaxTicket" ,"paramtype": "int"}, +{ "paramname": "pcbTicket" ,"paramtype": "uint32 *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "BeginAuthSession", + "returntype": "EBeginAuthSessionResult", + "params": [ +{ "paramname": "pAuthTicket" ,"paramtype": "const void *"}, +{ "paramname": "cbAuthTicket" ,"paramtype": "int"}, +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "EndAuthSession", + "returntype": "void", + "params": [ +{ "paramname": "steamID" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "CancelAuthTicket", + "returntype": "void", + "params": [ +{ "paramname": "hAuthTicket" ,"paramtype": "HAuthTicket"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "UserHasLicenseForApp", + "returntype": "EUserHasLicenseForAppResult", + "params": [ +{ "paramname": "steamID" ,"paramtype": "class CSteamID"}, +{ "paramname": "appID" ,"paramtype": "AppId_t"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "RequestUserGroupStatus", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "steamIDGroup" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "GetGameplayStats", + "returntype": "void" +} +,{ + "classname": "ISteamGameServer", + "methodname": "GetServerReputation", + "returntype": "SteamAPICall_t" +} +,{ + "classname": "ISteamGameServer", + "methodname": "GetPublicIP", + "returntype": "uint32" +} +,{ + "classname": "ISteamGameServer", + "methodname": "HandleIncomingPacket", + "returntype": "bool", + "params": [ +{ "paramname": "pData" ,"paramtype": "const void *"}, +{ "paramname": "cbData" ,"paramtype": "int"}, +{ "paramname": "srcIP" ,"paramtype": "uint32"}, +{ "paramname": "srcPort" ,"paramtype": "uint16"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "GetNextOutgoingPacket", + "returntype": "int", + "params": [ +{ "paramname": "pOut" ,"paramtype": "void *"}, +{ "paramname": "cbMaxOut" ,"paramtype": "int"}, +{ "paramname": "pNetAdr" ,"paramtype": "uint32 *"}, +{ "paramname": "pPort" ,"paramtype": "uint16 *"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "EnableHeartbeats", + "returntype": "void", + "params": [ +{ "paramname": "bActive" ,"paramtype": "bool"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "SetHeartbeatInterval", + "returntype": "void", + "params": [ +{ "paramname": "iHeartbeatInterval" ,"paramtype": "int"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "ForceHeartbeat", + "returntype": "void" +} +,{ + "classname": "ISteamGameServer", + "methodname": "AssociateWithClan", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDClan" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamGameServer", + "methodname": "ComputeNewPlayerCompatibility", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDNewPlayer" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "RequestUserStats", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "GetUserStat", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "int32 *"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "GetUserStat", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pData" ,"paramtype": "float *"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "GetUserAchievement", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "pbAchieved" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "SetUserStat", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "nData" ,"paramtype": "int32"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "SetUserStat", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "fData" ,"paramtype": "float"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "UpdateUserAvgRateStat", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"}, +{ "paramname": "flCountThisSession" ,"paramtype": "float"}, +{ "paramname": "dSessionLength" ,"paramtype": "double"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "SetUserAchievement", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "ClearUserAchievement", + "returntype": "bool", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"}, +{ "paramname": "pchName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamGameServerStats", + "methodname": "StoreUserStats", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "steamIDUser" ,"paramtype": "class CSteamID"} + ] +} +] +} \ No newline at end of file diff --git a/public/steam/steam_api_flat.h b/public/steam/steam_api_flat.h new file mode 100644 index 000000000..0039a8b19 --- /dev/null +++ b/public/steam/steam_api_flat.h @@ -0,0 +1,657 @@ +//====== Copyright (c) 1996-2014, Valve Corporation, All rights reserved. ======= +// +// Purpose: Header for flatted SteamAPI. Use this for binding to other languages. +// This file is auto-generated, do not edit it. +// +//============================================================================= + +#ifndef STEAMAPIFLAT_H +#define STEAMAPIFLAT_H +#ifdef _WIN32 +#pragma once +#endif + +#include + + +S_API HSteamPipe SteamAPI_ISteamClient_CreateSteamPipe(intptr_t instancePtr); +S_API bool SteamAPI_ISteamClient_BReleaseSteamPipe(intptr_t instancePtr, HSteamPipe hSteamPipe); +S_API HSteamUser SteamAPI_ISteamClient_ConnectToGlobalUser(intptr_t instancePtr, HSteamPipe hSteamPipe); +S_API HSteamUser SteamAPI_ISteamClient_CreateLocalUser(intptr_t instancePtr, HSteamPipe * phSteamPipe, EAccountType eAccountType); +S_API void SteamAPI_ISteamClient_ReleaseUser(intptr_t instancePtr, HSteamPipe hSteamPipe, HSteamUser hUser); +S_API class ISteamUser * SteamAPI_ISteamClient_GetISteamUser(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamGameServer * SteamAPI_ISteamClient_GetISteamGameServer(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API void SteamAPI_ISteamClient_SetLocalIPBinding(intptr_t instancePtr, uint32 unIP, uint16 usPort); +S_API class ISteamFriends * SteamAPI_ISteamClient_GetISteamFriends(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamUtils * SteamAPI_ISteamClient_GetISteamUtils(intptr_t instancePtr, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamMatchmaking * SteamAPI_ISteamClient_GetISteamMatchmaking(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamMatchmakingServers * SteamAPI_ISteamClient_GetISteamMatchmakingServers(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API void * SteamAPI_ISteamClient_GetISteamGenericInterface(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamUserStats * SteamAPI_ISteamClient_GetISteamUserStats(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamGameServerStats * SteamAPI_ISteamClient_GetISteamGameServerStats(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamApps * SteamAPI_ISteamClient_GetISteamApps(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamNetworking * SteamAPI_ISteamClient_GetISteamNetworking(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamRemoteStorage * SteamAPI_ISteamClient_GetISteamRemoteStorage(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamScreenshots * SteamAPI_ISteamClient_GetISteamScreenshots(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API void SteamAPI_ISteamClient_RunFrame(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamClient_GetIPCCallCount(intptr_t instancePtr); +S_API void SteamAPI_ISteamClient_SetWarningMessageHook(intptr_t instancePtr, SteamAPIWarningMessageHook_t pFunction); +S_API bool SteamAPI_ISteamClient_BShutdownIfAllPipesClosed(intptr_t instancePtr); +S_API class ISteamHTTP * SteamAPI_ISteamClient_GetISteamHTTP(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamUnifiedMessages * SteamAPI_ISteamClient_GetISteamUnifiedMessages(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamController * SteamAPI_ISteamClient_GetISteamController(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamUGC * SteamAPI_ISteamClient_GetISteamUGC(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamAppList * SteamAPI_ISteamClient_GetISteamAppList(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamMusic * SteamAPI_ISteamClient_GetISteamMusic(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamMusicRemote * SteamAPI_ISteamClient_GetISteamMusicRemote(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamHTMLSurface * SteamAPI_ISteamClient_GetISteamHTMLSurface(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API void SteamAPI_ISteamClient_Set_SteamAPI_CPostAPIResultInProcess(intptr_t instancePtr, SteamAPI_PostAPIResultInProcess_t func); +S_API void SteamAPI_ISteamClient_Remove_SteamAPI_CPostAPIResultInProcess(intptr_t instancePtr, SteamAPI_PostAPIResultInProcess_t func); +S_API void SteamAPI_ISteamClient_Set_SteamAPI_CCheckCallbackRegisteredInProcess(intptr_t instancePtr, SteamAPI_CheckCallbackRegistered_t func); +S_API class ISteamInventory * SteamAPI_ISteamClient_GetISteamInventory(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API class ISteamVideo * SteamAPI_ISteamClient_GetISteamVideo(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion); +S_API HSteamUser SteamAPI_ISteamUser_GetHSteamUser(intptr_t instancePtr); +S_API bool SteamAPI_ISteamUser_BLoggedOn(intptr_t instancePtr); +S_API uint64 SteamAPI_ISteamUser_GetSteamID(intptr_t instancePtr); +S_API int SteamAPI_ISteamUser_InitiateGameConnection(intptr_t instancePtr, void * pAuthBlob, int cbMaxAuthBlob, class CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure); +S_API void SteamAPI_ISteamUser_TerminateGameConnection(intptr_t instancePtr, uint32 unIPServer, uint16 usPortServer); +S_API void SteamAPI_ISteamUser_TrackAppUsageEvent(intptr_t instancePtr, class CGameID gameID, int eAppUsageEvent, const char * pchExtraInfo); +S_API bool SteamAPI_ISteamUser_GetUserDataFolder(intptr_t instancePtr, char * pchBuffer, int cubBuffer); +S_API void SteamAPI_ISteamUser_StartVoiceRecording(intptr_t instancePtr); +S_API void SteamAPI_ISteamUser_StopVoiceRecording(intptr_t instancePtr); +S_API EVoiceResult SteamAPI_ISteamUser_GetAvailableVoice(intptr_t instancePtr, uint32 * pcbCompressed, uint32 * pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate); +S_API EVoiceResult SteamAPI_ISteamUser_GetVoice(intptr_t instancePtr, bool bWantCompressed, void * pDestBuffer, uint32 cbDestBufferSize, uint32 * nBytesWritten, bool bWantUncompressed, void * pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 * nUncompressBytesWritten, uint32 nUncompressedVoiceDesiredSampleRate); +S_API EVoiceResult SteamAPI_ISteamUser_DecompressVoice(intptr_t instancePtr, const void * pCompressed, uint32 cbCompressed, void * pDestBuffer, uint32 cbDestBufferSize, uint32 * nBytesWritten, uint32 nDesiredSampleRate); +S_API uint32 SteamAPI_ISteamUser_GetVoiceOptimalSampleRate(intptr_t instancePtr); +S_API HAuthTicket SteamAPI_ISteamUser_GetAuthSessionTicket(intptr_t instancePtr, void * pTicket, int cbMaxTicket, uint32 * pcbTicket); +S_API EBeginAuthSessionResult SteamAPI_ISteamUser_BeginAuthSession(intptr_t instancePtr, const void * pAuthTicket, int cbAuthTicket, class CSteamID steamID); +S_API void SteamAPI_ISteamUser_EndAuthSession(intptr_t instancePtr, class CSteamID steamID); +S_API void SteamAPI_ISteamUser_CancelAuthTicket(intptr_t instancePtr, HAuthTicket hAuthTicket); +S_API EUserHasLicenseForAppResult SteamAPI_ISteamUser_UserHasLicenseForApp(intptr_t instancePtr, class CSteamID steamID, AppId_t appID); +S_API bool SteamAPI_ISteamUser_BIsBehindNAT(intptr_t instancePtr); +S_API void SteamAPI_ISteamUser_AdvertiseGame(intptr_t instancePtr, class CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer); +S_API SteamAPICall_t SteamAPI_ISteamUser_RequestEncryptedAppTicket(intptr_t instancePtr, void * pDataToInclude, int cbDataToInclude); +S_API bool SteamAPI_ISteamUser_GetEncryptedAppTicket(intptr_t instancePtr, void * pTicket, int cbMaxTicket, uint32 * pcbTicket); +S_API int SteamAPI_ISteamUser_GetGameBadgeLevel(intptr_t instancePtr, int nSeries, bool bFoil); +S_API int SteamAPI_ISteamUser_GetPlayerSteamLevel(intptr_t instancePtr); +S_API SteamAPICall_t SteamAPI_ISteamUser_RequestStoreAuthURL(intptr_t instancePtr, const char * pchRedirectURL); +S_API const char * SteamAPI_ISteamFriends_GetPersonaName(intptr_t instancePtr); +S_API SteamAPICall_t SteamAPI_ISteamFriends_SetPersonaName(intptr_t instancePtr, const char * pchPersonaName); +S_API EPersonaState SteamAPI_ISteamFriends_GetPersonaState(intptr_t instancePtr); +S_API int SteamAPI_ISteamFriends_GetFriendCount(intptr_t instancePtr, int iFriendFlags); +S_API uint64 SteamAPI_ISteamFriends_GetFriendByIndex(intptr_t instancePtr, int iFriend, int iFriendFlags); +S_API EFriendRelationship SteamAPI_ISteamFriends_GetFriendRelationship(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API EPersonaState SteamAPI_ISteamFriends_GetFriendPersonaState(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API const char * SteamAPI_ISteamFriends_GetFriendPersonaName(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API bool SteamAPI_ISteamFriends_GetFriendGamePlayed(intptr_t instancePtr, class CSteamID steamIDFriend, struct FriendGameInfo_t * pFriendGameInfo); +S_API const char * SteamAPI_ISteamFriends_GetFriendPersonaNameHistory(intptr_t instancePtr, class CSteamID steamIDFriend, int iPersonaName); +S_API int SteamAPI_ISteamFriends_GetFriendSteamLevel(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API const char * SteamAPI_ISteamFriends_GetPlayerNickname(intptr_t instancePtr, class CSteamID steamIDPlayer); +S_API int SteamAPI_ISteamFriends_GetFriendsGroupCount(intptr_t instancePtr); +S_API FriendsGroupID_t SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex(intptr_t instancePtr, int iFG); +S_API const char * SteamAPI_ISteamFriends_GetFriendsGroupName(intptr_t instancePtr, FriendsGroupID_t friendsGroupID); +S_API int SteamAPI_ISteamFriends_GetFriendsGroupMembersCount(intptr_t instancePtr, FriendsGroupID_t friendsGroupID); +S_API void SteamAPI_ISteamFriends_GetFriendsGroupMembersList(intptr_t instancePtr, FriendsGroupID_t friendsGroupID, class CSteamID * pOutSteamIDMembers, int nMembersCount); +S_API bool SteamAPI_ISteamFriends_HasFriend(intptr_t instancePtr, class CSteamID steamIDFriend, int iFriendFlags); +S_API int SteamAPI_ISteamFriends_GetClanCount(intptr_t instancePtr); +S_API uint64 SteamAPI_ISteamFriends_GetClanByIndex(intptr_t instancePtr, int iClan); +S_API const char * SteamAPI_ISteamFriends_GetClanName(intptr_t instancePtr, class CSteamID steamIDClan); +S_API const char * SteamAPI_ISteamFriends_GetClanTag(intptr_t instancePtr, class CSteamID steamIDClan); +S_API bool SteamAPI_ISteamFriends_GetClanActivityCounts(intptr_t instancePtr, class CSteamID steamIDClan, int * pnOnline, int * pnInGame, int * pnChatting); +S_API SteamAPICall_t SteamAPI_ISteamFriends_DownloadClanActivityCounts(intptr_t instancePtr, class CSteamID * psteamIDClans, int cClansToRequest); +S_API int SteamAPI_ISteamFriends_GetFriendCountFromSource(intptr_t instancePtr, class CSteamID steamIDSource); +S_API uint64 SteamAPI_ISteamFriends_GetFriendFromSourceByIndex(intptr_t instancePtr, class CSteamID steamIDSource, int iFriend); +S_API bool SteamAPI_ISteamFriends_IsUserInSource(intptr_t instancePtr, class CSteamID steamIDUser, class CSteamID steamIDSource); +S_API void SteamAPI_ISteamFriends_SetInGameVoiceSpeaking(intptr_t instancePtr, class CSteamID steamIDUser, bool bSpeaking); +S_API void SteamAPI_ISteamFriends_ActivateGameOverlay(intptr_t instancePtr, const char * pchDialog); +S_API void SteamAPI_ISteamFriends_ActivateGameOverlayToUser(intptr_t instancePtr, const char * pchDialog, class CSteamID steamID); +S_API void SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(intptr_t instancePtr, const char * pchURL); +S_API void SteamAPI_ISteamFriends_ActivateGameOverlayToStore(intptr_t instancePtr, AppId_t nAppID, EOverlayToStoreFlag eFlag); +S_API void SteamAPI_ISteamFriends_SetPlayedWith(intptr_t instancePtr, class CSteamID steamIDUserPlayedWith); +S_API void SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API int SteamAPI_ISteamFriends_GetSmallFriendAvatar(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API int SteamAPI_ISteamFriends_GetMediumFriendAvatar(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API int SteamAPI_ISteamFriends_GetLargeFriendAvatar(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API bool SteamAPI_ISteamFriends_RequestUserInformation(intptr_t instancePtr, class CSteamID steamIDUser, bool bRequireNameOnly); +S_API SteamAPICall_t SteamAPI_ISteamFriends_RequestClanOfficerList(intptr_t instancePtr, class CSteamID steamIDClan); +S_API uint64 SteamAPI_ISteamFriends_GetClanOwner(intptr_t instancePtr, class CSteamID steamIDClan); +S_API int SteamAPI_ISteamFriends_GetClanOfficerCount(intptr_t instancePtr, class CSteamID steamIDClan); +S_API uint64 SteamAPI_ISteamFriends_GetClanOfficerByIndex(intptr_t instancePtr, class CSteamID steamIDClan, int iOfficer); +S_API uint32 SteamAPI_ISteamFriends_GetUserRestrictions(intptr_t instancePtr); +S_API bool SteamAPI_ISteamFriends_SetRichPresence(intptr_t instancePtr, const char * pchKey, const char * pchValue); +S_API void SteamAPI_ISteamFriends_ClearRichPresence(intptr_t instancePtr); +S_API const char * SteamAPI_ISteamFriends_GetFriendRichPresence(intptr_t instancePtr, class CSteamID steamIDFriend, const char * pchKey); +S_API int SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API const char * SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex(intptr_t instancePtr, class CSteamID steamIDFriend, int iKey); +S_API void SteamAPI_ISteamFriends_RequestFriendRichPresence(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API bool SteamAPI_ISteamFriends_InviteUserToGame(intptr_t instancePtr, class CSteamID steamIDFriend, const char * pchConnectString); +S_API int SteamAPI_ISteamFriends_GetCoplayFriendCount(intptr_t instancePtr); +S_API uint64 SteamAPI_ISteamFriends_GetCoplayFriend(intptr_t instancePtr, int iCoplayFriend); +S_API int SteamAPI_ISteamFriends_GetFriendCoplayTime(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API AppId_t SteamAPI_ISteamFriends_GetFriendCoplayGame(intptr_t instancePtr, class CSteamID steamIDFriend); +S_API SteamAPICall_t SteamAPI_ISteamFriends_JoinClanChatRoom(intptr_t instancePtr, class CSteamID steamIDClan); +S_API bool SteamAPI_ISteamFriends_LeaveClanChatRoom(intptr_t instancePtr, class CSteamID steamIDClan); +S_API int SteamAPI_ISteamFriends_GetClanChatMemberCount(intptr_t instancePtr, class CSteamID steamIDClan); +S_API uint64 SteamAPI_ISteamFriends_GetChatMemberByIndex(intptr_t instancePtr, class CSteamID steamIDClan, int iUser); +S_API bool SteamAPI_ISteamFriends_SendClanChatMessage(intptr_t instancePtr, class CSteamID steamIDClanChat, const char * pchText); +S_API int SteamAPI_ISteamFriends_GetClanChatMessage(intptr_t instancePtr, class CSteamID steamIDClanChat, int iMessage, void * prgchText, int cchTextMax, EChatEntryType * peChatEntryType, class CSteamID * psteamidChatter); +S_API bool SteamAPI_ISteamFriends_IsClanChatAdmin(intptr_t instancePtr, class CSteamID steamIDClanChat, class CSteamID steamIDUser); +S_API bool SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam(intptr_t instancePtr, class CSteamID steamIDClanChat); +S_API bool SteamAPI_ISteamFriends_OpenClanChatWindowInSteam(intptr_t instancePtr, class CSteamID steamIDClanChat); +S_API bool SteamAPI_ISteamFriends_CloseClanChatWindowInSteam(intptr_t instancePtr, class CSteamID steamIDClanChat); +S_API bool SteamAPI_ISteamFriends_SetListenForFriendsMessages(intptr_t instancePtr, bool bInterceptEnabled); +S_API bool SteamAPI_ISteamFriends_ReplyToFriendMessage(intptr_t instancePtr, class CSteamID steamIDFriend, const char * pchMsgToSend); +S_API int SteamAPI_ISteamFriends_GetFriendMessage(intptr_t instancePtr, class CSteamID steamIDFriend, int iMessageID, void * pvData, int cubData, EChatEntryType * peChatEntryType); +S_API SteamAPICall_t SteamAPI_ISteamFriends_GetFollowerCount(intptr_t instancePtr, class CSteamID steamID); +S_API SteamAPICall_t SteamAPI_ISteamFriends_IsFollowing(intptr_t instancePtr, class CSteamID steamID); +S_API SteamAPICall_t SteamAPI_ISteamFriends_EnumerateFollowingList(intptr_t instancePtr, uint32 unStartIndex); +S_API uint32 SteamAPI_ISteamUtils_GetSecondsSinceAppActive(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamUtils_GetSecondsSinceComputerActive(intptr_t instancePtr); +S_API EUniverse SteamAPI_ISteamUtils_GetConnectedUniverse(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamUtils_GetServerRealTime(intptr_t instancePtr); +S_API const char * SteamAPI_ISteamUtils_GetIPCountry(intptr_t instancePtr); +S_API bool SteamAPI_ISteamUtils_GetImageSize(intptr_t instancePtr, int iImage, uint32 * pnWidth, uint32 * pnHeight); +S_API bool SteamAPI_ISteamUtils_GetImageRGBA(intptr_t instancePtr, int iImage, uint8 * pubDest, int nDestBufferSize); +S_API bool SteamAPI_ISteamUtils_GetCSERIPPort(intptr_t instancePtr, uint32 * unIP, uint16 * usPort); +S_API uint8 SteamAPI_ISteamUtils_GetCurrentBatteryPower(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamUtils_GetAppID(intptr_t instancePtr); +S_API void SteamAPI_ISteamUtils_SetOverlayNotificationPosition(intptr_t instancePtr, ENotificationPosition eNotificationPosition); +S_API bool SteamAPI_ISteamUtils_IsAPICallCompleted(intptr_t instancePtr, SteamAPICall_t hSteamAPICall, bool * pbFailed); +S_API ESteamAPICallFailure SteamAPI_ISteamUtils_GetAPICallFailureReason(intptr_t instancePtr, SteamAPICall_t hSteamAPICall); +S_API bool SteamAPI_ISteamUtils_GetAPICallResult(intptr_t instancePtr, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed); +S_API void SteamAPI_ISteamUtils_RunFrame(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamUtils_GetIPCCallCount(intptr_t instancePtr); +S_API void SteamAPI_ISteamUtils_SetWarningMessageHook(intptr_t instancePtr, SteamAPIWarningMessageHook_t pFunction); +S_API bool SteamAPI_ISteamUtils_IsOverlayEnabled(intptr_t instancePtr); +S_API bool SteamAPI_ISteamUtils_BOverlayNeedsPresent(intptr_t instancePtr); +S_API SteamAPICall_t SteamAPI_ISteamUtils_CheckFileSignature(intptr_t instancePtr, const char * szFileName); +S_API bool SteamAPI_ISteamUtils_ShowGamepadTextInput(intptr_t instancePtr, EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char * pchDescription, uint32 unCharMax, const char * pchExistingText); +S_API uint32 SteamAPI_ISteamUtils_GetEnteredGamepadTextLength(intptr_t instancePtr); +S_API bool SteamAPI_ISteamUtils_GetEnteredGamepadTextInput(intptr_t instancePtr, char * pchText, uint32 cchText); +S_API const char * SteamAPI_ISteamUtils_GetSteamUILanguage(intptr_t instancePtr); +S_API bool SteamAPI_ISteamUtils_IsSteamRunningInVR(intptr_t instancePtr); +S_API void SteamAPI_ISteamUtils_SetOverlayNotificationInset(intptr_t instancePtr, int nHorizontalInset, int nVerticalInset); +S_API int SteamAPI_ISteamMatchmaking_GetFavoriteGameCount(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMatchmaking_GetFavoriteGame(intptr_t instancePtr, int iGame, AppId_t * pnAppID, uint32 * pnIP, uint16 * pnConnPort, uint16 * pnQueryPort, uint32 * punFlags, uint32 * pRTime32LastPlayedOnServer); +S_API int SteamAPI_ISteamMatchmaking_AddFavoriteGame(intptr_t instancePtr, AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer); +S_API bool SteamAPI_ISteamMatchmaking_RemoveFavoriteGame(intptr_t instancePtr, AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags); +S_API SteamAPICall_t SteamAPI_ISteamMatchmaking_RequestLobbyList(intptr_t instancePtr); +S_API void SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter(intptr_t instancePtr, const char * pchKeyToMatch, const char * pchValueToMatch, ELobbyComparison eComparisonType); +S_API void SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter(intptr_t instancePtr, const char * pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType); +S_API void SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter(intptr_t instancePtr, const char * pchKeyToMatch, int nValueToBeCloseTo); +S_API void SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable(intptr_t instancePtr, int nSlotsAvailable); +S_API void SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter(intptr_t instancePtr, ELobbyDistanceFilter eLobbyDistanceFilter); +S_API void SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter(intptr_t instancePtr, int cMaxResults); +S_API void SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API uint64 SteamAPI_ISteamMatchmaking_GetLobbyByIndex(intptr_t instancePtr, int iLobby); +S_API SteamAPICall_t SteamAPI_ISteamMatchmaking_CreateLobby(intptr_t instancePtr, ELobbyType eLobbyType, int cMaxMembers); +S_API SteamAPICall_t SteamAPI_ISteamMatchmaking_JoinLobby(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API void SteamAPI_ISteamMatchmaking_LeaveLobby(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API bool SteamAPI_ISteamMatchmaking_InviteUserToLobby(intptr_t instancePtr, class CSteamID steamIDLobby, class CSteamID steamIDInvitee); +S_API int SteamAPI_ISteamMatchmaking_GetNumLobbyMembers(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API uint64 SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex(intptr_t instancePtr, class CSteamID steamIDLobby, int iMember); +S_API const char * SteamAPI_ISteamMatchmaking_GetLobbyData(intptr_t instancePtr, class CSteamID steamIDLobby, const char * pchKey); +S_API bool SteamAPI_ISteamMatchmaking_SetLobbyData(intptr_t instancePtr, class CSteamID steamIDLobby, const char * pchKey, const char * pchValue); +S_API int SteamAPI_ISteamMatchmaking_GetLobbyDataCount(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API bool SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex(intptr_t instancePtr, class CSteamID steamIDLobby, int iLobbyData, char * pchKey, int cchKeyBufferSize, char * pchValue, int cchValueBufferSize); +S_API bool SteamAPI_ISteamMatchmaking_DeleteLobbyData(intptr_t instancePtr, class CSteamID steamIDLobby, const char * pchKey); +S_API const char * SteamAPI_ISteamMatchmaking_GetLobbyMemberData(intptr_t instancePtr, class CSteamID steamIDLobby, class CSteamID steamIDUser, const char * pchKey); +S_API void SteamAPI_ISteamMatchmaking_SetLobbyMemberData(intptr_t instancePtr, class CSteamID steamIDLobby, const char * pchKey, const char * pchValue); +S_API bool SteamAPI_ISteamMatchmaking_SendLobbyChatMsg(intptr_t instancePtr, class CSteamID steamIDLobby, const void * pvMsgBody, int cubMsgBody); +S_API int SteamAPI_ISteamMatchmaking_GetLobbyChatEntry(intptr_t instancePtr, class CSteamID steamIDLobby, int iChatID, class CSteamID * pSteamIDUser, void * pvData, int cubData, EChatEntryType * peChatEntryType); +S_API bool SteamAPI_ISteamMatchmaking_RequestLobbyData(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API void SteamAPI_ISteamMatchmaking_SetLobbyGameServer(intptr_t instancePtr, class CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, class CSteamID steamIDGameServer); +S_API bool SteamAPI_ISteamMatchmaking_GetLobbyGameServer(intptr_t instancePtr, class CSteamID steamIDLobby, uint32 * punGameServerIP, uint16 * punGameServerPort, class CSteamID * psteamIDGameServer); +S_API bool SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit(intptr_t instancePtr, class CSteamID steamIDLobby, int cMaxMembers); +S_API int SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API bool SteamAPI_ISteamMatchmaking_SetLobbyType(intptr_t instancePtr, class CSteamID steamIDLobby, ELobbyType eLobbyType); +S_API bool SteamAPI_ISteamMatchmaking_SetLobbyJoinable(intptr_t instancePtr, class CSteamID steamIDLobby, bool bLobbyJoinable); +S_API uint64 SteamAPI_ISteamMatchmaking_GetLobbyOwner(intptr_t instancePtr, class CSteamID steamIDLobby); +S_API bool SteamAPI_ISteamMatchmaking_SetLobbyOwner(intptr_t instancePtr, class CSteamID steamIDLobby, class CSteamID steamIDNewOwner); +S_API bool SteamAPI_ISteamMatchmaking_SetLinkedLobby(intptr_t instancePtr, class CSteamID steamIDLobby, class CSteamID steamIDLobbyDependent); +S_API void SteamAPI_ISteamMatchmakingServerListResponse_ServerResponded(intptr_t instancePtr, HServerListRequest hRequest, int iServer); +S_API void SteamAPI_ISteamMatchmakingServerListResponse_ServerFailedToRespond(intptr_t instancePtr, HServerListRequest hRequest, int iServer); +S_API void SteamAPI_ISteamMatchmakingServerListResponse_RefreshComplete(intptr_t instancePtr, HServerListRequest hRequest, EMatchMakingServerResponse response); +S_API void SteamAPI_ISteamMatchmakingPingResponse_ServerResponded(intptr_t instancePtr, class gameserveritem_t & server); +S_API void SteamAPI_ISteamMatchmakingPingResponse_ServerFailedToRespond(intptr_t instancePtr); +S_API void SteamAPI_ISteamMatchmakingPlayersResponse_AddPlayerToList(intptr_t instancePtr, const char * pchName, int nScore, float flTimePlayed); +S_API void SteamAPI_ISteamMatchmakingPlayersResponse_PlayersFailedToRespond(intptr_t instancePtr); +S_API void SteamAPI_ISteamMatchmakingPlayersResponse_PlayersRefreshComplete(intptr_t instancePtr); +S_API void SteamAPI_ISteamMatchmakingRulesResponse_RulesResponded(intptr_t instancePtr, const char * pchRule, const char * pchValue); +S_API void SteamAPI_ISteamMatchmakingRulesResponse_RulesFailedToRespond(intptr_t instancePtr); +S_API void SteamAPI_ISteamMatchmakingRulesResponse_RulesRefreshComplete(intptr_t instancePtr); +S_API HServerListRequest SteamAPI_ISteamMatchmakingServers_RequestInternetServerList(intptr_t instancePtr, AppId_t iApp, struct MatchMakingKeyValuePair_t ** ppchFilters, uint32 nFilters, class ISteamMatchmakingServerListResponse * pRequestServersResponse); +S_API HServerListRequest SteamAPI_ISteamMatchmakingServers_RequestLANServerList(intptr_t instancePtr, AppId_t iApp, class ISteamMatchmakingServerListResponse * pRequestServersResponse); +S_API HServerListRequest SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList(intptr_t instancePtr, AppId_t iApp, struct MatchMakingKeyValuePair_t ** ppchFilters, uint32 nFilters, class ISteamMatchmakingServerListResponse * pRequestServersResponse); +S_API HServerListRequest SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList(intptr_t instancePtr, AppId_t iApp, struct MatchMakingKeyValuePair_t ** ppchFilters, uint32 nFilters, class ISteamMatchmakingServerListResponse * pRequestServersResponse); +S_API HServerListRequest SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList(intptr_t instancePtr, AppId_t iApp, struct MatchMakingKeyValuePair_t ** ppchFilters, uint32 nFilters, class ISteamMatchmakingServerListResponse * pRequestServersResponse); +S_API HServerListRequest SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList(intptr_t instancePtr, AppId_t iApp, struct MatchMakingKeyValuePair_t ** ppchFilters, uint32 nFilters, class ISteamMatchmakingServerListResponse * pRequestServersResponse); +S_API void SteamAPI_ISteamMatchmakingServers_ReleaseRequest(intptr_t instancePtr, HServerListRequest hServerListRequest); +S_API class gameserveritem_t * SteamAPI_ISteamMatchmakingServers_GetServerDetails(intptr_t instancePtr, HServerListRequest hRequest, int iServer); +S_API void SteamAPI_ISteamMatchmakingServers_CancelQuery(intptr_t instancePtr, HServerListRequest hRequest); +S_API void SteamAPI_ISteamMatchmakingServers_RefreshQuery(intptr_t instancePtr, HServerListRequest hRequest); +S_API bool SteamAPI_ISteamMatchmakingServers_IsRefreshing(intptr_t instancePtr, HServerListRequest hRequest); +S_API int SteamAPI_ISteamMatchmakingServers_GetServerCount(intptr_t instancePtr, HServerListRequest hRequest); +S_API void SteamAPI_ISteamMatchmakingServers_RefreshServer(intptr_t instancePtr, HServerListRequest hRequest, int iServer); +S_API HServerQuery SteamAPI_ISteamMatchmakingServers_PingServer(intptr_t instancePtr, uint32 unIP, uint16 usPort, class ISteamMatchmakingPingResponse * pRequestServersResponse); +S_API HServerQuery SteamAPI_ISteamMatchmakingServers_PlayerDetails(intptr_t instancePtr, uint32 unIP, uint16 usPort, class ISteamMatchmakingPlayersResponse * pRequestServersResponse); +S_API HServerQuery SteamAPI_ISteamMatchmakingServers_ServerRules(intptr_t instancePtr, uint32 unIP, uint16 usPort, class ISteamMatchmakingRulesResponse * pRequestServersResponse); +S_API void SteamAPI_ISteamMatchmakingServers_CancelServerQuery(intptr_t instancePtr, HServerQuery hServerQuery); +S_API bool SteamAPI_ISteamRemoteStorage_FileWrite(intptr_t instancePtr, const char * pchFile, const void * pvData, int32 cubData); +S_API int32 SteamAPI_ISteamRemoteStorage_FileRead(intptr_t instancePtr, const char * pchFile, void * pvData, int32 cubDataToRead); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileWriteAsync(intptr_t instancePtr, const char * pchFile, const void * pvData, uint32 cubData); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileReadAsync(intptr_t instancePtr, const char * pchFile, uint32 nOffset, uint32 cubToRead); +S_API bool SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete(intptr_t instancePtr, SteamAPICall_t hReadCall, void * pvBuffer, uint32 cubToRead); +S_API bool SteamAPI_ISteamRemoteStorage_FileForget(intptr_t instancePtr, const char * pchFile); +S_API bool SteamAPI_ISteamRemoteStorage_FileDelete(intptr_t instancePtr, const char * pchFile); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileShare(intptr_t instancePtr, const char * pchFile); +S_API bool SteamAPI_ISteamRemoteStorage_SetSyncPlatforms(intptr_t instancePtr, const char * pchFile, ERemoteStoragePlatform eRemoteStoragePlatform); +S_API UGCFileWriteStreamHandle_t SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen(intptr_t instancePtr, const char * pchFile); +S_API bool SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk(intptr_t instancePtr, UGCFileWriteStreamHandle_t writeHandle, const void * pvData, int32 cubData); +S_API bool SteamAPI_ISteamRemoteStorage_FileWriteStreamClose(intptr_t instancePtr, UGCFileWriteStreamHandle_t writeHandle); +S_API bool SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel(intptr_t instancePtr, UGCFileWriteStreamHandle_t writeHandle); +S_API bool SteamAPI_ISteamRemoteStorage_FileExists(intptr_t instancePtr, const char * pchFile); +S_API bool SteamAPI_ISteamRemoteStorage_FilePersisted(intptr_t instancePtr, const char * pchFile); +S_API int32 SteamAPI_ISteamRemoteStorage_GetFileSize(intptr_t instancePtr, const char * pchFile); +S_API int64 SteamAPI_ISteamRemoteStorage_GetFileTimestamp(intptr_t instancePtr, const char * pchFile); +S_API ERemoteStoragePlatform SteamAPI_ISteamRemoteStorage_GetSyncPlatforms(intptr_t instancePtr, const char * pchFile); +S_API int32 SteamAPI_ISteamRemoteStorage_GetFileCount(intptr_t instancePtr); +S_API const char * SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(intptr_t instancePtr, int iFile, int32 * pnFileSizeInBytes); +S_API bool SteamAPI_ISteamRemoteStorage_GetQuota(intptr_t instancePtr, int32 * pnTotalBytes, int32 * puAvailableBytes); +S_API bool SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount(intptr_t instancePtr); +S_API bool SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp(intptr_t instancePtr); +S_API void SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp(intptr_t instancePtr, bool bEnabled); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_UGCDownload(intptr_t instancePtr, UGCHandle_t hContent, uint32 unPriority); +S_API bool SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(intptr_t instancePtr, UGCHandle_t hContent, int32 * pnBytesDownloaded, int32 * pnBytesExpected); +S_API bool SteamAPI_ISteamRemoteStorage_GetUGCDetails(intptr_t instancePtr, UGCHandle_t hContent, AppId_t * pnAppID, char ** ppchName, int32 * pnFileSizeInBytes, class CSteamID * pSteamIDOwner); +S_API int32 SteamAPI_ISteamRemoteStorage_UGCRead(intptr_t instancePtr, UGCHandle_t hContent, void * pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction); +S_API int32 SteamAPI_ISteamRemoteStorage_GetCachedUGCCount(intptr_t instancePtr); +S_API UGCHandle_t SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle(intptr_t instancePtr, int32 iCachedContent); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_PublishWorkshopFile(intptr_t instancePtr, const char * pchFile, const char * pchPreviewFile, AppId_t nConsumerAppId, const char * pchTitle, const char * pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, struct SteamParamStringArray_t * pTags, EWorkshopFileType eWorkshopFileType); +S_API PublishedFileUpdateHandle_t SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest(intptr_t instancePtr, PublishedFileId_t unPublishedFileId); +S_API bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle, const char * pchFile); +S_API bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle, const char * pchPreviewFile); +S_API bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle, const char * pchTitle); +S_API bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle, const char * pchDescription); +S_API bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility); +S_API bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle, struct SteamParamStringArray_t * pTags); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails(intptr_t instancePtr, PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_DeletePublishedFile(intptr_t instancePtr, PublishedFileId_t unPublishedFileId); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles(intptr_t instancePtr, uint32 unStartIndex); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_SubscribePublishedFile(intptr_t instancePtr, PublishedFileId_t unPublishedFileId); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles(intptr_t instancePtr, uint32 unStartIndex); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile(intptr_t instancePtr, PublishedFileId_t unPublishedFileId); +S_API bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription(intptr_t instancePtr, PublishedFileUpdateHandle_t updateHandle, const char * pchChangeDescription); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails(intptr_t instancePtr, PublishedFileId_t unPublishedFileId); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote(intptr_t instancePtr, PublishedFileId_t unPublishedFileId, bool bVoteUp); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails(intptr_t instancePtr, PublishedFileId_t unPublishedFileId); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles(intptr_t instancePtr, class CSteamID steamId, uint32 unStartIndex, struct SteamParamStringArray_t * pRequiredTags, struct SteamParamStringArray_t * pExcludedTags); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_PublishVideo(intptr_t instancePtr, EWorkshopVideoProvider eVideoProvider, const char * pchVideoAccount, const char * pchVideoIdentifier, const char * pchPreviewFile, AppId_t nConsumerAppId, const char * pchTitle, const char * pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, struct SteamParamStringArray_t * pTags); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction(intptr_t instancePtr, PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction(intptr_t instancePtr, EWorkshopFileAction eAction, uint32 unStartIndex); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles(intptr_t instancePtr, EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, struct SteamParamStringArray_t * pTags, struct SteamParamStringArray_t * pUserTags); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation(intptr_t instancePtr, UGCHandle_t hContent, const char * pchLocation, uint32 unPriority); +S_API bool SteamAPI_ISteamUserStats_RequestCurrentStats(intptr_t instancePtr); +S_API bool SteamAPI_ISteamUserStats_GetStat(intptr_t instancePtr, const char * pchName, int32 * pData); +S_API bool SteamAPI_ISteamUserStats_GetStat0(intptr_t instancePtr, const char * pchName, float * pData); +S_API bool SteamAPI_ISteamUserStats_SetStat(intptr_t instancePtr, const char * pchName, int32 nData); +S_API bool SteamAPI_ISteamUserStats_SetStat0(intptr_t instancePtr, const char * pchName, float fData); +S_API bool SteamAPI_ISteamUserStats_UpdateAvgRateStat(intptr_t instancePtr, const char * pchName, float flCountThisSession, double dSessionLength); +S_API bool SteamAPI_ISteamUserStats_GetAchievement(intptr_t instancePtr, const char * pchName, bool * pbAchieved); +S_API bool SteamAPI_ISteamUserStats_SetAchievement(intptr_t instancePtr, const char * pchName); +S_API bool SteamAPI_ISteamUserStats_ClearAchievement(intptr_t instancePtr, const char * pchName); +S_API bool SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime(intptr_t instancePtr, const char * pchName, bool * pbAchieved, uint32 * punUnlockTime); +S_API bool SteamAPI_ISteamUserStats_StoreStats(intptr_t instancePtr); +S_API int SteamAPI_ISteamUserStats_GetAchievementIcon(intptr_t instancePtr, const char * pchName); +S_API const char * SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute(intptr_t instancePtr, const char * pchName, const char * pchKey); +S_API bool SteamAPI_ISteamUserStats_IndicateAchievementProgress(intptr_t instancePtr, const char * pchName, uint32 nCurProgress, uint32 nMaxProgress); +S_API uint32 SteamAPI_ISteamUserStats_GetNumAchievements(intptr_t instancePtr); +S_API const char * SteamAPI_ISteamUserStats_GetAchievementName(intptr_t instancePtr, uint32 iAchievement); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_RequestUserStats(intptr_t instancePtr, class CSteamID steamIDUser); +S_API bool SteamAPI_ISteamUserStats_GetUserStat(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, int32 * pData); +S_API bool SteamAPI_ISteamUserStats_GetUserStat0(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, float * pData); +S_API bool SteamAPI_ISteamUserStats_GetUserAchievement(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, bool * pbAchieved); +S_API bool SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, bool * pbAchieved, uint32 * punUnlockTime); +S_API bool SteamAPI_ISteamUserStats_ResetAllStats(intptr_t instancePtr, bool bAchievementsToo); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_FindOrCreateLeaderboard(intptr_t instancePtr, const char * pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_FindLeaderboard(intptr_t instancePtr, const char * pchLeaderboardName); +S_API const char * SteamAPI_ISteamUserStats_GetLeaderboardName(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard); +S_API int SteamAPI_ISteamUserStats_GetLeaderboardEntryCount(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard); +S_API ELeaderboardSortMethod SteamAPI_ISteamUserStats_GetLeaderboardSortMethod(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard); +S_API ELeaderboardDisplayType SteamAPI_ISteamUserStats_GetLeaderboardDisplayType(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_DownloadLeaderboardEntries(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard, class CSteamID * prgUsers, int cUsers); +S_API bool SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry(intptr_t instancePtr, SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, struct LeaderboardEntry_t * pLeaderboardEntry, int32 * pDetails, int cDetailsMax); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_UploadLeaderboardScore(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 * pScoreDetails, int cScoreDetailsCount); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_AttachLeaderboardUGC(intptr_t instancePtr, SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers(intptr_t instancePtr); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages(intptr_t instancePtr); +S_API int SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo(intptr_t instancePtr, char * pchName, uint32 unNameBufLen, float * pflPercent, bool * pbAchieved); +S_API int SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo(intptr_t instancePtr, int iIteratorPrevious, char * pchName, uint32 unNameBufLen, float * pflPercent, bool * pbAchieved); +S_API bool SteamAPI_ISteamUserStats_GetAchievementAchievedPercent(intptr_t instancePtr, const char * pchName, float * pflPercent); +S_API SteamAPICall_t SteamAPI_ISteamUserStats_RequestGlobalStats(intptr_t instancePtr, int nHistoryDays); +S_API bool SteamAPI_ISteamUserStats_GetGlobalStat(intptr_t instancePtr, const char * pchStatName, int64 * pData); +S_API bool SteamAPI_ISteamUserStats_GetGlobalStat0(intptr_t instancePtr, const char * pchStatName, double * pData); +S_API int32 SteamAPI_ISteamUserStats_GetGlobalStatHistory(intptr_t instancePtr, const char * pchStatName, int64 * pData, uint32 cubData); +S_API int32 SteamAPI_ISteamUserStats_GetGlobalStatHistory0(intptr_t instancePtr, const char * pchStatName, double * pData, uint32 cubData); +S_API bool SteamAPI_ISteamApps_BIsSubscribed(intptr_t instancePtr); +S_API bool SteamAPI_ISteamApps_BIsLowViolence(intptr_t instancePtr); +S_API bool SteamAPI_ISteamApps_BIsCybercafe(intptr_t instancePtr); +S_API bool SteamAPI_ISteamApps_BIsVACBanned(intptr_t instancePtr); +S_API const char * SteamAPI_ISteamApps_GetCurrentGameLanguage(intptr_t instancePtr); +S_API const char * SteamAPI_ISteamApps_GetAvailableGameLanguages(intptr_t instancePtr); +S_API bool SteamAPI_ISteamApps_BIsSubscribedApp(intptr_t instancePtr, AppId_t appID); +S_API bool SteamAPI_ISteamApps_BIsDlcInstalled(intptr_t instancePtr, AppId_t appID); +S_API uint32 SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime(intptr_t instancePtr, AppId_t nAppID); +S_API bool SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend(intptr_t instancePtr); +S_API int SteamAPI_ISteamApps_GetDLCCount(intptr_t instancePtr); +S_API bool SteamAPI_ISteamApps_BGetDLCDataByIndex(intptr_t instancePtr, int iDLC, AppId_t * pAppID, bool * pbAvailable, char * pchName, int cchNameBufferSize); +S_API void SteamAPI_ISteamApps_InstallDLC(intptr_t instancePtr, AppId_t nAppID); +S_API void SteamAPI_ISteamApps_UninstallDLC(intptr_t instancePtr, AppId_t nAppID); +S_API void SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey(intptr_t instancePtr, AppId_t nAppID); +S_API bool SteamAPI_ISteamApps_GetCurrentBetaName(intptr_t instancePtr, char * pchName, int cchNameBufferSize); +S_API bool SteamAPI_ISteamApps_MarkContentCorrupt(intptr_t instancePtr, bool bMissingFilesOnly); +S_API uint32 SteamAPI_ISteamApps_GetInstalledDepots(intptr_t instancePtr, AppId_t appID, DepotId_t * pvecDepots, uint32 cMaxDepots); +S_API uint32 SteamAPI_ISteamApps_GetAppInstallDir(intptr_t instancePtr, AppId_t appID, char * pchFolder, uint32 cchFolderBufferSize); +S_API bool SteamAPI_ISteamApps_BIsAppInstalled(intptr_t instancePtr, AppId_t appID); +S_API uint64 SteamAPI_ISteamApps_GetAppOwner(intptr_t instancePtr); +S_API const char * SteamAPI_ISteamApps_GetLaunchQueryParam(intptr_t instancePtr, const char * pchKey); +S_API bool SteamAPI_ISteamApps_GetDlcDownloadProgress(intptr_t instancePtr, AppId_t nAppID, uint64 * punBytesDownloaded, uint64 * punBytesTotal); +S_API int SteamAPI_ISteamApps_GetAppBuildId(intptr_t instancePtr); +S_API bool SteamAPI_ISteamNetworking_SendP2PPacket(intptr_t instancePtr, class CSteamID steamIDRemote, const void * pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel); +S_API bool SteamAPI_ISteamNetworking_IsP2PPacketAvailable(intptr_t instancePtr, uint32 * pcubMsgSize, int nChannel); +S_API bool SteamAPI_ISteamNetworking_ReadP2PPacket(intptr_t instancePtr, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize, class CSteamID * psteamIDRemote, int nChannel); +S_API bool SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser(intptr_t instancePtr, class CSteamID steamIDRemote); +S_API bool SteamAPI_ISteamNetworking_CloseP2PSessionWithUser(intptr_t instancePtr, class CSteamID steamIDRemote); +S_API bool SteamAPI_ISteamNetworking_CloseP2PChannelWithUser(intptr_t instancePtr, class CSteamID steamIDRemote, int nChannel); +S_API bool SteamAPI_ISteamNetworking_GetP2PSessionState(intptr_t instancePtr, class CSteamID steamIDRemote, struct P2PSessionState_t * pConnectionState); +S_API bool SteamAPI_ISteamNetworking_AllowP2PPacketRelay(intptr_t instancePtr, bool bAllow); +S_API SNetListenSocket_t SteamAPI_ISteamNetworking_CreateListenSocket(intptr_t instancePtr, int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay); +S_API SNetSocket_t SteamAPI_ISteamNetworking_CreateP2PConnectionSocket(intptr_t instancePtr, class CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay); +S_API SNetSocket_t SteamAPI_ISteamNetworking_CreateConnectionSocket(intptr_t instancePtr, uint32 nIP, uint16 nPort, int nTimeoutSec); +S_API bool SteamAPI_ISteamNetworking_DestroySocket(intptr_t instancePtr, SNetSocket_t hSocket, bool bNotifyRemoteEnd); +S_API bool SteamAPI_ISteamNetworking_DestroyListenSocket(intptr_t instancePtr, SNetListenSocket_t hSocket, bool bNotifyRemoteEnd); +S_API bool SteamAPI_ISteamNetworking_SendDataOnSocket(intptr_t instancePtr, SNetSocket_t hSocket, void * pubData, uint32 cubData, bool bReliable); +S_API bool SteamAPI_ISteamNetworking_IsDataAvailableOnSocket(intptr_t instancePtr, SNetSocket_t hSocket, uint32 * pcubMsgSize); +S_API bool SteamAPI_ISteamNetworking_RetrieveDataFromSocket(intptr_t instancePtr, SNetSocket_t hSocket, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize); +S_API bool SteamAPI_ISteamNetworking_IsDataAvailable(intptr_t instancePtr, SNetListenSocket_t hListenSocket, uint32 * pcubMsgSize, SNetSocket_t * phSocket); +S_API bool SteamAPI_ISteamNetworking_RetrieveData(intptr_t instancePtr, SNetListenSocket_t hListenSocket, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize, SNetSocket_t * phSocket); +S_API bool SteamAPI_ISteamNetworking_GetSocketInfo(intptr_t instancePtr, SNetSocket_t hSocket, class CSteamID * pSteamIDRemote, int * peSocketStatus, uint32 * punIPRemote, uint16 * punPortRemote); +S_API bool SteamAPI_ISteamNetworking_GetListenSocketInfo(intptr_t instancePtr, SNetListenSocket_t hListenSocket, uint32 * pnIP, uint16 * pnPort); +S_API ESNetSocketConnectionType SteamAPI_ISteamNetworking_GetSocketConnectionType(intptr_t instancePtr, SNetSocket_t hSocket); +S_API int SteamAPI_ISteamNetworking_GetMaxPacketSize(intptr_t instancePtr, SNetSocket_t hSocket); +S_API ScreenshotHandle SteamAPI_ISteamScreenshots_WriteScreenshot(intptr_t instancePtr, void * pubRGB, uint32 cubRGB, int nWidth, int nHeight); +S_API ScreenshotHandle SteamAPI_ISteamScreenshots_AddScreenshotToLibrary(intptr_t instancePtr, const char * pchFilename, const char * pchThumbnailFilename, int nWidth, int nHeight); +S_API void SteamAPI_ISteamScreenshots_TriggerScreenshot(intptr_t instancePtr); +S_API void SteamAPI_ISteamScreenshots_HookScreenshots(intptr_t instancePtr, bool bHook); +S_API bool SteamAPI_ISteamScreenshots_SetLocation(intptr_t instancePtr, ScreenshotHandle hScreenshot, const char * pchLocation); +S_API bool SteamAPI_ISteamScreenshots_TagUser(intptr_t instancePtr, ScreenshotHandle hScreenshot, class CSteamID steamID); +S_API bool SteamAPI_ISteamScreenshots_TagPublishedFile(intptr_t instancePtr, ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID); +S_API bool SteamAPI_ISteamMusic_BIsEnabled(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusic_BIsPlaying(intptr_t instancePtr); +S_API AudioPlayback_Status SteamAPI_ISteamMusic_GetPlaybackStatus(intptr_t instancePtr); +S_API void SteamAPI_ISteamMusic_Play(intptr_t instancePtr); +S_API void SteamAPI_ISteamMusic_Pause(intptr_t instancePtr); +S_API void SteamAPI_ISteamMusic_PlayPrevious(intptr_t instancePtr); +S_API void SteamAPI_ISteamMusic_PlayNext(intptr_t instancePtr); +S_API void SteamAPI_ISteamMusic_SetVolume(intptr_t instancePtr, float flVolume); +S_API float SteamAPI_ISteamMusic_GetVolume(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote(intptr_t instancePtr, const char * pchName); +S_API bool SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_BActivationSuccess(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_SetDisplayName(intptr_t instancePtr, const char * pchDisplayName); +S_API bool SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64(intptr_t instancePtr, void * pvBuffer, uint32 cbBufferLength); +S_API bool SteamAPI_ISteamMusicRemote_EnablePlayPrevious(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_EnablePlayNext(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_EnableShuffled(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_EnableLooped(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_EnableQueue(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_EnablePlaylists(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus(intptr_t instancePtr, AudioPlayback_Status nStatus); +S_API bool SteamAPI_ISteamMusicRemote_UpdateShuffled(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_UpdateLooped(intptr_t instancePtr, bool bValue); +S_API bool SteamAPI_ISteamMusicRemote_UpdateVolume(intptr_t instancePtr, float flValue); +S_API bool SteamAPI_ISteamMusicRemote_CurrentEntryWillChange(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable(intptr_t instancePtr, bool bAvailable); +S_API bool SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText(intptr_t instancePtr, const char * pchText); +S_API bool SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds(intptr_t instancePtr, int nValue); +S_API bool SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt(intptr_t instancePtr, void * pvBuffer, uint32 cbBufferLength); +S_API bool SteamAPI_ISteamMusicRemote_CurrentEntryDidChange(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_QueueWillChange(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_ResetQueueEntries(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_SetQueueEntry(intptr_t instancePtr, int nID, int nPosition, const char * pchEntryText); +S_API bool SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry(intptr_t instancePtr, int nID); +S_API bool SteamAPI_ISteamMusicRemote_QueueDidChange(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_PlaylistWillChange(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_ResetPlaylistEntries(intptr_t instancePtr); +S_API bool SteamAPI_ISteamMusicRemote_SetPlaylistEntry(intptr_t instancePtr, int nID, int nPosition, const char * pchEntryText); +S_API bool SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry(intptr_t instancePtr, int nID); +S_API bool SteamAPI_ISteamMusicRemote_PlaylistDidChange(intptr_t instancePtr); +S_API HTTPRequestHandle SteamAPI_ISteamHTTP_CreateHTTPRequest(intptr_t instancePtr, EHTTPMethod eHTTPRequestMethod, const char * pchAbsoluteURL); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestContextValue(intptr_t instancePtr, HTTPRequestHandle hRequest, uint64 ulContextValue); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(intptr_t instancePtr, HTTPRequestHandle hRequest, uint32 unTimeoutSeconds); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue(intptr_t instancePtr, HTTPRequestHandle hRequest, const char * pchHeaderName, const char * pchHeaderValue); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter(intptr_t instancePtr, HTTPRequestHandle hRequest, const char * pchParamName, const char * pchParamValue); +S_API bool SteamAPI_ISteamHTTP_SendHTTPRequest(intptr_t instancePtr, HTTPRequestHandle hRequest, SteamAPICall_t * pCallHandle); +S_API bool SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse(intptr_t instancePtr, HTTPRequestHandle hRequest, SteamAPICall_t * pCallHandle); +S_API bool SteamAPI_ISteamHTTP_DeferHTTPRequest(intptr_t instancePtr, HTTPRequestHandle hRequest); +S_API bool SteamAPI_ISteamHTTP_PrioritizeHTTPRequest(intptr_t instancePtr, HTTPRequestHandle hRequest); +S_API bool SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize(intptr_t instancePtr, HTTPRequestHandle hRequest, const char * pchHeaderName, uint32 * unResponseHeaderSize); +S_API bool SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue(intptr_t instancePtr, HTTPRequestHandle hRequest, const char * pchHeaderName, uint8 * pHeaderValueBuffer, uint32 unBufferSize); +S_API bool SteamAPI_ISteamHTTP_GetHTTPResponseBodySize(intptr_t instancePtr, HTTPRequestHandle hRequest, uint32 * unBodySize); +S_API bool SteamAPI_ISteamHTTP_GetHTTPResponseBodyData(intptr_t instancePtr, HTTPRequestHandle hRequest, uint8 * pBodyDataBuffer, uint32 unBufferSize); +S_API bool SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData(intptr_t instancePtr, HTTPRequestHandle hRequest, uint32 cOffset, uint8 * pBodyDataBuffer, uint32 unBufferSize); +S_API bool SteamAPI_ISteamHTTP_ReleaseHTTPRequest(intptr_t instancePtr, HTTPRequestHandle hRequest); +S_API bool SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct(intptr_t instancePtr, HTTPRequestHandle hRequest, float * pflPercentOut); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody(intptr_t instancePtr, HTTPRequestHandle hRequest, const char * pchContentType, uint8 * pubBody, uint32 unBodyLen); +S_API HTTPCookieContainerHandle SteamAPI_ISteamHTTP_CreateCookieContainer(intptr_t instancePtr, bool bAllowResponsesToModify); +S_API bool SteamAPI_ISteamHTTP_ReleaseCookieContainer(intptr_t instancePtr, HTTPCookieContainerHandle hCookieContainer); +S_API bool SteamAPI_ISteamHTTP_SetCookie(intptr_t instancePtr, HTTPCookieContainerHandle hCookieContainer, const char * pchHost, const char * pchUrl, const char * pchCookie); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer(intptr_t instancePtr, HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo(intptr_t instancePtr, HTTPRequestHandle hRequest, const char * pchUserAgentInfo); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(intptr_t instancePtr, HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate); +S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(intptr_t instancePtr, HTTPRequestHandle hRequest, uint32 unMilliseconds); +S_API bool SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut(intptr_t instancePtr, HTTPRequestHandle hRequest, bool * pbWasTimedOut); +S_API ClientUnifiedMessageHandle SteamAPI_ISteamUnifiedMessages_SendMethod(intptr_t instancePtr, const char * pchServiceMethod, const void * pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext); +S_API bool SteamAPI_ISteamUnifiedMessages_GetMethodResponseInfo(intptr_t instancePtr, ClientUnifiedMessageHandle hHandle, uint32 * punResponseSize, EResult * peResult); +S_API bool SteamAPI_ISteamUnifiedMessages_GetMethodResponseData(intptr_t instancePtr, ClientUnifiedMessageHandle hHandle, void * pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease); +S_API bool SteamAPI_ISteamUnifiedMessages_ReleaseMethod(intptr_t instancePtr, ClientUnifiedMessageHandle hHandle); +S_API bool SteamAPI_ISteamUnifiedMessages_SendNotification(intptr_t instancePtr, const char * pchServiceNotification, const void * pNotificationBuffer, uint32 unNotificationBufferSize); +S_API bool SteamAPI_ISteamController_Init(intptr_t instancePtr); +S_API bool SteamAPI_ISteamController_Shutdown(intptr_t instancePtr); +S_API void SteamAPI_ISteamController_RunFrame(intptr_t instancePtr); +S_API int SteamAPI_ISteamController_GetConnectedControllers(intptr_t instancePtr, ControllerHandle_t * handlesOut); +S_API bool SteamAPI_ISteamController_ShowBindingPanel(intptr_t instancePtr, ControllerHandle_t controllerHandle); +S_API ControllerActionSetHandle_t SteamAPI_ISteamController_GetActionSetHandle(intptr_t instancePtr, const char * pszActionSetName); +S_API void SteamAPI_ISteamController_ActivateActionSet(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle); +S_API ControllerActionSetHandle_t SteamAPI_ISteamController_GetCurrentActionSet(intptr_t instancePtr, ControllerHandle_t controllerHandle); +S_API ControllerDigitalActionHandle_t SteamAPI_ISteamController_GetDigitalActionHandle(intptr_t instancePtr, const char * pszActionName); +S_API struct ControllerDigitalActionData_t SteamAPI_ISteamController_GetDigitalActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle); +S_API int SteamAPI_ISteamController_GetDigitalActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin * originsOut); +S_API ControllerAnalogActionHandle_t SteamAPI_ISteamController_GetAnalogActionHandle(intptr_t instancePtr, const char * pszActionName); +S_API struct ControllerAnalogActionData_t SteamAPI_ISteamController_GetAnalogActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle); +S_API int SteamAPI_ISteamController_GetAnalogActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin * originsOut); +S_API void SteamAPI_ISteamController_StopAnalogActionMomentum(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction); +S_API void SteamAPI_ISteamController_TriggerHapticPulse(intptr_t instancePtr, ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec); +S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(intptr_t instancePtr, AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage); +S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequest(intptr_t instancePtr, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage); +S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(intptr_t instancePtr, PublishedFileId_t * pvecPublishedFileID, uint32 unNumPublishedFileIDs); +S_API SteamAPICall_t SteamAPI_ISteamUGC_SendQueryUGCRequest(intptr_t instancePtr, UGCQueryHandle_t handle); +S_API bool SteamAPI_ISteamUGC_GetQueryUGCResult(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, struct SteamUGCDetails_t * pDetails); +S_API bool SteamAPI_ISteamUGC_GetQueryUGCPreviewURL(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, char * pchURL, uint32 cchURLSize); +S_API bool SteamAPI_ISteamUGC_GetQueryUGCMetadata(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, char * pchMetadata, uint32 cchMetadatasize); +S_API bool SteamAPI_ISteamUGC_GetQueryUGCChildren(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, PublishedFileId_t * pvecPublishedFileID, uint32 cMaxEntries); +S_API bool SteamAPI_ISteamUGC_GetQueryUGCStatistic(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint32 * pStatValue); +S_API uint32 SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index); +S_API bool SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, char * pchURLOrVideoID, uint32 cchURLSize, bool * pbIsImage); +S_API uint32 SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index); +S_API bool SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, char * pchKey, uint32 cchKeySize, char * pchValue, uint32 cchValueSize); +S_API bool SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(intptr_t instancePtr, UGCQueryHandle_t handle); +S_API bool SteamAPI_ISteamUGC_AddRequiredTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName); +S_API bool SteamAPI_ISteamUGC_AddExcludedTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName); +S_API bool SteamAPI_ISteamUGC_SetReturnKeyValueTags(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnKeyValueTags); +S_API bool SteamAPI_ISteamUGC_SetReturnLongDescription(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnLongDescription); +S_API bool SteamAPI_ISteamUGC_SetReturnMetadata(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnMetadata); +S_API bool SteamAPI_ISteamUGC_SetReturnChildren(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnChildren); +S_API bool SteamAPI_ISteamUGC_SetReturnAdditionalPreviews(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnAdditionalPreviews); +S_API bool SteamAPI_ISteamUGC_SetReturnTotalOnly(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnTotalOnly); +S_API bool SteamAPI_ISteamUGC_SetLanguage(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pchLanguage); +S_API bool SteamAPI_ISteamUGC_SetAllowCachedResponse(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 unMaxAgeSeconds); +S_API bool SteamAPI_ISteamUGC_SetCloudFileNameFilter(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pMatchCloudFileName); +S_API bool SteamAPI_ISteamUGC_SetMatchAnyTag(intptr_t instancePtr, UGCQueryHandle_t handle, bool bMatchAnyTag); +S_API bool SteamAPI_ISteamUGC_SetSearchText(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pSearchText); +S_API bool SteamAPI_ISteamUGC_SetRankedByTrendDays(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 unDays); +S_API bool SteamAPI_ISteamUGC_AddRequiredKeyValueTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pKey, const char * pValue); +S_API SteamAPICall_t SteamAPI_ISteamUGC_RequestUGCDetails(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds); +S_API SteamAPICall_t SteamAPI_ISteamUGC_CreateItem(intptr_t instancePtr, AppId_t nConsumerAppId, EWorkshopFileType eFileType); +S_API UGCUpdateHandle_t SteamAPI_ISteamUGC_StartItemUpdate(intptr_t instancePtr, AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID); +S_API bool SteamAPI_ISteamUGC_SetItemTitle(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchTitle); +S_API bool SteamAPI_ISteamUGC_SetItemDescription(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchDescription); +S_API bool SteamAPI_ISteamUGC_SetItemUpdateLanguage(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchLanguage); +S_API bool SteamAPI_ISteamUGC_SetItemMetadata(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchMetaData); +S_API bool SteamAPI_ISteamUGC_SetItemVisibility(intptr_t instancePtr, UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility); +S_API bool SteamAPI_ISteamUGC_SetItemTags(intptr_t instancePtr, UGCUpdateHandle_t updateHandle, const struct SteamParamStringArray_t * pTags); +S_API bool SteamAPI_ISteamUGC_SetItemContent(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pszContentFolder); +S_API bool SteamAPI_ISteamUGC_SetItemPreview(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pszPreviewFile); +S_API bool SteamAPI_ISteamUGC_RemoveItemKeyValueTags(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchKey); +S_API bool SteamAPI_ISteamUGC_AddItemKeyValueTag(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchKey, const char * pchValue); +S_API SteamAPICall_t SteamAPI_ISteamUGC_SubmitItemUpdate(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchChangeNote); +S_API EItemUpdateStatus SteamAPI_ISteamUGC_GetItemUpdateProgress(intptr_t instancePtr, UGCUpdateHandle_t handle, uint64 * punBytesProcessed, uint64 * punBytesTotal); +S_API SteamAPICall_t SteamAPI_ISteamUGC_SetUserItemVote(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, bool bVoteUp); +S_API SteamAPICall_t SteamAPI_ISteamUGC_GetUserItemVote(intptr_t instancePtr, PublishedFileId_t nPublishedFileID); +S_API SteamAPICall_t SteamAPI_ISteamUGC_AddItemToFavorites(intptr_t instancePtr, AppId_t nAppId, PublishedFileId_t nPublishedFileID); +S_API SteamAPICall_t SteamAPI_ISteamUGC_RemoveItemFromFavorites(intptr_t instancePtr, AppId_t nAppId, PublishedFileId_t nPublishedFileID); +S_API SteamAPICall_t SteamAPI_ISteamUGC_SubscribeItem(intptr_t instancePtr, PublishedFileId_t nPublishedFileID); +S_API SteamAPICall_t SteamAPI_ISteamUGC_UnsubscribeItem(intptr_t instancePtr, PublishedFileId_t nPublishedFileID); +S_API uint32 SteamAPI_ISteamUGC_GetNumSubscribedItems(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamUGC_GetSubscribedItems(intptr_t instancePtr, PublishedFileId_t * pvecPublishedFileID, uint32 cMaxEntries); +S_API uint32 SteamAPI_ISteamUGC_GetItemState(intptr_t instancePtr, PublishedFileId_t nPublishedFileID); +S_API bool SteamAPI_ISteamUGC_GetItemInstallInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint64 * punSizeOnDisk, char * pchFolder, uint32 cchFolderSize, uint32 * punTimeStamp); +S_API bool SteamAPI_ISteamUGC_GetItemDownloadInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint64 * punBytesDownloaded, uint64 * punBytesTotal); +S_API bool SteamAPI_ISteamUGC_DownloadItem(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, bool bHighPriority); +S_API bool SteamAPI_ISteamUGC_BInitWorkshopForGameServer(intptr_t instancePtr, DepotId_t unWorkshopDepotID, const char * pszFolder); +S_API void SteamAPI_ISteamUGC_SuspendDownloads(intptr_t instancePtr, bool bSuspend); +S_API uint32 SteamAPI_ISteamAppList_GetNumInstalledApps(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamAppList_GetInstalledApps(intptr_t instancePtr, AppId_t * pvecAppID, uint32 unMaxAppIDs); +S_API int SteamAPI_ISteamAppList_GetAppName(intptr_t instancePtr, AppId_t nAppID, char * pchName, int cchNameMax); +S_API int SteamAPI_ISteamAppList_GetAppInstallDir(intptr_t instancePtr, AppId_t nAppID, char * pchDirectory, int cchNameMax); +S_API int SteamAPI_ISteamAppList_GetAppBuildId(intptr_t instancePtr, AppId_t nAppID); +S_API void SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface(intptr_t instancePtr); +S_API bool SteamAPI_ISteamHTMLSurface_Init(intptr_t instancePtr); +S_API bool SteamAPI_ISteamHTMLSurface_Shutdown(intptr_t instancePtr); +S_API SteamAPICall_t SteamAPI_ISteamHTMLSurface_CreateBrowser(intptr_t instancePtr, const char * pchUserAgent, const char * pchUserCSS); +S_API void SteamAPI_ISteamHTMLSurface_RemoveBrowser(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_LoadURL(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, const char * pchURL, const char * pchPostData); +S_API void SteamAPI_ISteamHTMLSurface_SetSize(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight); +S_API void SteamAPI_ISteamHTMLSurface_StopLoad(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_Reload(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_GoBack(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_GoForward(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_AddHeader(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, const char * pchKey, const char * pchValue); +S_API void SteamAPI_ISteamHTMLSurface_ExecuteJavascript(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, const char * pchScript); +S_API void SteamAPI_ISteamHTMLSurface_MouseUp(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, ISteamHTMLSurface::EHTMLMouseButton eMouseButton); +S_API void SteamAPI_ISteamHTMLSurface_MouseDown(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, ISteamHTMLSurface::EHTMLMouseButton eMouseButton); +S_API void SteamAPI_ISteamHTMLSurface_MouseDoubleClick(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, ISteamHTMLSurface::EHTMLMouseButton eMouseButton); +S_API void SteamAPI_ISteamHTMLSurface_MouseMove(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, int x, int y); +S_API void SteamAPI_ISteamHTMLSurface_MouseWheel(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, int32 nDelta); +S_API void SteamAPI_ISteamHTMLSurface_KeyDown(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, ISteamHTMLSurface::EHTMLKeyModifiers eHTMLKeyModifiers); +S_API void SteamAPI_ISteamHTMLSurface_KeyUp(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, ISteamHTMLSurface::EHTMLKeyModifiers eHTMLKeyModifiers); +S_API void SteamAPI_ISteamHTMLSurface_KeyChar(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, ISteamHTMLSurface::EHTMLKeyModifiers eHTMLKeyModifiers); +S_API void SteamAPI_ISteamHTMLSurface_SetHorizontalScroll(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll); +S_API void SteamAPI_ISteamHTMLSurface_SetVerticalScroll(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll); +S_API void SteamAPI_ISteamHTMLSurface_SetKeyFocus(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, bool bHasKeyFocus); +S_API void SteamAPI_ISteamHTMLSurface_ViewSource(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_CopyToClipboard(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_PasteFromClipboard(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_Find(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, const char * pchSearchStr, bool bCurrentlyInFind, bool bReverse); +S_API void SteamAPI_ISteamHTMLSurface_StopFind(intptr_t instancePtr, HHTMLBrowser unBrowserHandle); +S_API void SteamAPI_ISteamHTMLSurface_GetLinkAtPosition(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, int x, int y); +S_API void SteamAPI_ISteamHTMLSurface_SetCookie(intptr_t instancePtr, const char * pchHostname, const char * pchKey, const char * pchValue, const char * pchPath, RTime32 nExpires, bool bSecure, bool bHTTPOnly); +S_API void SteamAPI_ISteamHTMLSurface_SetPageScaleFactor(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY); +S_API void SteamAPI_ISteamHTMLSurface_SetBackgroundMode(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, bool bBackgroundMode); +S_API void SteamAPI_ISteamHTMLSurface_AllowStartRequest(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, bool bAllowed); +S_API void SteamAPI_ISteamHTMLSurface_JSDialogResponse(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, bool bResult); +S_API void SteamAPI_ISteamHTMLSurface_FileLoadDialogResponse(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, const char ** pchSelectedFiles); +S_API EResult SteamAPI_ISteamInventory_GetResultStatus(intptr_t instancePtr, SteamInventoryResult_t resultHandle); +S_API bool SteamAPI_ISteamInventory_GetResultItems(intptr_t instancePtr, SteamInventoryResult_t resultHandle, struct SteamItemDetails_t * pOutItemsArray, uint32 * punOutItemsArraySize); +S_API uint32 SteamAPI_ISteamInventory_GetResultTimestamp(intptr_t instancePtr, SteamInventoryResult_t resultHandle); +S_API bool SteamAPI_ISteamInventory_CheckResultSteamID(intptr_t instancePtr, SteamInventoryResult_t resultHandle, class CSteamID steamIDExpected); +S_API void SteamAPI_ISteamInventory_DestroyResult(intptr_t instancePtr, SteamInventoryResult_t resultHandle); +S_API bool SteamAPI_ISteamInventory_GetAllItems(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle); +S_API bool SteamAPI_ISteamInventory_GetItemsByID(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, const SteamItemInstanceID_t * pInstanceIDs, uint32 unCountInstanceIDs); +S_API bool SteamAPI_ISteamInventory_SerializeResult(intptr_t instancePtr, SteamInventoryResult_t resultHandle, void * pOutBuffer, uint32 * punOutBufferSize); +S_API bool SteamAPI_ISteamInventory_DeserializeResult(intptr_t instancePtr, SteamInventoryResult_t * pOutResultHandle, const void * pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE); +S_API bool SteamAPI_ISteamInventory_GenerateItems(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, const SteamItemDef_t * pArrayItemDefs, const uint32 * punArrayQuantity, uint32 unArrayLength); +S_API bool SteamAPI_ISteamInventory_GrantPromoItems(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle); +S_API bool SteamAPI_ISteamInventory_AddPromoItem(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, SteamItemDef_t itemDef); +S_API bool SteamAPI_ISteamInventory_AddPromoItems(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, const SteamItemDef_t * pArrayItemDefs, uint32 unArrayLength); +S_API bool SteamAPI_ISteamInventory_ConsumeItem(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity); +S_API bool SteamAPI_ISteamInventory_ExchangeItems(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, const SteamItemDef_t * pArrayGenerate, const uint32 * punArrayGenerateQuantity, uint32 unArrayGenerateLength, const SteamItemInstanceID_t * pArrayDestroy, const uint32 * punArrayDestroyQuantity, uint32 unArrayDestroyLength); +S_API bool SteamAPI_ISteamInventory_TransferItemQuantity(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest); +S_API void SteamAPI_ISteamInventory_SendItemDropHeartbeat(intptr_t instancePtr); +S_API bool SteamAPI_ISteamInventory_TriggerItemDrop(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, SteamItemDef_t dropListDefinition); +S_API bool SteamAPI_ISteamInventory_TradeItems(intptr_t instancePtr, SteamInventoryResult_t * pResultHandle, class CSteamID steamIDTradePartner, const SteamItemInstanceID_t * pArrayGive, const uint32 * pArrayGiveQuantity, uint32 nArrayGiveLength, const SteamItemInstanceID_t * pArrayGet, const uint32 * pArrayGetQuantity, uint32 nArrayGetLength); +S_API bool SteamAPI_ISteamInventory_LoadItemDefinitions(intptr_t instancePtr); +S_API bool SteamAPI_ISteamInventory_GetItemDefinitionIDs(intptr_t instancePtr, SteamItemDef_t * pItemDefIDs, uint32 * punItemDefIDsArraySize); +S_API bool SteamAPI_ISteamInventory_GetItemDefinitionProperty(intptr_t instancePtr, SteamItemDef_t iDefinition, const char * pchPropertyName, char * pchValueBuffer, uint32 * punValueBufferSize); +S_API void SteamAPI_ISteamVideo_GetVideoURL(intptr_t instancePtr, AppId_t unVideoAppID); +S_API bool SteamAPI_ISteamVideo_IsBroadcasting(intptr_t instancePtr, int * pnNumViewers); +S_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char * pchVersionString); +S_API void SteamAPI_ISteamGameServer_SetProduct(intptr_t instancePtr, const char * pszProduct); +S_API void SteamAPI_ISteamGameServer_SetGameDescription(intptr_t instancePtr, const char * pszGameDescription); +S_API void SteamAPI_ISteamGameServer_SetModDir(intptr_t instancePtr, const char * pszModDir); +S_API void SteamAPI_ISteamGameServer_SetDedicatedServer(intptr_t instancePtr, bool bDedicated); +S_API void SteamAPI_ISteamGameServer_LogOn(intptr_t instancePtr, const char * pszToken); +S_API void SteamAPI_ISteamGameServer_LogOnAnonymous(intptr_t instancePtr); +S_API void SteamAPI_ISteamGameServer_LogOff(intptr_t instancePtr); +S_API bool SteamAPI_ISteamGameServer_BLoggedOn(intptr_t instancePtr); +S_API bool SteamAPI_ISteamGameServer_BSecure(intptr_t instancePtr); +S_API uint64 SteamAPI_ISteamGameServer_GetSteamID(intptr_t instancePtr); +S_API bool SteamAPI_ISteamGameServer_WasRestartRequested(intptr_t instancePtr); +S_API void SteamAPI_ISteamGameServer_SetMaxPlayerCount(intptr_t instancePtr, int cPlayersMax); +S_API void SteamAPI_ISteamGameServer_SetBotPlayerCount(intptr_t instancePtr, int cBotplayers); +S_API void SteamAPI_ISteamGameServer_SetServerName(intptr_t instancePtr, const char * pszServerName); +S_API void SteamAPI_ISteamGameServer_SetMapName(intptr_t instancePtr, const char * pszMapName); +S_API void SteamAPI_ISteamGameServer_SetPasswordProtected(intptr_t instancePtr, bool bPasswordProtected); +S_API void SteamAPI_ISteamGameServer_SetSpectatorPort(intptr_t instancePtr, uint16 unSpectatorPort); +S_API void SteamAPI_ISteamGameServer_SetSpectatorServerName(intptr_t instancePtr, const char * pszSpectatorServerName); +S_API void SteamAPI_ISteamGameServer_ClearAllKeyValues(intptr_t instancePtr); +S_API void SteamAPI_ISteamGameServer_SetKeyValue(intptr_t instancePtr, const char * pKey, const char * pValue); +S_API void SteamAPI_ISteamGameServer_SetGameTags(intptr_t instancePtr, const char * pchGameTags); +S_API void SteamAPI_ISteamGameServer_SetGameData(intptr_t instancePtr, const char * pchGameData); +S_API void SteamAPI_ISteamGameServer_SetRegion(intptr_t instancePtr, const char * pszRegion); +S_API bool SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate(intptr_t instancePtr, uint32 unIPClient, const void * pvAuthBlob, uint32 cubAuthBlobSize, class CSteamID * pSteamIDUser); +S_API uint64 SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection(intptr_t instancePtr); +S_API void SteamAPI_ISteamGameServer_SendUserDisconnect(intptr_t instancePtr, class CSteamID steamIDUser); +S_API bool SteamAPI_ISteamGameServer_BUpdateUserData(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchPlayerName, uint32 uScore); +S_API HAuthTicket SteamAPI_ISteamGameServer_GetAuthSessionTicket(intptr_t instancePtr, void * pTicket, int cbMaxTicket, uint32 * pcbTicket); +S_API EBeginAuthSessionResult SteamAPI_ISteamGameServer_BeginAuthSession(intptr_t instancePtr, const void * pAuthTicket, int cbAuthTicket, class CSteamID steamID); +S_API void SteamAPI_ISteamGameServer_EndAuthSession(intptr_t instancePtr, class CSteamID steamID); +S_API void SteamAPI_ISteamGameServer_CancelAuthTicket(intptr_t instancePtr, HAuthTicket hAuthTicket); +S_API EUserHasLicenseForAppResult SteamAPI_ISteamGameServer_UserHasLicenseForApp(intptr_t instancePtr, class CSteamID steamID, AppId_t appID); +S_API bool SteamAPI_ISteamGameServer_RequestUserGroupStatus(intptr_t instancePtr, class CSteamID steamIDUser, class CSteamID steamIDGroup); +S_API void SteamAPI_ISteamGameServer_GetGameplayStats(intptr_t instancePtr); +S_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation(intptr_t instancePtr); +S_API uint32 SteamAPI_ISteamGameServer_GetPublicIP(intptr_t instancePtr); +S_API bool SteamAPI_ISteamGameServer_HandleIncomingPacket(intptr_t instancePtr, const void * pData, int cbData, uint32 srcIP, uint16 srcPort); +S_API int SteamAPI_ISteamGameServer_GetNextOutgoingPacket(intptr_t instancePtr, void * pOut, int cbMaxOut, uint32 * pNetAdr, uint16 * pPort); +S_API void SteamAPI_ISteamGameServer_EnableHeartbeats(intptr_t instancePtr, bool bActive); +S_API void SteamAPI_ISteamGameServer_SetHeartbeatInterval(intptr_t instancePtr, int iHeartbeatInterval); +S_API void SteamAPI_ISteamGameServer_ForceHeartbeat(intptr_t instancePtr); +S_API SteamAPICall_t SteamAPI_ISteamGameServer_AssociateWithClan(intptr_t instancePtr, class CSteamID steamIDClan); +S_API SteamAPICall_t SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility(intptr_t instancePtr, class CSteamID steamIDNewPlayer); +S_API SteamAPICall_t SteamAPI_ISteamGameServerStats_RequestUserStats(intptr_t instancePtr, class CSteamID steamIDUser); +S_API bool SteamAPI_ISteamGameServerStats_GetUserStat(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, int32 * pData); +S_API bool SteamAPI_ISteamGameServerStats_GetUserStat0(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, float * pData); +S_API bool SteamAPI_ISteamGameServerStats_GetUserAchievement(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, bool * pbAchieved); +S_API bool SteamAPI_ISteamGameServerStats_SetUserStat(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, int32 nData); +S_API bool SteamAPI_ISteamGameServerStats_SetUserStat0(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, float fData); +S_API bool SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName, float flCountThisSession, double dSessionLength); +S_API bool SteamAPI_ISteamGameServerStats_SetUserAchievement(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName); +S_API bool SteamAPI_ISteamGameServerStats_ClearUserAchievement(intptr_t instancePtr, class CSteamID steamIDUser, const char * pchName); +S_API SteamAPICall_t SteamAPI_ISteamGameServerStats_StoreUserStats(intptr_t instancePtr, class CSteamID steamIDUser); +#endif // STEAMAPIFLAT_H + + diff --git a/public/steam/steam_api_interop.cs b/public/steam/steam_api_interop.cs new file mode 100644 index 000000000..756186f58 --- /dev/null +++ b/public/steam/steam_api_interop.cs @@ -0,0 +1,8803 @@ +//=== === Copyright 1996-2014, Valve Corporation, All rights reserved. ======= +// +// Purpose: This file contains C#/managed code bindings for the SteamAPI interfaces +// This file is auto-generated, do not edit it. +// +//============================================================================= + +using System; +using System.Runtime.InteropServices; +using Valve.Steamworks; +using Valve.Interop; +using Valve.VR; + +namespace Valve.Interop +{ + +class NativeEntrypoints +{ + + +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_CreateSteamPipe")] +internal static extern uint SteamAPI_ISteamClient_CreateSteamPipe(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_BReleaseSteamPipe")] +internal static extern bool SteamAPI_ISteamClient_BReleaseSteamPipe(IntPtr instancePtr, uint hSteamPipe); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_ConnectToGlobalUser")] +internal static extern uint SteamAPI_ISteamClient_ConnectToGlobalUser(IntPtr instancePtr, uint hSteamPipe); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_CreateLocalUser")] +internal static extern uint SteamAPI_ISteamClient_CreateLocalUser(IntPtr instancePtr, ref uint phSteamPipe, uint eAccountType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_ReleaseUser")] +internal static extern void SteamAPI_ISteamClient_ReleaseUser(IntPtr instancePtr, uint hSteamPipe, uint hUser); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamUser")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUser(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamGameServer")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGameServer(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_SetLocalIPBinding")] +internal static extern void SteamAPI_ISteamClient_SetLocalIPBinding(IntPtr instancePtr, uint unIP, char usPort); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamFriends")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamFriends(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamUtils")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUtils(IntPtr instancePtr, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamMatchmaking")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMatchmaking(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamMatchmakingServers")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMatchmakingServers(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamGenericInterface")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGenericInterface(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamUserStats")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUserStats(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamGameServerStats")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGameServerStats(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamApps")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamApps(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamNetworking")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamNetworking(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamRemoteStorage")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamRemoteStorage(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamScreenshots")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamScreenshots(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_RunFrame")] +internal static extern void SteamAPI_ISteamClient_RunFrame(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetIPCCallCount")] +internal static extern uint SteamAPI_ISteamClient_GetIPCCallCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_SetWarningMessageHook")] +internal static extern void SteamAPI_ISteamClient_SetWarningMessageHook(IntPtr instancePtr, IntPtr pFunction); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_BShutdownIfAllPipesClosed")] +internal static extern bool SteamAPI_ISteamClient_BShutdownIfAllPipesClosed(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamHTTP")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamHTTP(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamUnifiedMessages")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUnifiedMessages(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamController")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamController(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamUGC")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUGC(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamAppList")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamAppList(IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamMusic")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMusic(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamMusicRemote")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMusicRemote(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamHTMLSurface")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamHTMLSurface(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_Set_SteamAPI_CPostAPIResultInProcess")] +internal static extern void SteamAPI_ISteamClient_Set_SteamAPI_CPostAPIResultInProcess(IntPtr instancePtr, IntPtr func); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_Remove_SteamAPI_CPostAPIResultInProcess")] +internal static extern void SteamAPI_ISteamClient_Remove_SteamAPI_CPostAPIResultInProcess(IntPtr instancePtr, IntPtr func); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_Set_SteamAPI_CCheckCallbackRegisteredInProcess")] +internal static extern void SteamAPI_ISteamClient_Set_SteamAPI_CCheckCallbackRegisteredInProcess(IntPtr instancePtr, IntPtr func); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamInventory")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamInventory(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamClient_GetISteamVideo")] +internal static extern IntPtr SteamAPI_ISteamClient_GetISteamVideo(IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetHSteamUser")] +internal static extern uint SteamAPI_ISteamUser_GetHSteamUser(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_BLoggedOn")] +internal static extern bool SteamAPI_ISteamUser_BLoggedOn(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetSteamID")] +internal static extern ulong SteamAPI_ISteamUser_GetSteamID(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_InitiateGameConnection")] +internal static extern int SteamAPI_ISteamUser_InitiateGameConnection(IntPtr instancePtr, IntPtr pAuthBlob, int cbMaxAuthBlob, ulong steamIDGameServer, uint unIPServer, char usPortServer, bool bSecure); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_TerminateGameConnection")] +internal static extern void SteamAPI_ISteamUser_TerminateGameConnection(IntPtr instancePtr, uint unIPServer, char usPortServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_TrackAppUsageEvent")] +internal static extern void SteamAPI_ISteamUser_TrackAppUsageEvent(IntPtr instancePtr, ulong gameID, int eAppUsageEvent, string pchExtraInfo); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetUserDataFolder")] +internal static extern bool SteamAPI_ISteamUser_GetUserDataFolder(IntPtr instancePtr, string pchBuffer, int cubBuffer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_StartVoiceRecording")] +internal static extern void SteamAPI_ISteamUser_StartVoiceRecording(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_StopVoiceRecording")] +internal static extern void SteamAPI_ISteamUser_StopVoiceRecording(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetAvailableVoice")] +internal static extern uint SteamAPI_ISteamUser_GetAvailableVoice(IntPtr instancePtr, ref uint pcbCompressed, ref uint pcbUncompressed, uint nUncompressedVoiceDesiredSampleRate); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetVoice")] +internal static extern uint SteamAPI_ISteamUser_GetVoice(IntPtr instancePtr, bool bWantCompressed, IntPtr pDestBuffer, uint cbDestBufferSize, ref uint nBytesWritten, bool bWantUncompressed, IntPtr pUncompressedDestBuffer, uint cbUncompressedDestBufferSize, ref uint nUncompressBytesWritten, uint nUncompressedVoiceDesiredSampleRate); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_DecompressVoice")] +internal static extern uint SteamAPI_ISteamUser_DecompressVoice(IntPtr instancePtr, IntPtr pCompressed, uint cbCompressed, IntPtr pDestBuffer, uint cbDestBufferSize, ref uint nBytesWritten, uint nDesiredSampleRate); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetVoiceOptimalSampleRate")] +internal static extern uint SteamAPI_ISteamUser_GetVoiceOptimalSampleRate(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetAuthSessionTicket")] +internal static extern uint SteamAPI_ISteamUser_GetAuthSessionTicket(IntPtr instancePtr, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_BeginAuthSession")] +internal static extern uint SteamAPI_ISteamUser_BeginAuthSession(IntPtr instancePtr, IntPtr pAuthTicket, int cbAuthTicket, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_EndAuthSession")] +internal static extern void SteamAPI_ISteamUser_EndAuthSession(IntPtr instancePtr, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_CancelAuthTicket")] +internal static extern void SteamAPI_ISteamUser_CancelAuthTicket(IntPtr instancePtr, uint hAuthTicket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_UserHasLicenseForApp")] +internal static extern uint SteamAPI_ISteamUser_UserHasLicenseForApp(IntPtr instancePtr, ulong steamID, uint appID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_BIsBehindNAT")] +internal static extern bool SteamAPI_ISteamUser_BIsBehindNAT(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_AdvertiseGame")] +internal static extern void SteamAPI_ISteamUser_AdvertiseGame(IntPtr instancePtr, ulong steamIDGameServer, uint unIPServer, char usPortServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_RequestEncryptedAppTicket")] +internal static extern ulong SteamAPI_ISteamUser_RequestEncryptedAppTicket(IntPtr instancePtr, IntPtr pDataToInclude, int cbDataToInclude); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetEncryptedAppTicket")] +internal static extern bool SteamAPI_ISteamUser_GetEncryptedAppTicket(IntPtr instancePtr, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetGameBadgeLevel")] +internal static extern int SteamAPI_ISteamUser_GetGameBadgeLevel(IntPtr instancePtr, int nSeries, bool bFoil); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_GetPlayerSteamLevel")] +internal static extern int SteamAPI_ISteamUser_GetPlayerSteamLevel(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUser_RequestStoreAuthURL")] +internal static extern ulong SteamAPI_ISteamUser_RequestStoreAuthURL(IntPtr instancePtr, string pchRedirectURL); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetPersonaName")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_SetPersonaName")] +internal static extern ulong SteamAPI_ISteamFriends_SetPersonaName(IntPtr instancePtr, string pchPersonaName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetPersonaState")] +internal static extern uint SteamAPI_ISteamFriends_GetPersonaState(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendCount")] +internal static extern int SteamAPI_ISteamFriends_GetFriendCount(IntPtr instancePtr, int iFriendFlags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendByIndex")] +internal static extern ulong SteamAPI_ISteamFriends_GetFriendByIndex(IntPtr instancePtr, int iFriend, int iFriendFlags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendRelationship")] +internal static extern uint SteamAPI_ISteamFriends_GetFriendRelationship(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendPersonaState")] +internal static extern uint SteamAPI_ISteamFriends_GetFriendPersonaState(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendPersonaName")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendGamePlayed")] +internal static extern bool SteamAPI_ISteamFriends_GetFriendGamePlayed(IntPtr instancePtr, ulong steamIDFriend, ref FriendGameInfo_t pFriendGameInfo); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendPersonaNameHistory")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory(IntPtr instancePtr, ulong steamIDFriend, int iPersonaName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendSteamLevel")] +internal static extern int SteamAPI_ISteamFriends_GetFriendSteamLevel(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetPlayerNickname")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname(IntPtr instancePtr, ulong steamIDPlayer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupCount")] +internal static extern int SteamAPI_ISteamFriends_GetFriendsGroupCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex")] +internal static extern char SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex(IntPtr instancePtr, int iFG); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupName")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName(IntPtr instancePtr, char friendsGroupID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupMembersCount")] +internal static extern int SteamAPI_ISteamFriends_GetFriendsGroupMembersCount(IntPtr instancePtr, char friendsGroupID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupMembersList")] +internal static extern void SteamAPI_ISteamFriends_GetFriendsGroupMembersList(IntPtr instancePtr, char friendsGroupID, [In, Out] CSteamID[] pOutSteamIDMembers, int nMembersCount); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_HasFriend")] +internal static extern bool SteamAPI_ISteamFriends_HasFriend(IntPtr instancePtr, ulong steamIDFriend, int iFriendFlags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanCount")] +internal static extern int SteamAPI_ISteamFriends_GetClanCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanByIndex")] +internal static extern ulong SteamAPI_ISteamFriends_GetClanByIndex(IntPtr instancePtr, int iClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanName")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanTag")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanActivityCounts")] +internal static extern bool SteamAPI_ISteamFriends_GetClanActivityCounts(IntPtr instancePtr, ulong steamIDClan, ref int pnOnline, ref int pnInGame, ref int pnChatting); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_DownloadClanActivityCounts")] +internal static extern ulong SteamAPI_ISteamFriends_DownloadClanActivityCounts(IntPtr instancePtr, [In, Out] CSteamID[] psteamIDClans, int cClansToRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendCountFromSource")] +internal static extern int SteamAPI_ISteamFriends_GetFriendCountFromSource(IntPtr instancePtr, ulong steamIDSource); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendFromSourceByIndex")] +internal static extern ulong SteamAPI_ISteamFriends_GetFriendFromSourceByIndex(IntPtr instancePtr, ulong steamIDSource, int iFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_IsUserInSource")] +internal static extern bool SteamAPI_ISteamFriends_IsUserInSource(IntPtr instancePtr, ulong steamIDUser, ulong steamIDSource); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_SetInGameVoiceSpeaking")] +internal static extern void SteamAPI_ISteamFriends_SetInGameVoiceSpeaking(IntPtr instancePtr, ulong steamIDUser, bool bSpeaking); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlay")] +internal static extern void SteamAPI_ISteamFriends_ActivateGameOverlay(IntPtr instancePtr, string pchDialog); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayToUser")] +internal static extern void SteamAPI_ISteamFriends_ActivateGameOverlayToUser(IntPtr instancePtr, string pchDialog, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage")] +internal static extern void SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(IntPtr instancePtr, string pchURL); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayToStore")] +internal static extern void SteamAPI_ISteamFriends_ActivateGameOverlayToStore(IntPtr instancePtr, uint nAppID, char eFlag); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_SetPlayedWith")] +internal static extern void SteamAPI_ISteamFriends_SetPlayedWith(IntPtr instancePtr, ulong steamIDUserPlayedWith); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog")] +internal static extern void SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetSmallFriendAvatar")] +internal static extern int SteamAPI_ISteamFriends_GetSmallFriendAvatar(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetMediumFriendAvatar")] +internal static extern int SteamAPI_ISteamFriends_GetMediumFriendAvatar(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetLargeFriendAvatar")] +internal static extern int SteamAPI_ISteamFriends_GetLargeFriendAvatar(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_RequestUserInformation")] +internal static extern bool SteamAPI_ISteamFriends_RequestUserInformation(IntPtr instancePtr, ulong steamIDUser, bool bRequireNameOnly); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_RequestClanOfficerList")] +internal static extern ulong SteamAPI_ISteamFriends_RequestClanOfficerList(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanOwner")] +internal static extern ulong SteamAPI_ISteamFriends_GetClanOwner(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanOfficerCount")] +internal static extern int SteamAPI_ISteamFriends_GetClanOfficerCount(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanOfficerByIndex")] +internal static extern ulong SteamAPI_ISteamFriends_GetClanOfficerByIndex(IntPtr instancePtr, ulong steamIDClan, int iOfficer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetUserRestrictions")] +internal static extern uint SteamAPI_ISteamFriends_GetUserRestrictions(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_SetRichPresence")] +internal static extern bool SteamAPI_ISteamFriends_SetRichPresence(IntPtr instancePtr, string pchKey, string pchValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_ClearRichPresence")] +internal static extern void SteamAPI_ISteamFriends_ClearRichPresence(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendRichPresence")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence(IntPtr instancePtr, ulong steamIDFriend, string pchKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount")] +internal static extern int SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex")] +internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex(IntPtr instancePtr, ulong steamIDFriend, int iKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_RequestFriendRichPresence")] +internal static extern void SteamAPI_ISteamFriends_RequestFriendRichPresence(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_InviteUserToGame")] +internal static extern bool SteamAPI_ISteamFriends_InviteUserToGame(IntPtr instancePtr, ulong steamIDFriend, string pchConnectString); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetCoplayFriendCount")] +internal static extern int SteamAPI_ISteamFriends_GetCoplayFriendCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetCoplayFriend")] +internal static extern ulong SteamAPI_ISteamFriends_GetCoplayFriend(IntPtr instancePtr, int iCoplayFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendCoplayTime")] +internal static extern int SteamAPI_ISteamFriends_GetFriendCoplayTime(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendCoplayGame")] +internal static extern uint SteamAPI_ISteamFriends_GetFriendCoplayGame(IntPtr instancePtr, ulong steamIDFriend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_JoinClanChatRoom")] +internal static extern ulong SteamAPI_ISteamFriends_JoinClanChatRoom(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_LeaveClanChatRoom")] +internal static extern bool SteamAPI_ISteamFriends_LeaveClanChatRoom(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanChatMemberCount")] +internal static extern int SteamAPI_ISteamFriends_GetClanChatMemberCount(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetChatMemberByIndex")] +internal static extern ulong SteamAPI_ISteamFriends_GetChatMemberByIndex(IntPtr instancePtr, ulong steamIDClan, int iUser); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_SendClanChatMessage")] +internal static extern bool SteamAPI_ISteamFriends_SendClanChatMessage(IntPtr instancePtr, ulong steamIDClanChat, string pchText); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetClanChatMessage")] +internal static extern int SteamAPI_ISteamFriends_GetClanChatMessage(IntPtr instancePtr, ulong steamIDClanChat, int iMessage, IntPtr prgchText, int cchTextMax, ref uint peChatEntryType, ref CSteamID psteamidChatter); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_IsClanChatAdmin")] +internal static extern bool SteamAPI_ISteamFriends_IsClanChatAdmin(IntPtr instancePtr, ulong steamIDClanChat, ulong steamIDUser); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam")] +internal static extern bool SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam(IntPtr instancePtr, ulong steamIDClanChat); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_OpenClanChatWindowInSteam")] +internal static extern bool SteamAPI_ISteamFriends_OpenClanChatWindowInSteam(IntPtr instancePtr, ulong steamIDClanChat); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_CloseClanChatWindowInSteam")] +internal static extern bool SteamAPI_ISteamFriends_CloseClanChatWindowInSteam(IntPtr instancePtr, ulong steamIDClanChat); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_SetListenForFriendsMessages")] +internal static extern bool SteamAPI_ISteamFriends_SetListenForFriendsMessages(IntPtr instancePtr, bool bInterceptEnabled); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_ReplyToFriendMessage")] +internal static extern bool SteamAPI_ISteamFriends_ReplyToFriendMessage(IntPtr instancePtr, ulong steamIDFriend, string pchMsgToSend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFriendMessage")] +internal static extern int SteamAPI_ISteamFriends_GetFriendMessage(IntPtr instancePtr, ulong steamIDFriend, int iMessageID, IntPtr pvData, int cubData, ref uint peChatEntryType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_GetFollowerCount")] +internal static extern ulong SteamAPI_ISteamFriends_GetFollowerCount(IntPtr instancePtr, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_IsFollowing")] +internal static extern ulong SteamAPI_ISteamFriends_IsFollowing(IntPtr instancePtr, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamFriends_EnumerateFollowingList")] +internal static extern ulong SteamAPI_ISteamFriends_EnumerateFollowingList(IntPtr instancePtr, uint unStartIndex); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetSecondsSinceAppActive")] +internal static extern uint SteamAPI_ISteamUtils_GetSecondsSinceAppActive(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetSecondsSinceComputerActive")] +internal static extern uint SteamAPI_ISteamUtils_GetSecondsSinceComputerActive(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetConnectedUniverse")] +internal static extern int SteamAPI_ISteamUtils_GetConnectedUniverse(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetServerRealTime")] +internal static extern uint SteamAPI_ISteamUtils_GetServerRealTime(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetIPCountry")] +internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetImageSize")] +internal static extern bool SteamAPI_ISteamUtils_GetImageSize(IntPtr instancePtr, int iImage, ref uint pnWidth, ref uint pnHeight); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetImageRGBA")] +internal static extern bool SteamAPI_ISteamUtils_GetImageRGBA(IntPtr instancePtr, int iImage, IntPtr pubDest, int nDestBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetCSERIPPort")] +internal static extern bool SteamAPI_ISteamUtils_GetCSERIPPort(IntPtr instancePtr, ref uint unIP, ref char usPort); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetCurrentBatteryPower")] +internal static extern byte SteamAPI_ISteamUtils_GetCurrentBatteryPower(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetAppID")] +internal static extern uint SteamAPI_ISteamUtils_GetAppID(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_SetOverlayNotificationPosition")] +internal static extern void SteamAPI_ISteamUtils_SetOverlayNotificationPosition(IntPtr instancePtr, uint eNotificationPosition); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_IsAPICallCompleted")] +internal static extern bool SteamAPI_ISteamUtils_IsAPICallCompleted(IntPtr instancePtr, ulong hSteamAPICall, ref bool pbFailed); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetAPICallFailureReason")] +internal static extern int SteamAPI_ISteamUtils_GetAPICallFailureReason(IntPtr instancePtr, ulong hSteamAPICall); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetAPICallResult")] +internal static extern bool SteamAPI_ISteamUtils_GetAPICallResult(IntPtr instancePtr, ulong hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, ref bool pbFailed); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_RunFrame")] +internal static extern void SteamAPI_ISteamUtils_RunFrame(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetIPCCallCount")] +internal static extern uint SteamAPI_ISteamUtils_GetIPCCallCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_SetWarningMessageHook")] +internal static extern void SteamAPI_ISteamUtils_SetWarningMessageHook(IntPtr instancePtr, IntPtr pFunction); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_IsOverlayEnabled")] +internal static extern bool SteamAPI_ISteamUtils_IsOverlayEnabled(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_BOverlayNeedsPresent")] +internal static extern bool SteamAPI_ISteamUtils_BOverlayNeedsPresent(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_CheckFileSignature")] +internal static extern ulong SteamAPI_ISteamUtils_CheckFileSignature(IntPtr instancePtr, string szFileName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_ShowGamepadTextInput")] +internal static extern bool SteamAPI_ISteamUtils_ShowGamepadTextInput(IntPtr instancePtr, int eInputMode, int eLineInputMode, string pchDescription, uint unCharMax, string pchExistingText); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetEnteredGamepadTextLength")] +internal static extern uint SteamAPI_ISteamUtils_GetEnteredGamepadTextLength(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetEnteredGamepadTextInput")] +internal static extern bool SteamAPI_ISteamUtils_GetEnteredGamepadTextInput(IntPtr instancePtr, string pchText, uint cchText); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_GetSteamUILanguage")] +internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_IsSteamRunningInVR")] +internal static extern bool SteamAPI_ISteamUtils_IsSteamRunningInVR(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUtils_SetOverlayNotificationInset")] +internal static extern void SteamAPI_ISteamUtils_SetOverlayNotificationInset(IntPtr instancePtr, int nHorizontalInset, int nVerticalInset); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetFavoriteGameCount")] +internal static extern int SteamAPI_ISteamMatchmaking_GetFavoriteGameCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetFavoriteGame")] +internal static extern bool SteamAPI_ISteamMatchmaking_GetFavoriteGame(IntPtr instancePtr, int iGame, ref uint pnAppID, ref uint pnIP, ref char pnConnPort, ref char pnQueryPort, ref uint punFlags, ref uint pRTime32LastPlayedOnServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddFavoriteGame")] +internal static extern int SteamAPI_ISteamMatchmaking_AddFavoriteGame(IntPtr instancePtr, uint nAppID, uint nIP, char nConnPort, char nQueryPort, uint unFlags, uint rTime32LastPlayedOnServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_RemoveFavoriteGame")] +internal static extern bool SteamAPI_ISteamMatchmaking_RemoveFavoriteGame(IntPtr instancePtr, uint nAppID, uint nIP, char nConnPort, char nQueryPort, uint unFlags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_RequestLobbyList")] +internal static extern ulong SteamAPI_ISteamMatchmaking_RequestLobbyList(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter")] +internal static extern void SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter(IntPtr instancePtr, string pchKeyToMatch, string pchValueToMatch, uint eComparisonType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter")] +internal static extern void SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter(IntPtr instancePtr, string pchKeyToMatch, int nValueToMatch, uint eComparisonType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter")] +internal static extern void SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter(IntPtr instancePtr, string pchKeyToMatch, int nValueToBeCloseTo); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable")] +internal static extern void SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable(IntPtr instancePtr, int nSlotsAvailable); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter")] +internal static extern void SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter(IntPtr instancePtr, uint eLobbyDistanceFilter); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter")] +internal static extern void SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter(IntPtr instancePtr, int cMaxResults); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter")] +internal static extern void SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyByIndex")] +internal static extern ulong SteamAPI_ISteamMatchmaking_GetLobbyByIndex(IntPtr instancePtr, int iLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_CreateLobby")] +internal static extern ulong SteamAPI_ISteamMatchmaking_CreateLobby(IntPtr instancePtr, uint eLobbyType, int cMaxMembers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_JoinLobby")] +internal static extern ulong SteamAPI_ISteamMatchmaking_JoinLobby(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_LeaveLobby")] +internal static extern void SteamAPI_ISteamMatchmaking_LeaveLobby(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_InviteUserToLobby")] +internal static extern bool SteamAPI_ISteamMatchmaking_InviteUserToLobby(IntPtr instancePtr, ulong steamIDLobby, ulong steamIDInvitee); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetNumLobbyMembers")] +internal static extern int SteamAPI_ISteamMatchmaking_GetNumLobbyMembers(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex")] +internal static extern ulong SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex(IntPtr instancePtr, ulong steamIDLobby, int iMember); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyData")] +internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData(IntPtr instancePtr, ulong steamIDLobby, string pchKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLobbyData")] +internal static extern bool SteamAPI_ISteamMatchmaking_SetLobbyData(IntPtr instancePtr, ulong steamIDLobby, string pchKey, string pchValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyDataCount")] +internal static extern int SteamAPI_ISteamMatchmaking_GetLobbyDataCount(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex")] +internal static extern bool SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex(IntPtr instancePtr, ulong steamIDLobby, int iLobbyData, string pchKey, int cchKeyBufferSize, string pchValue, int cchValueBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_DeleteLobbyData")] +internal static extern bool SteamAPI_ISteamMatchmaking_DeleteLobbyData(IntPtr instancePtr, ulong steamIDLobby, string pchKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyMemberData")] +internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData(IntPtr instancePtr, ulong steamIDLobby, ulong steamIDUser, string pchKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLobbyMemberData")] +internal static extern void SteamAPI_ISteamMatchmaking_SetLobbyMemberData(IntPtr instancePtr, ulong steamIDLobby, string pchKey, string pchValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SendLobbyChatMsg")] +internal static extern bool SteamAPI_ISteamMatchmaking_SendLobbyChatMsg(IntPtr instancePtr, ulong steamIDLobby, IntPtr pvMsgBody, int cubMsgBody); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyChatEntry")] +internal static extern int SteamAPI_ISteamMatchmaking_GetLobbyChatEntry(IntPtr instancePtr, ulong steamIDLobby, int iChatID, ref CSteamID pSteamIDUser, IntPtr pvData, int cubData, ref uint peChatEntryType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_RequestLobbyData")] +internal static extern bool SteamAPI_ISteamMatchmaking_RequestLobbyData(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLobbyGameServer")] +internal static extern void SteamAPI_ISteamMatchmaking_SetLobbyGameServer(IntPtr instancePtr, ulong steamIDLobby, uint unGameServerIP, char unGameServerPort, ulong steamIDGameServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyGameServer")] +internal static extern bool SteamAPI_ISteamMatchmaking_GetLobbyGameServer(IntPtr instancePtr, ulong steamIDLobby, ref uint punGameServerIP, ref char punGameServerPort, ref CSteamID psteamIDGameServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit")] +internal static extern bool SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit(IntPtr instancePtr, ulong steamIDLobby, int cMaxMembers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit")] +internal static extern int SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLobbyType")] +internal static extern bool SteamAPI_ISteamMatchmaking_SetLobbyType(IntPtr instancePtr, ulong steamIDLobby, uint eLobbyType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLobbyJoinable")] +internal static extern bool SteamAPI_ISteamMatchmaking_SetLobbyJoinable(IntPtr instancePtr, ulong steamIDLobby, bool bLobbyJoinable); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_GetLobbyOwner")] +internal static extern ulong SteamAPI_ISteamMatchmaking_GetLobbyOwner(IntPtr instancePtr, ulong steamIDLobby); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLobbyOwner")] +internal static extern bool SteamAPI_ISteamMatchmaking_SetLobbyOwner(IntPtr instancePtr, ulong steamIDLobby, ulong steamIDNewOwner); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmaking_SetLinkedLobby")] +internal static extern bool SteamAPI_ISteamMatchmaking_SetLinkedLobby(IntPtr instancePtr, ulong steamIDLobby, ulong steamIDLobbyDependent); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServerListResponse_ServerResponded")] +internal static extern void SteamAPI_ISteamMatchmakingServerListResponse_ServerResponded(IntPtr instancePtr, uint hRequest, int iServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServerListResponse_ServerFailedToRespond")] +internal static extern void SteamAPI_ISteamMatchmakingServerListResponse_ServerFailedToRespond(IntPtr instancePtr, uint hRequest, int iServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServerListResponse_RefreshComplete")] +internal static extern void SteamAPI_ISteamMatchmakingServerListResponse_RefreshComplete(IntPtr instancePtr, uint hRequest, uint response); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingPingResponse_ServerResponded")] +internal static extern void SteamAPI_ISteamMatchmakingPingResponse_ServerResponded(IntPtr instancePtr, IntPtr server); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingPingResponse_ServerFailedToRespond")] +internal static extern void SteamAPI_ISteamMatchmakingPingResponse_ServerFailedToRespond(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingPlayersResponse_AddPlayerToList")] +internal static extern void SteamAPI_ISteamMatchmakingPlayersResponse_AddPlayerToList(IntPtr instancePtr, string pchName, int nScore, float flTimePlayed); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingPlayersResponse_PlayersFailedToRespond")] +internal static extern void SteamAPI_ISteamMatchmakingPlayersResponse_PlayersFailedToRespond(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingPlayersResponse_PlayersRefreshComplete")] +internal static extern void SteamAPI_ISteamMatchmakingPlayersResponse_PlayersRefreshComplete(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingRulesResponse_RulesResponded")] +internal static extern void SteamAPI_ISteamMatchmakingRulesResponse_RulesResponded(IntPtr instancePtr, string pchRule, string pchValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingRulesResponse_RulesFailedToRespond")] +internal static extern void SteamAPI_ISteamMatchmakingRulesResponse_RulesFailedToRespond(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingRulesResponse_RulesRefreshComplete")] +internal static extern void SteamAPI_ISteamMatchmakingRulesResponse_RulesRefreshComplete(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RequestInternetServerList")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_RequestInternetServerList(IntPtr instancePtr, uint iApp, [In, Out] MatchMakingKeyValuePair_t [] ppchFilters, uint nFilters, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RequestLANServerList")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_RequestLANServerList(IntPtr instancePtr, uint iApp, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList(IntPtr instancePtr, uint iApp, [In, Out] MatchMakingKeyValuePair_t [] ppchFilters, uint nFilters, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList(IntPtr instancePtr, uint iApp, [In, Out] MatchMakingKeyValuePair_t [] ppchFilters, uint nFilters, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList(IntPtr instancePtr, uint iApp, [In, Out] MatchMakingKeyValuePair_t [] ppchFilters, uint nFilters, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList(IntPtr instancePtr, uint iApp, [In, Out] MatchMakingKeyValuePair_t [] ppchFilters, uint nFilters, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_ReleaseRequest")] +internal static extern void SteamAPI_ISteamMatchmakingServers_ReleaseRequest(IntPtr instancePtr, uint hServerListRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_GetServerDetails")] +internal static extern IntPtr SteamAPI_ISteamMatchmakingServers_GetServerDetails(IntPtr instancePtr, uint hRequest, int iServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_CancelQuery")] +internal static extern void SteamAPI_ISteamMatchmakingServers_CancelQuery(IntPtr instancePtr, uint hRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RefreshQuery")] +internal static extern void SteamAPI_ISteamMatchmakingServers_RefreshQuery(IntPtr instancePtr, uint hRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_IsRefreshing")] +internal static extern bool SteamAPI_ISteamMatchmakingServers_IsRefreshing(IntPtr instancePtr, uint hRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_GetServerCount")] +internal static extern int SteamAPI_ISteamMatchmakingServers_GetServerCount(IntPtr instancePtr, uint hRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_RefreshServer")] +internal static extern void SteamAPI_ISteamMatchmakingServers_RefreshServer(IntPtr instancePtr, uint hRequest, int iServer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_PingServer")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_PingServer(IntPtr instancePtr, uint unIP, char usPort, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_PlayerDetails")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_PlayerDetails(IntPtr instancePtr, uint unIP, char usPort, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_ServerRules")] +internal static extern uint SteamAPI_ISteamMatchmakingServers_ServerRules(IntPtr instancePtr, uint unIP, char usPort, IntPtr pRequestServersResponse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMatchmakingServers_CancelServerQuery")] +internal static extern void SteamAPI_ISteamMatchmakingServers_CancelServerQuery(IntPtr instancePtr, uint hServerQuery); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileWrite")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileWrite(IntPtr instancePtr, string pchFile, IntPtr pvData, int cubData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileRead")] +internal static extern int SteamAPI_ISteamRemoteStorage_FileRead(IntPtr instancePtr, string pchFile, IntPtr pvData, int cubDataToRead); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileWriteAsync")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_FileWriteAsync(IntPtr instancePtr, string pchFile, IntPtr pvData, uint cubData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileReadAsync")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_FileReadAsync(IntPtr instancePtr, string pchFile, uint nOffset, uint cubToRead); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete(IntPtr instancePtr, ulong hReadCall, IntPtr pvBuffer, uint cubToRead); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileForget")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileForget(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileDelete")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileDelete(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileShare")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_FileShare(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_SetSyncPlatforms")] +internal static extern bool SteamAPI_ISteamRemoteStorage_SetSyncPlatforms(IntPtr instancePtr, string pchFile, uint eRemoteStoragePlatform); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk(IntPtr instancePtr, ulong writeHandle, IntPtr pvData, int cubData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileWriteStreamClose")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileWriteStreamClose(IntPtr instancePtr, ulong writeHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel(IntPtr instancePtr, ulong writeHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileExists")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileExists(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FilePersisted")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FilePersisted(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetFileSize")] +internal static extern int SteamAPI_ISteamRemoteStorage_GetFileSize(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetFileTimestamp")] +internal static extern long SteamAPI_ISteamRemoteStorage_GetFileTimestamp(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetSyncPlatforms")] +internal static extern uint SteamAPI_ISteamRemoteStorage_GetSyncPlatforms(IntPtr instancePtr, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetFileCount")] +internal static extern int SteamAPI_ISteamRemoteStorage_GetFileCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetFileNameAndSize")] +internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(IntPtr instancePtr, int iFile, ref int pnFileSizeInBytes); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetQuota")] +internal static extern bool SteamAPI_ISteamRemoteStorage_GetQuota(IntPtr instancePtr, ref int pnTotalBytes, ref int puAvailableBytes); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount")] +internal static extern bool SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp")] +internal static extern bool SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp")] +internal static extern void SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp(IntPtr instancePtr, bool bEnabled); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UGCDownload")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_UGCDownload(IntPtr instancePtr, ulong hContent, uint unPriority); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress")] +internal static extern bool SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(IntPtr instancePtr, ulong hContent, ref int pnBytesDownloaded, ref int pnBytesExpected); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetUGCDetails")] +internal static extern bool SteamAPI_ISteamRemoteStorage_GetUGCDetails(IntPtr instancePtr, ulong hContent, ref uint pnAppID, string ppchName, ref int pnFileSizeInBytes, ref CSteamID pSteamIDOwner); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UGCRead")] +internal static extern int SteamAPI_ISteamRemoteStorage_UGCRead(IntPtr instancePtr, ulong hContent, IntPtr pvData, int cubDataToRead, uint cOffset, uint eAction); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetCachedUGCCount")] +internal static extern int SteamAPI_ISteamRemoteStorage_GetCachedUGCCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle(IntPtr instancePtr, int iCachedContent); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_PublishWorkshopFile")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_PublishWorkshopFile(IntPtr instancePtr, string pchFile, string pchPreviewFile, uint nConsumerAppId, string pchTitle, string pchDescription, uint eVisibility, ref SteamParamStringArray_t pTags, uint eWorkshopFileType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest(IntPtr instancePtr, ulong unPublishedFileId); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile")] +internal static extern bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile(IntPtr instancePtr, ulong updateHandle, string pchFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile")] +internal static extern bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile(IntPtr instancePtr, ulong updateHandle, string pchPreviewFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle")] +internal static extern bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle(IntPtr instancePtr, ulong updateHandle, string pchTitle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription")] +internal static extern bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription(IntPtr instancePtr, ulong updateHandle, string pchDescription); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility")] +internal static extern bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility(IntPtr instancePtr, ulong updateHandle, uint eVisibility); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags")] +internal static extern bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags(IntPtr instancePtr, ulong updateHandle, ref SteamParamStringArray_t pTags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate(IntPtr instancePtr, ulong updateHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails(IntPtr instancePtr, ulong unPublishedFileId, uint unMaxSecondsOld); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_DeletePublishedFile")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_DeletePublishedFile(IntPtr instancePtr, ulong unPublishedFileId); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles(IntPtr instancePtr, uint unStartIndex); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_SubscribePublishedFile")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_SubscribePublishedFile(IntPtr instancePtr, ulong unPublishedFileId); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles(IntPtr instancePtr, uint unStartIndex); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile(IntPtr instancePtr, ulong unPublishedFileId); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription")] +internal static extern bool SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription(IntPtr instancePtr, ulong updateHandle, string pchChangeDescription); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails(IntPtr instancePtr, ulong unPublishedFileId); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote(IntPtr instancePtr, ulong unPublishedFileId, bool bVoteUp); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails(IntPtr instancePtr, ulong unPublishedFileId); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles(IntPtr instancePtr, ulong steamId, uint unStartIndex, ref SteamParamStringArray_t pRequiredTags, ref SteamParamStringArray_t pExcludedTags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_PublishVideo")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_PublishVideo(IntPtr instancePtr, uint eVideoProvider, string pchVideoAccount, string pchVideoIdentifier, string pchPreviewFile, uint nConsumerAppId, string pchTitle, string pchDescription, uint eVisibility, ref SteamParamStringArray_t pTags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction(IntPtr instancePtr, ulong unPublishedFileId, uint eAction); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction(IntPtr instancePtr, uint eAction, uint unStartIndex); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles(IntPtr instancePtr, uint eEnumerationType, uint unStartIndex, uint unCount, uint unDays, ref SteamParamStringArray_t pTags, ref SteamParamStringArray_t pUserTags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation(IntPtr instancePtr, ulong hContent, string pchLocation, uint unPriority); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_RequestCurrentStats")] +internal static extern bool SteamAPI_ISteamUserStats_RequestCurrentStats(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetStat")] +internal static extern bool SteamAPI_ISteamUserStats_GetStat(IntPtr instancePtr, string pchName, ref int pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetStat0")] +internal static extern bool SteamAPI_ISteamUserStats_GetStat0(IntPtr instancePtr, string pchName, ref float pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_SetStat")] +internal static extern bool SteamAPI_ISteamUserStats_SetStat(IntPtr instancePtr, string pchName, int nData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_SetStat0")] +internal static extern bool SteamAPI_ISteamUserStats_SetStat0(IntPtr instancePtr, string pchName, float fData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_UpdateAvgRateStat")] +internal static extern bool SteamAPI_ISteamUserStats_UpdateAvgRateStat(IntPtr instancePtr, string pchName, float flCountThisSession, double dSessionLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetAchievement")] +internal static extern bool SteamAPI_ISteamUserStats_GetAchievement(IntPtr instancePtr, string pchName, ref bool pbAchieved); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_SetAchievement")] +internal static extern bool SteamAPI_ISteamUserStats_SetAchievement(IntPtr instancePtr, string pchName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_ClearAchievement")] +internal static extern bool SteamAPI_ISteamUserStats_ClearAchievement(IntPtr instancePtr, string pchName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime")] +internal static extern bool SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime(IntPtr instancePtr, string pchName, ref bool pbAchieved, ref uint punUnlockTime); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_StoreStats")] +internal static extern bool SteamAPI_ISteamUserStats_StoreStats(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetAchievementIcon")] +internal static extern int SteamAPI_ISteamUserStats_GetAchievementIcon(IntPtr instancePtr, string pchName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute")] +internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute(IntPtr instancePtr, string pchName, string pchKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_IndicateAchievementProgress")] +internal static extern bool SteamAPI_ISteamUserStats_IndicateAchievementProgress(IntPtr instancePtr, string pchName, uint nCurProgress, uint nMaxProgress); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetNumAchievements")] +internal static extern uint SteamAPI_ISteamUserStats_GetNumAchievements(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetAchievementName")] +internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName(IntPtr instancePtr, uint iAchievement); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_RequestUserStats")] +internal static extern ulong SteamAPI_ISteamUserStats_RequestUserStats(IntPtr instancePtr, ulong steamIDUser); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetUserStat")] +internal static extern bool SteamAPI_ISteamUserStats_GetUserStat(IntPtr instancePtr, ulong steamIDUser, string pchName, ref int pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetUserStat0")] +internal static extern bool SteamAPI_ISteamUserStats_GetUserStat0(IntPtr instancePtr, ulong steamIDUser, string pchName, ref float pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetUserAchievement")] +internal static extern bool SteamAPI_ISteamUserStats_GetUserAchievement(IntPtr instancePtr, ulong steamIDUser, string pchName, ref bool pbAchieved); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime")] +internal static extern bool SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime(IntPtr instancePtr, ulong steamIDUser, string pchName, ref bool pbAchieved, ref uint punUnlockTime); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_ResetAllStats")] +internal static extern bool SteamAPI_ISteamUserStats_ResetAllStats(IntPtr instancePtr, bool bAchievementsToo); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_FindOrCreateLeaderboard")] +internal static extern ulong SteamAPI_ISteamUserStats_FindOrCreateLeaderboard(IntPtr instancePtr, string pchLeaderboardName, uint eLeaderboardSortMethod, uint eLeaderboardDisplayType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_FindLeaderboard")] +internal static extern ulong SteamAPI_ISteamUserStats_FindLeaderboard(IntPtr instancePtr, string pchLeaderboardName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetLeaderboardName")] +internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName(IntPtr instancePtr, ulong hSteamLeaderboard); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetLeaderboardEntryCount")] +internal static extern int SteamAPI_ISteamUserStats_GetLeaderboardEntryCount(IntPtr instancePtr, ulong hSteamLeaderboard); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetLeaderboardSortMethod")] +internal static extern uint SteamAPI_ISteamUserStats_GetLeaderboardSortMethod(IntPtr instancePtr, ulong hSteamLeaderboard); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetLeaderboardDisplayType")] +internal static extern uint SteamAPI_ISteamUserStats_GetLeaderboardDisplayType(IntPtr instancePtr, ulong hSteamLeaderboard); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_DownloadLeaderboardEntries")] +internal static extern ulong SteamAPI_ISteamUserStats_DownloadLeaderboardEntries(IntPtr instancePtr, ulong hSteamLeaderboard, uint eLeaderboardDataRequest, int nRangeStart, int nRangeEnd); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers")] +internal static extern ulong SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers(IntPtr instancePtr, ulong hSteamLeaderboard, [In, Out] CSteamID[] prgUsers, int cUsers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry")] +internal static extern bool SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry(IntPtr instancePtr, ulong hSteamLeaderboardEntries, int index, ref LeaderboardEntry_t pLeaderboardEntry, ref int pDetails, int cDetailsMax); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_UploadLeaderboardScore")] +internal static extern ulong SteamAPI_ISteamUserStats_UploadLeaderboardScore(IntPtr instancePtr, ulong hSteamLeaderboard, uint eLeaderboardUploadScoreMethod, int nScore, ref int pScoreDetails, int cScoreDetailsCount); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_AttachLeaderboardUGC")] +internal static extern ulong SteamAPI_ISteamUserStats_AttachLeaderboardUGC(IntPtr instancePtr, ulong hSteamLeaderboard, ulong hUGC); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers")] +internal static extern ulong SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages")] +internal static extern ulong SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo")] +internal static extern int SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo(IntPtr instancePtr, string pchName, uint unNameBufLen, ref float pflPercent, ref bool pbAchieved); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo")] +internal static extern int SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo(IntPtr instancePtr, int iIteratorPrevious, string pchName, uint unNameBufLen, ref float pflPercent, ref bool pbAchieved); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetAchievementAchievedPercent")] +internal static extern bool SteamAPI_ISteamUserStats_GetAchievementAchievedPercent(IntPtr instancePtr, string pchName, ref float pflPercent); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_RequestGlobalStats")] +internal static extern ulong SteamAPI_ISteamUserStats_RequestGlobalStats(IntPtr instancePtr, int nHistoryDays); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetGlobalStat")] +internal static extern bool SteamAPI_ISteamUserStats_GetGlobalStat(IntPtr instancePtr, string pchStatName, ref long pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetGlobalStat0")] +internal static extern bool SteamAPI_ISteamUserStats_GetGlobalStat0(IntPtr instancePtr, string pchStatName, ref double pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetGlobalStatHistory")] +internal static extern int SteamAPI_ISteamUserStats_GetGlobalStatHistory(IntPtr instancePtr, string pchStatName, [In, Out] long[] pData, uint cubData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUserStats_GetGlobalStatHistory0")] +internal static extern int SteamAPI_ISteamUserStats_GetGlobalStatHistory0(IntPtr instancePtr, string pchStatName, [In, Out] double[] pData, uint cubData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsSubscribed")] +internal static extern bool SteamAPI_ISteamApps_BIsSubscribed(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsLowViolence")] +internal static extern bool SteamAPI_ISteamApps_BIsLowViolence(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsCybercafe")] +internal static extern bool SteamAPI_ISteamApps_BIsCybercafe(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsVACBanned")] +internal static extern bool SteamAPI_ISteamApps_BIsVACBanned(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetCurrentGameLanguage")] +internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetAvailableGameLanguages")] +internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsSubscribedApp")] +internal static extern bool SteamAPI_ISteamApps_BIsSubscribedApp(IntPtr instancePtr, uint appID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsDlcInstalled")] +internal static extern bool SteamAPI_ISteamApps_BIsDlcInstalled(IntPtr instancePtr, uint appID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime")] +internal static extern uint SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime(IntPtr instancePtr, uint nAppID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend")] +internal static extern bool SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetDLCCount")] +internal static extern int SteamAPI_ISteamApps_GetDLCCount(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BGetDLCDataByIndex")] +internal static extern bool SteamAPI_ISteamApps_BGetDLCDataByIndex(IntPtr instancePtr, int iDLC, ref uint pAppID, ref bool pbAvailable, string pchName, int cchNameBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_InstallDLC")] +internal static extern void SteamAPI_ISteamApps_InstallDLC(IntPtr instancePtr, uint nAppID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_UninstallDLC")] +internal static extern void SteamAPI_ISteamApps_UninstallDLC(IntPtr instancePtr, uint nAppID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey")] +internal static extern void SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey(IntPtr instancePtr, uint nAppID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetCurrentBetaName")] +internal static extern bool SteamAPI_ISteamApps_GetCurrentBetaName(IntPtr instancePtr, string pchName, int cchNameBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_MarkContentCorrupt")] +internal static extern bool SteamAPI_ISteamApps_MarkContentCorrupt(IntPtr instancePtr, bool bMissingFilesOnly); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetInstalledDepots")] +internal static extern uint SteamAPI_ISteamApps_GetInstalledDepots(IntPtr instancePtr, uint appID, ref uint pvecDepots, uint cMaxDepots); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetAppInstallDir")] +internal static extern uint SteamAPI_ISteamApps_GetAppInstallDir(IntPtr instancePtr, uint appID, string pchFolder, uint cchFolderBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_BIsAppInstalled")] +internal static extern bool SteamAPI_ISteamApps_BIsAppInstalled(IntPtr instancePtr, uint appID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetAppOwner")] +internal static extern ulong SteamAPI_ISteamApps_GetAppOwner(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetLaunchQueryParam")] +internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam(IntPtr instancePtr, string pchKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetDlcDownloadProgress")] +internal static extern bool SteamAPI_ISteamApps_GetDlcDownloadProgress(IntPtr instancePtr, uint nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamApps_GetAppBuildId")] +internal static extern int SteamAPI_ISteamApps_GetAppBuildId(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_SendP2PPacket")] +internal static extern bool SteamAPI_ISteamNetworking_SendP2PPacket(IntPtr instancePtr, ulong steamIDRemote, IntPtr pubData, uint cubData, uint eP2PSendType, int nChannel); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_IsP2PPacketAvailable")] +internal static extern bool SteamAPI_ISteamNetworking_IsP2PPacketAvailable(IntPtr instancePtr, ref uint pcubMsgSize, int nChannel); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_ReadP2PPacket")] +internal static extern bool SteamAPI_ISteamNetworking_ReadP2PPacket(IntPtr instancePtr, IntPtr pubDest, uint cubDest, ref uint pcubMsgSize, ref CSteamID psteamIDRemote, int nChannel); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser")] +internal static extern bool SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser(IntPtr instancePtr, ulong steamIDRemote); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_CloseP2PSessionWithUser")] +internal static extern bool SteamAPI_ISteamNetworking_CloseP2PSessionWithUser(IntPtr instancePtr, ulong steamIDRemote); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_CloseP2PChannelWithUser")] +internal static extern bool SteamAPI_ISteamNetworking_CloseP2PChannelWithUser(IntPtr instancePtr, ulong steamIDRemote, int nChannel); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_GetP2PSessionState")] +internal static extern bool SteamAPI_ISteamNetworking_GetP2PSessionState(IntPtr instancePtr, ulong steamIDRemote, ref P2PSessionState_t pConnectionState); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_AllowP2PPacketRelay")] +internal static extern bool SteamAPI_ISteamNetworking_AllowP2PPacketRelay(IntPtr instancePtr, bool bAllow); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_CreateListenSocket")] +internal static extern uint SteamAPI_ISteamNetworking_CreateListenSocket(IntPtr instancePtr, int nVirtualP2PPort, uint nIP, char nPort, bool bAllowUseOfPacketRelay); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_CreateP2PConnectionSocket")] +internal static extern uint SteamAPI_ISteamNetworking_CreateP2PConnectionSocket(IntPtr instancePtr, ulong steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_CreateConnectionSocket")] +internal static extern uint SteamAPI_ISteamNetworking_CreateConnectionSocket(IntPtr instancePtr, uint nIP, char nPort, int nTimeoutSec); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_DestroySocket")] +internal static extern bool SteamAPI_ISteamNetworking_DestroySocket(IntPtr instancePtr, uint hSocket, bool bNotifyRemoteEnd); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_DestroyListenSocket")] +internal static extern bool SteamAPI_ISteamNetworking_DestroyListenSocket(IntPtr instancePtr, uint hSocket, bool bNotifyRemoteEnd); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_SendDataOnSocket")] +internal static extern bool SteamAPI_ISteamNetworking_SendDataOnSocket(IntPtr instancePtr, uint hSocket, IntPtr pubData, uint cubData, bool bReliable); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_IsDataAvailableOnSocket")] +internal static extern bool SteamAPI_ISteamNetworking_IsDataAvailableOnSocket(IntPtr instancePtr, uint hSocket, ref uint pcubMsgSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_RetrieveDataFromSocket")] +internal static extern bool SteamAPI_ISteamNetworking_RetrieveDataFromSocket(IntPtr instancePtr, uint hSocket, IntPtr pubDest, uint cubDest, ref uint pcubMsgSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_IsDataAvailable")] +internal static extern bool SteamAPI_ISteamNetworking_IsDataAvailable(IntPtr instancePtr, uint hListenSocket, ref uint pcubMsgSize, ref uint phSocket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_RetrieveData")] +internal static extern bool SteamAPI_ISteamNetworking_RetrieveData(IntPtr instancePtr, uint hListenSocket, IntPtr pubDest, uint cubDest, ref uint pcubMsgSize, ref uint phSocket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_GetSocketInfo")] +internal static extern bool SteamAPI_ISteamNetworking_GetSocketInfo(IntPtr instancePtr, uint hSocket, ref CSteamID pSteamIDRemote, ref int peSocketStatus, ref uint punIPRemote, ref char punPortRemote); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_GetListenSocketInfo")] +internal static extern bool SteamAPI_ISteamNetworking_GetListenSocketInfo(IntPtr instancePtr, uint hListenSocket, ref uint pnIP, ref char pnPort); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_GetSocketConnectionType")] +internal static extern uint SteamAPI_ISteamNetworking_GetSocketConnectionType(IntPtr instancePtr, uint hSocket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamNetworking_GetMaxPacketSize")] +internal static extern int SteamAPI_ISteamNetworking_GetMaxPacketSize(IntPtr instancePtr, uint hSocket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamScreenshots_WriteScreenshot")] +internal static extern uint SteamAPI_ISteamScreenshots_WriteScreenshot(IntPtr instancePtr, IntPtr pubRGB, uint cubRGB, int nWidth, int nHeight); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamScreenshots_AddScreenshotToLibrary")] +internal static extern uint SteamAPI_ISteamScreenshots_AddScreenshotToLibrary(IntPtr instancePtr, string pchFilename, string pchThumbnailFilename, int nWidth, int nHeight); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamScreenshots_TriggerScreenshot")] +internal static extern void SteamAPI_ISteamScreenshots_TriggerScreenshot(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamScreenshots_HookScreenshots")] +internal static extern void SteamAPI_ISteamScreenshots_HookScreenshots(IntPtr instancePtr, bool bHook); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamScreenshots_SetLocation")] +internal static extern bool SteamAPI_ISteamScreenshots_SetLocation(IntPtr instancePtr, uint hScreenshot, string pchLocation); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamScreenshots_TagUser")] +internal static extern bool SteamAPI_ISteamScreenshots_TagUser(IntPtr instancePtr, uint hScreenshot, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamScreenshots_TagPublishedFile")] +internal static extern bool SteamAPI_ISteamScreenshots_TagPublishedFile(IntPtr instancePtr, uint hScreenshot, ulong unPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_BIsEnabled")] +internal static extern bool SteamAPI_ISteamMusic_BIsEnabled(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_BIsPlaying")] +internal static extern bool SteamAPI_ISteamMusic_BIsPlaying(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_GetPlaybackStatus")] +internal static extern int SteamAPI_ISteamMusic_GetPlaybackStatus(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_Play")] +internal static extern void SteamAPI_ISteamMusic_Play(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_Pause")] +internal static extern void SteamAPI_ISteamMusic_Pause(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_PlayPrevious")] +internal static extern void SteamAPI_ISteamMusic_PlayPrevious(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_PlayNext")] +internal static extern void SteamAPI_ISteamMusic_PlayNext(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_SetVolume")] +internal static extern void SteamAPI_ISteamMusic_SetVolume(IntPtr instancePtr, float flVolume); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusic_GetVolume")] +internal static extern float SteamAPI_ISteamMusic_GetVolume(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote")] +internal static extern bool SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote(IntPtr instancePtr, string pchName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote")] +internal static extern bool SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote")] +internal static extern bool SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_BActivationSuccess")] +internal static extern bool SteamAPI_ISteamMusicRemote_BActivationSuccess(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_SetDisplayName")] +internal static extern bool SteamAPI_ISteamMusicRemote_SetDisplayName(IntPtr instancePtr, string pchDisplayName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64")] +internal static extern bool SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64(IntPtr instancePtr, IntPtr pvBuffer, uint cbBufferLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_EnablePlayPrevious")] +internal static extern bool SteamAPI_ISteamMusicRemote_EnablePlayPrevious(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_EnablePlayNext")] +internal static extern bool SteamAPI_ISteamMusicRemote_EnablePlayNext(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_EnableShuffled")] +internal static extern bool SteamAPI_ISteamMusicRemote_EnableShuffled(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_EnableLooped")] +internal static extern bool SteamAPI_ISteamMusicRemote_EnableLooped(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_EnableQueue")] +internal static extern bool SteamAPI_ISteamMusicRemote_EnableQueue(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_EnablePlaylists")] +internal static extern bool SteamAPI_ISteamMusicRemote_EnablePlaylists(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus")] +internal static extern bool SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus(IntPtr instancePtr, int nStatus); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_UpdateShuffled")] +internal static extern bool SteamAPI_ISteamMusicRemote_UpdateShuffled(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_UpdateLooped")] +internal static extern bool SteamAPI_ISteamMusicRemote_UpdateLooped(IntPtr instancePtr, bool bValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_UpdateVolume")] +internal static extern bool SteamAPI_ISteamMusicRemote_UpdateVolume(IntPtr instancePtr, float flValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_CurrentEntryWillChange")] +internal static extern bool SteamAPI_ISteamMusicRemote_CurrentEntryWillChange(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable")] +internal static extern bool SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable(IntPtr instancePtr, bool bAvailable); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText")] +internal static extern bool SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText(IntPtr instancePtr, string pchText); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds")] +internal static extern bool SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds(IntPtr instancePtr, int nValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt")] +internal static extern bool SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt(IntPtr instancePtr, IntPtr pvBuffer, uint cbBufferLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_CurrentEntryDidChange")] +internal static extern bool SteamAPI_ISteamMusicRemote_CurrentEntryDidChange(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_QueueWillChange")] +internal static extern bool SteamAPI_ISteamMusicRemote_QueueWillChange(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_ResetQueueEntries")] +internal static extern bool SteamAPI_ISteamMusicRemote_ResetQueueEntries(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_SetQueueEntry")] +internal static extern bool SteamAPI_ISteamMusicRemote_SetQueueEntry(IntPtr instancePtr, int nID, int nPosition, string pchEntryText); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry")] +internal static extern bool SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry(IntPtr instancePtr, int nID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_QueueDidChange")] +internal static extern bool SteamAPI_ISteamMusicRemote_QueueDidChange(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_PlaylistWillChange")] +internal static extern bool SteamAPI_ISteamMusicRemote_PlaylistWillChange(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_ResetPlaylistEntries")] +internal static extern bool SteamAPI_ISteamMusicRemote_ResetPlaylistEntries(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_SetPlaylistEntry")] +internal static extern bool SteamAPI_ISteamMusicRemote_SetPlaylistEntry(IntPtr instancePtr, int nID, int nPosition, string pchEntryText); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry")] +internal static extern bool SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry(IntPtr instancePtr, int nID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamMusicRemote_PlaylistDidChange")] +internal static extern bool SteamAPI_ISteamMusicRemote_PlaylistDidChange(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_CreateHTTPRequest")] +internal static extern uint SteamAPI_ISteamHTTP_CreateHTTPRequest(IntPtr instancePtr, uint eHTTPRequestMethod, string pchAbsoluteURL); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestContextValue")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestContextValue(IntPtr instancePtr, uint hRequest, ulong ulContextValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(IntPtr instancePtr, uint hRequest, uint unTimeoutSeconds); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue(IntPtr instancePtr, uint hRequest, string pchHeaderName, string pchHeaderValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter(IntPtr instancePtr, uint hRequest, string pchParamName, string pchParamValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SendHTTPRequest")] +internal static extern bool SteamAPI_ISteamHTTP_SendHTTPRequest(IntPtr instancePtr, uint hRequest, ref ulong pCallHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse")] +internal static extern bool SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse(IntPtr instancePtr, uint hRequest, ref ulong pCallHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_DeferHTTPRequest")] +internal static extern bool SteamAPI_ISteamHTTP_DeferHTTPRequest(IntPtr instancePtr, uint hRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_PrioritizeHTTPRequest")] +internal static extern bool SteamAPI_ISteamHTTP_PrioritizeHTTPRequest(IntPtr instancePtr, uint hRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize")] +internal static extern bool SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize(IntPtr instancePtr, uint hRequest, string pchHeaderName, ref uint unResponseHeaderSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue")] +internal static extern bool SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue(IntPtr instancePtr, uint hRequest, string pchHeaderName, IntPtr pHeaderValueBuffer, uint unBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_GetHTTPResponseBodySize")] +internal static extern bool SteamAPI_ISteamHTTP_GetHTTPResponseBodySize(IntPtr instancePtr, uint hRequest, ref uint unBodySize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_GetHTTPResponseBodyData")] +internal static extern bool SteamAPI_ISteamHTTP_GetHTTPResponseBodyData(IntPtr instancePtr, uint hRequest, IntPtr pBodyDataBuffer, uint unBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData")] +internal static extern bool SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData(IntPtr instancePtr, uint hRequest, uint cOffset, IntPtr pBodyDataBuffer, uint unBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_ReleaseHTTPRequest")] +internal static extern bool SteamAPI_ISteamHTTP_ReleaseHTTPRequest(IntPtr instancePtr, uint hRequest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct")] +internal static extern bool SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct(IntPtr instancePtr, uint hRequest, ref float pflPercentOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody(IntPtr instancePtr, uint hRequest, string pchContentType, IntPtr pubBody, uint unBodyLen); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_CreateCookieContainer")] +internal static extern uint SteamAPI_ISteamHTTP_CreateCookieContainer(IntPtr instancePtr, bool bAllowResponsesToModify); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_ReleaseCookieContainer")] +internal static extern bool SteamAPI_ISteamHTTP_ReleaseCookieContainer(IntPtr instancePtr, uint hCookieContainer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetCookie")] +internal static extern bool SteamAPI_ISteamHTTP_SetCookie(IntPtr instancePtr, uint hCookieContainer, string pchHost, string pchUrl, string pchCookie); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer(IntPtr instancePtr, uint hRequest, uint hCookieContainer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo(IntPtr instancePtr, uint hRequest, string pchUserAgentInfo); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(IntPtr instancePtr, uint hRequest, bool bRequireVerifiedCertificate); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS")] +internal static extern bool SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(IntPtr instancePtr, uint hRequest, uint unMilliseconds); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut")] +internal static extern bool SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut(IntPtr instancePtr, uint hRequest, ref bool pbWasTimedOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUnifiedMessages_SendMethod")] +internal static extern ulong SteamAPI_ISteamUnifiedMessages_SendMethod(IntPtr instancePtr, string pchServiceMethod, IntPtr pRequestBuffer, uint unRequestBufferSize, ulong unContext); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUnifiedMessages_GetMethodResponseInfo")] +internal static extern bool SteamAPI_ISteamUnifiedMessages_GetMethodResponseInfo(IntPtr instancePtr, ulong hHandle, ref uint punResponseSize, ref uint peResult); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUnifiedMessages_GetMethodResponseData")] +internal static extern bool SteamAPI_ISteamUnifiedMessages_GetMethodResponseData(IntPtr instancePtr, ulong hHandle, IntPtr pResponseBuffer, uint unResponseBufferSize, bool bAutoRelease); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUnifiedMessages_ReleaseMethod")] +internal static extern bool SteamAPI_ISteamUnifiedMessages_ReleaseMethod(IntPtr instancePtr, ulong hHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUnifiedMessages_SendNotification")] +internal static extern bool SteamAPI_ISteamUnifiedMessages_SendNotification(IntPtr instancePtr, string pchServiceNotification, IntPtr pNotificationBuffer, uint unNotificationBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_Init")] +internal static extern bool SteamAPI_ISteamController_Init(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_Shutdown")] +internal static extern bool SteamAPI_ISteamController_Shutdown(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_RunFrame")] +internal static extern void SteamAPI_ISteamController_RunFrame(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetConnectedControllers")] +internal static extern int SteamAPI_ISteamController_GetConnectedControllers(IntPtr instancePtr, ref ulong handlesOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_ShowBindingPanel")] +internal static extern bool SteamAPI_ISteamController_ShowBindingPanel(IntPtr instancePtr, ulong controllerHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetActionSetHandle")] +internal static extern ulong SteamAPI_ISteamController_GetActionSetHandle(IntPtr instancePtr, string pszActionSetName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_ActivateActionSet")] +internal static extern void SteamAPI_ISteamController_ActivateActionSet(IntPtr instancePtr, ulong controllerHandle, ulong actionSetHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetCurrentActionSet")] +internal static extern ulong SteamAPI_ISteamController_GetCurrentActionSet(IntPtr instancePtr, ulong controllerHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetDigitalActionHandle")] +internal static extern ulong SteamAPI_ISteamController_GetDigitalActionHandle(IntPtr instancePtr, string pszActionName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetDigitalActionData")] +internal static extern ControllerDigitalActionData_t SteamAPI_ISteamController_GetDigitalActionData(IntPtr instancePtr, ulong controllerHandle, ulong digitalActionHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetDigitalActionOrigins")] +internal static extern int SteamAPI_ISteamController_GetDigitalActionOrigins(IntPtr instancePtr, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, ref uint originsOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetAnalogActionHandle")] +internal static extern ulong SteamAPI_ISteamController_GetAnalogActionHandle(IntPtr instancePtr, string pszActionName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetAnalogActionData")] +internal static extern ControllerAnalogActionData_t SteamAPI_ISteamController_GetAnalogActionData(IntPtr instancePtr, ulong controllerHandle, ulong analogActionHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetAnalogActionOrigins")] +internal static extern int SteamAPI_ISteamController_GetAnalogActionOrigins(IntPtr instancePtr, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, ref uint originsOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_StopAnalogActionMomentum")] +internal static extern void SteamAPI_ISteamController_StopAnalogActionMomentum(IntPtr instancePtr, ulong controllerHandle, ulong eAction); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_TriggerHapticPulse")] +internal static extern void SteamAPI_ISteamController_TriggerHapticPulse(IntPtr instancePtr, ulong controllerHandle, uint eTargetPad, char usDurationMicroSec); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_CreateQueryUserUGCRequest")] +internal static extern ulong SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(IntPtr instancePtr, uint unAccountID, uint eListType, uint eMatchingUGCType, uint eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint unPage); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_CreateQueryAllUGCRequest")] +internal static extern ulong SteamAPI_ISteamUGC_CreateQueryAllUGCRequest(IntPtr instancePtr, uint eQueryType, uint eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint unPage); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest")] +internal static extern ulong SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(IntPtr instancePtr, ref ulong pvecPublishedFileID, uint unNumPublishedFileIDs); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SendQueryUGCRequest")] +internal static extern ulong SteamAPI_ISteamUGC_SendQueryUGCRequest(IntPtr instancePtr, ulong handle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCResult")] +internal static extern bool SteamAPI_ISteamUGC_GetQueryUGCResult(IntPtr instancePtr, ulong handle, uint index, ref SteamUGCDetails_t pDetails); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCPreviewURL")] +internal static extern bool SteamAPI_ISteamUGC_GetQueryUGCPreviewURL(IntPtr instancePtr, ulong handle, uint index, string pchURL, uint cchURLSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCMetadata")] +internal static extern bool SteamAPI_ISteamUGC_GetQueryUGCMetadata(IntPtr instancePtr, ulong handle, uint index, string pchMetadata, uint cchMetadatasize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCChildren")] +internal static extern bool SteamAPI_ISteamUGC_GetQueryUGCChildren(IntPtr instancePtr, ulong handle, uint index, ref ulong pvecPublishedFileID, uint cMaxEntries); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCStatistic")] +internal static extern bool SteamAPI_ISteamUGC_GetQueryUGCStatistic(IntPtr instancePtr, ulong handle, uint index, uint eStatType, ref uint pStatValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews")] +internal static extern uint SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews(IntPtr instancePtr, ulong handle, uint index); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview")] +internal static extern bool SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview(IntPtr instancePtr, ulong handle, uint index, uint previewIndex, string pchURLOrVideoID, uint cchURLSize, ref bool pbIsImage); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags")] +internal static extern uint SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags(IntPtr instancePtr, ulong handle, uint index); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag")] +internal static extern bool SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag(IntPtr instancePtr, ulong handle, uint index, uint keyValueTagIndex, string pchKey, uint cchKeySize, string pchValue, uint cchValueSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_ReleaseQueryUGCRequest")] +internal static extern bool SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(IntPtr instancePtr, ulong handle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_AddRequiredTag")] +internal static extern bool SteamAPI_ISteamUGC_AddRequiredTag(IntPtr instancePtr, ulong handle, string pTagName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_AddExcludedTag")] +internal static extern bool SteamAPI_ISteamUGC_AddExcludedTag(IntPtr instancePtr, ulong handle, string pTagName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetReturnKeyValueTags")] +internal static extern bool SteamAPI_ISteamUGC_SetReturnKeyValueTags(IntPtr instancePtr, ulong handle, bool bReturnKeyValueTags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetReturnLongDescription")] +internal static extern bool SteamAPI_ISteamUGC_SetReturnLongDescription(IntPtr instancePtr, ulong handle, bool bReturnLongDescription); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetReturnMetadata")] +internal static extern bool SteamAPI_ISteamUGC_SetReturnMetadata(IntPtr instancePtr, ulong handle, bool bReturnMetadata); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetReturnChildren")] +internal static extern bool SteamAPI_ISteamUGC_SetReturnChildren(IntPtr instancePtr, ulong handle, bool bReturnChildren); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetReturnAdditionalPreviews")] +internal static extern bool SteamAPI_ISteamUGC_SetReturnAdditionalPreviews(IntPtr instancePtr, ulong handle, bool bReturnAdditionalPreviews); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetReturnTotalOnly")] +internal static extern bool SteamAPI_ISteamUGC_SetReturnTotalOnly(IntPtr instancePtr, ulong handle, bool bReturnTotalOnly); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetLanguage")] +internal static extern bool SteamAPI_ISteamUGC_SetLanguage(IntPtr instancePtr, ulong handle, string pchLanguage); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetAllowCachedResponse")] +internal static extern bool SteamAPI_ISteamUGC_SetAllowCachedResponse(IntPtr instancePtr, ulong handle, uint unMaxAgeSeconds); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetCloudFileNameFilter")] +internal static extern bool SteamAPI_ISteamUGC_SetCloudFileNameFilter(IntPtr instancePtr, ulong handle, string pMatchCloudFileName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetMatchAnyTag")] +internal static extern bool SteamAPI_ISteamUGC_SetMatchAnyTag(IntPtr instancePtr, ulong handle, bool bMatchAnyTag); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetSearchText")] +internal static extern bool SteamAPI_ISteamUGC_SetSearchText(IntPtr instancePtr, ulong handle, string pSearchText); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetRankedByTrendDays")] +internal static extern bool SteamAPI_ISteamUGC_SetRankedByTrendDays(IntPtr instancePtr, ulong handle, uint unDays); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_AddRequiredKeyValueTag")] +internal static extern bool SteamAPI_ISteamUGC_AddRequiredKeyValueTag(IntPtr instancePtr, ulong handle, string pKey, string pValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_RequestUGCDetails")] +internal static extern ulong SteamAPI_ISteamUGC_RequestUGCDetails(IntPtr instancePtr, ulong nPublishedFileID, uint unMaxAgeSeconds); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_CreateItem")] +internal static extern ulong SteamAPI_ISteamUGC_CreateItem(IntPtr instancePtr, uint nConsumerAppId, uint eFileType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_StartItemUpdate")] +internal static extern ulong SteamAPI_ISteamUGC_StartItemUpdate(IntPtr instancePtr, uint nConsumerAppId, ulong nPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemTitle")] +internal static extern bool SteamAPI_ISteamUGC_SetItemTitle(IntPtr instancePtr, ulong handle, string pchTitle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemDescription")] +internal static extern bool SteamAPI_ISteamUGC_SetItemDescription(IntPtr instancePtr, ulong handle, string pchDescription); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemUpdateLanguage")] +internal static extern bool SteamAPI_ISteamUGC_SetItemUpdateLanguage(IntPtr instancePtr, ulong handle, string pchLanguage); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemMetadata")] +internal static extern bool SteamAPI_ISteamUGC_SetItemMetadata(IntPtr instancePtr, ulong handle, string pchMetaData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemVisibility")] +internal static extern bool SteamAPI_ISteamUGC_SetItemVisibility(IntPtr instancePtr, ulong handle, uint eVisibility); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemTags")] +internal static extern bool SteamAPI_ISteamUGC_SetItemTags(IntPtr instancePtr, ulong updateHandle, ref SteamParamStringArray_t pTags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemContent")] +internal static extern bool SteamAPI_ISteamUGC_SetItemContent(IntPtr instancePtr, ulong handle, string pszContentFolder); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetItemPreview")] +internal static extern bool SteamAPI_ISteamUGC_SetItemPreview(IntPtr instancePtr, ulong handle, string pszPreviewFile); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_RemoveItemKeyValueTags")] +internal static extern bool SteamAPI_ISteamUGC_RemoveItemKeyValueTags(IntPtr instancePtr, ulong handle, string pchKey); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_AddItemKeyValueTag")] +internal static extern bool SteamAPI_ISteamUGC_AddItemKeyValueTag(IntPtr instancePtr, ulong handle, string pchKey, string pchValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SubmitItemUpdate")] +internal static extern ulong SteamAPI_ISteamUGC_SubmitItemUpdate(IntPtr instancePtr, ulong handle, string pchChangeNote); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetItemUpdateProgress")] +internal static extern uint SteamAPI_ISteamUGC_GetItemUpdateProgress(IntPtr instancePtr, ulong handle, ref ulong punBytesProcessed, ref ulong punBytesTotal); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SetUserItemVote")] +internal static extern ulong SteamAPI_ISteamUGC_SetUserItemVote(IntPtr instancePtr, ulong nPublishedFileID, bool bVoteUp); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetUserItemVote")] +internal static extern ulong SteamAPI_ISteamUGC_GetUserItemVote(IntPtr instancePtr, ulong nPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_AddItemToFavorites")] +internal static extern ulong SteamAPI_ISteamUGC_AddItemToFavorites(IntPtr instancePtr, uint nAppId, ulong nPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_RemoveItemFromFavorites")] +internal static extern ulong SteamAPI_ISteamUGC_RemoveItemFromFavorites(IntPtr instancePtr, uint nAppId, ulong nPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SubscribeItem")] +internal static extern ulong SteamAPI_ISteamUGC_SubscribeItem(IntPtr instancePtr, ulong nPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_UnsubscribeItem")] +internal static extern ulong SteamAPI_ISteamUGC_UnsubscribeItem(IntPtr instancePtr, ulong nPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetNumSubscribedItems")] +internal static extern uint SteamAPI_ISteamUGC_GetNumSubscribedItems(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetSubscribedItems")] +internal static extern uint SteamAPI_ISteamUGC_GetSubscribedItems(IntPtr instancePtr, ref ulong pvecPublishedFileID, uint cMaxEntries); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetItemState")] +internal static extern uint SteamAPI_ISteamUGC_GetItemState(IntPtr instancePtr, ulong nPublishedFileID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetItemInstallInfo")] +internal static extern bool SteamAPI_ISteamUGC_GetItemInstallInfo(IntPtr instancePtr, ulong nPublishedFileID, ref ulong punSizeOnDisk, string pchFolder, uint cchFolderSize, ref uint punTimeStamp); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_GetItemDownloadInfo")] +internal static extern bool SteamAPI_ISteamUGC_GetItemDownloadInfo(IntPtr instancePtr, ulong nPublishedFileID, ref ulong punBytesDownloaded, ref ulong punBytesTotal); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_DownloadItem")] +internal static extern bool SteamAPI_ISteamUGC_DownloadItem(IntPtr instancePtr, ulong nPublishedFileID, bool bHighPriority); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_BInitWorkshopForGameServer")] +internal static extern bool SteamAPI_ISteamUGC_BInitWorkshopForGameServer(IntPtr instancePtr, uint unWorkshopDepotID, string pszFolder); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SuspendDownloads")] +internal static extern void SteamAPI_ISteamUGC_SuspendDownloads(IntPtr instancePtr, bool bSuspend); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamAppList_GetNumInstalledApps")] +internal static extern uint SteamAPI_ISteamAppList_GetNumInstalledApps(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamAppList_GetInstalledApps")] +internal static extern uint SteamAPI_ISteamAppList_GetInstalledApps(IntPtr instancePtr, ref uint pvecAppID, uint unMaxAppIDs); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamAppList_GetAppName")] +internal static extern int SteamAPI_ISteamAppList_GetAppName(IntPtr instancePtr, uint nAppID, string pchName, int cchNameMax); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamAppList_GetAppInstallDir")] +internal static extern int SteamAPI_ISteamAppList_GetAppInstallDir(IntPtr instancePtr, uint nAppID, string pchDirectory, int cchNameMax); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamAppList_GetAppBuildId")] +internal static extern int SteamAPI_ISteamAppList_GetAppBuildId(IntPtr instancePtr, uint nAppID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface")] +internal static extern void SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_Init")] +internal static extern bool SteamAPI_ISteamHTMLSurface_Init(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_Shutdown")] +internal static extern bool SteamAPI_ISteamHTMLSurface_Shutdown(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_CreateBrowser")] +internal static extern ulong SteamAPI_ISteamHTMLSurface_CreateBrowser(IntPtr instancePtr, string pchUserAgent, string pchUserCSS); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_RemoveBrowser")] +internal static extern void SteamAPI_ISteamHTMLSurface_RemoveBrowser(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_LoadURL")] +internal static extern void SteamAPI_ISteamHTMLSurface_LoadURL(IntPtr instancePtr, uint unBrowserHandle, string pchURL, string pchPostData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_SetSize")] +internal static extern void SteamAPI_ISteamHTMLSurface_SetSize(IntPtr instancePtr, uint unBrowserHandle, uint unWidth, uint unHeight); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_StopLoad")] +internal static extern void SteamAPI_ISteamHTMLSurface_StopLoad(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_Reload")] +internal static extern void SteamAPI_ISteamHTMLSurface_Reload(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_GoBack")] +internal static extern void SteamAPI_ISteamHTMLSurface_GoBack(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_GoForward")] +internal static extern void SteamAPI_ISteamHTMLSurface_GoForward(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_AddHeader")] +internal static extern void SteamAPI_ISteamHTMLSurface_AddHeader(IntPtr instancePtr, uint unBrowserHandle, string pchKey, string pchValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_ExecuteJavascript")] +internal static extern void SteamAPI_ISteamHTMLSurface_ExecuteJavascript(IntPtr instancePtr, uint unBrowserHandle, string pchScript); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_MouseUp")] +internal static extern void SteamAPI_ISteamHTMLSurface_MouseUp(IntPtr instancePtr, uint unBrowserHandle, uint eMouseButton); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_MouseDown")] +internal static extern void SteamAPI_ISteamHTMLSurface_MouseDown(IntPtr instancePtr, uint unBrowserHandle, uint eMouseButton); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_MouseDoubleClick")] +internal static extern void SteamAPI_ISteamHTMLSurface_MouseDoubleClick(IntPtr instancePtr, uint unBrowserHandle, uint eMouseButton); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_MouseMove")] +internal static extern void SteamAPI_ISteamHTMLSurface_MouseMove(IntPtr instancePtr, uint unBrowserHandle, int x, int y); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_MouseWheel")] +internal static extern void SteamAPI_ISteamHTMLSurface_MouseWheel(IntPtr instancePtr, uint unBrowserHandle, int nDelta); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_KeyDown")] +internal static extern void SteamAPI_ISteamHTMLSurface_KeyDown(IntPtr instancePtr, uint unBrowserHandle, uint nNativeKeyCode, uint eHTMLKeyModifiers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_KeyUp")] +internal static extern void SteamAPI_ISteamHTMLSurface_KeyUp(IntPtr instancePtr, uint unBrowserHandle, uint nNativeKeyCode, uint eHTMLKeyModifiers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_KeyChar")] +internal static extern void SteamAPI_ISteamHTMLSurface_KeyChar(IntPtr instancePtr, uint unBrowserHandle, uint cUnicodeChar, uint eHTMLKeyModifiers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_SetHorizontalScroll")] +internal static extern void SteamAPI_ISteamHTMLSurface_SetHorizontalScroll(IntPtr instancePtr, uint unBrowserHandle, uint nAbsolutePixelScroll); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_SetVerticalScroll")] +internal static extern void SteamAPI_ISteamHTMLSurface_SetVerticalScroll(IntPtr instancePtr, uint unBrowserHandle, uint nAbsolutePixelScroll); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_SetKeyFocus")] +internal static extern void SteamAPI_ISteamHTMLSurface_SetKeyFocus(IntPtr instancePtr, uint unBrowserHandle, bool bHasKeyFocus); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_ViewSource")] +internal static extern void SteamAPI_ISteamHTMLSurface_ViewSource(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_CopyToClipboard")] +internal static extern void SteamAPI_ISteamHTMLSurface_CopyToClipboard(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_PasteFromClipboard")] +internal static extern void SteamAPI_ISteamHTMLSurface_PasteFromClipboard(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_Find")] +internal static extern void SteamAPI_ISteamHTMLSurface_Find(IntPtr instancePtr, uint unBrowserHandle, string pchSearchStr, bool bCurrentlyInFind, bool bReverse); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_StopFind")] +internal static extern void SteamAPI_ISteamHTMLSurface_StopFind(IntPtr instancePtr, uint unBrowserHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_GetLinkAtPosition")] +internal static extern void SteamAPI_ISteamHTMLSurface_GetLinkAtPosition(IntPtr instancePtr, uint unBrowserHandle, int x, int y); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_SetCookie")] +internal static extern void SteamAPI_ISteamHTMLSurface_SetCookie(IntPtr instancePtr, string pchHostname, string pchKey, string pchValue, string pchPath, ulong nExpires, bool bSecure, bool bHTTPOnly); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_SetPageScaleFactor")] +internal static extern void SteamAPI_ISteamHTMLSurface_SetPageScaleFactor(IntPtr instancePtr, uint unBrowserHandle, float flZoom, int nPointX, int nPointY); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_SetBackgroundMode")] +internal static extern void SteamAPI_ISteamHTMLSurface_SetBackgroundMode(IntPtr instancePtr, uint unBrowserHandle, bool bBackgroundMode); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_AllowStartRequest")] +internal static extern void SteamAPI_ISteamHTMLSurface_AllowStartRequest(IntPtr instancePtr, uint unBrowserHandle, bool bAllowed); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_JSDialogResponse")] +internal static extern void SteamAPI_ISteamHTMLSurface_JSDialogResponse(IntPtr instancePtr, uint unBrowserHandle, bool bResult); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamHTMLSurface_FileLoadDialogResponse")] +internal static extern void SteamAPI_ISteamHTMLSurface_FileLoadDialogResponse(IntPtr instancePtr, uint unBrowserHandle, string pchSelectedFiles); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GetResultStatus")] +internal static extern uint SteamAPI_ISteamInventory_GetResultStatus(IntPtr instancePtr, int resultHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GetResultItems")] +internal static extern bool SteamAPI_ISteamInventory_GetResultItems(IntPtr instancePtr, int resultHandle, [In, Out] SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GetResultTimestamp")] +internal static extern uint SteamAPI_ISteamInventory_GetResultTimestamp(IntPtr instancePtr, int resultHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_CheckResultSteamID")] +internal static extern bool SteamAPI_ISteamInventory_CheckResultSteamID(IntPtr instancePtr, int resultHandle, ulong steamIDExpected); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_DestroyResult")] +internal static extern void SteamAPI_ISteamInventory_DestroyResult(IntPtr instancePtr, int resultHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GetAllItems")] +internal static extern bool SteamAPI_ISteamInventory_GetAllItems(IntPtr instancePtr, ref int pResultHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GetItemsByID")] +internal static extern bool SteamAPI_ISteamInventory_GetItemsByID(IntPtr instancePtr, ref int pResultHandle, [In, Out] ulong[] pInstanceIDs, uint unCountInstanceIDs); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_SerializeResult")] +internal static extern bool SteamAPI_ISteamInventory_SerializeResult(IntPtr instancePtr, int resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_DeserializeResult")] +internal static extern bool SteamAPI_ISteamInventory_DeserializeResult(IntPtr instancePtr, ref int pOutResultHandle, IntPtr pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GenerateItems")] +internal static extern bool SteamAPI_ISteamInventory_GenerateItems(IntPtr instancePtr, ref int pResultHandle, [In, Out] int[] pArrayItemDefs, [In, Out] uint[] punArrayQuantity, uint unArrayLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GrantPromoItems")] +internal static extern bool SteamAPI_ISteamInventory_GrantPromoItems(IntPtr instancePtr, ref int pResultHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_AddPromoItem")] +internal static extern bool SteamAPI_ISteamInventory_AddPromoItem(IntPtr instancePtr, ref int pResultHandle, int itemDef); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_AddPromoItems")] +internal static extern bool SteamAPI_ISteamInventory_AddPromoItems(IntPtr instancePtr, ref int pResultHandle, [In, Out] int[] pArrayItemDefs, uint unArrayLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_ConsumeItem")] +internal static extern bool SteamAPI_ISteamInventory_ConsumeItem(IntPtr instancePtr, ref int pResultHandle, ulong itemConsume, uint unQuantity); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_ExchangeItems")] +internal static extern bool SteamAPI_ISteamInventory_ExchangeItems(IntPtr instancePtr, ref int pResultHandle, [In, Out] int[] pArrayGenerate, [In, Out] uint[] punArrayGenerateQuantity, uint unArrayGenerateLength, [In, Out] ulong[] pArrayDestroy, [In, Out] uint[] punArrayDestroyQuantity, uint unArrayDestroyLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_TransferItemQuantity")] +internal static extern bool SteamAPI_ISteamInventory_TransferItemQuantity(IntPtr instancePtr, ref int pResultHandle, ulong itemIdSource, uint unQuantity, ulong itemIdDest); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_SendItemDropHeartbeat")] +internal static extern void SteamAPI_ISteamInventory_SendItemDropHeartbeat(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_TriggerItemDrop")] +internal static extern bool SteamAPI_ISteamInventory_TriggerItemDrop(IntPtr instancePtr, ref int pResultHandle, int dropListDefinition); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_TradeItems")] +internal static extern bool SteamAPI_ISteamInventory_TradeItems(IntPtr instancePtr, ref int pResultHandle, ulong steamIDTradePartner, [In, Out] ulong[] pArrayGive, [In, Out] uint[] pArrayGiveQuantity, uint nArrayGiveLength, [In, Out] ulong[] pArrayGet, [In, Out] uint[] pArrayGetQuantity, uint nArrayGetLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_LoadItemDefinitions")] +internal static extern bool SteamAPI_ISteamInventory_LoadItemDefinitions(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GetItemDefinitionIDs")] +internal static extern bool SteamAPI_ISteamInventory_GetItemDefinitionIDs(IntPtr instancePtr, [In, Out] int[] pItemDefIDs, ref uint punItemDefIDsArraySize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamInventory_GetItemDefinitionProperty")] +internal static extern bool SteamAPI_ISteamInventory_GetItemDefinitionProperty(IntPtr instancePtr, int iDefinition, string pchPropertyName, System.Text.StringBuilder pchValueBuffer, ref uint punValueBufferSize); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamVideo_GetVideoURL")] +internal static extern void SteamAPI_ISteamVideo_GetVideoURL(IntPtr instancePtr, uint unVideoAppID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamVideo_IsBroadcasting")] +internal static extern bool SteamAPI_ISteamVideo_IsBroadcasting(IntPtr instancePtr, ref int pnNumViewers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_InitGameServer")] +internal static extern bool SteamAPI_ISteamGameServer_InitGameServer(IntPtr instancePtr, uint unIP, char usGamePort, char usQueryPort, uint unFlags, uint nGameAppId, string pchVersionString); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetProduct")] +internal static extern void SteamAPI_ISteamGameServer_SetProduct(IntPtr instancePtr, string pszProduct); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetGameDescription")] +internal static extern void SteamAPI_ISteamGameServer_SetGameDescription(IntPtr instancePtr, string pszGameDescription); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetModDir")] +internal static extern void SteamAPI_ISteamGameServer_SetModDir(IntPtr instancePtr, string pszModDir); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetDedicatedServer")] +internal static extern void SteamAPI_ISteamGameServer_SetDedicatedServer(IntPtr instancePtr, bool bDedicated); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_LogOn")] +internal static extern void SteamAPI_ISteamGameServer_LogOn(IntPtr instancePtr, string pszToken); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_LogOnAnonymous")] +internal static extern void SteamAPI_ISteamGameServer_LogOnAnonymous(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_LogOff")] +internal static extern void SteamAPI_ISteamGameServer_LogOff(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_BLoggedOn")] +internal static extern bool SteamAPI_ISteamGameServer_BLoggedOn(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_BSecure")] +internal static extern bool SteamAPI_ISteamGameServer_BSecure(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_GetSteamID")] +internal static extern ulong SteamAPI_ISteamGameServer_GetSteamID(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_WasRestartRequested")] +internal static extern bool SteamAPI_ISteamGameServer_WasRestartRequested(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetMaxPlayerCount")] +internal static extern void SteamAPI_ISteamGameServer_SetMaxPlayerCount(IntPtr instancePtr, int cPlayersMax); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetBotPlayerCount")] +internal static extern void SteamAPI_ISteamGameServer_SetBotPlayerCount(IntPtr instancePtr, int cBotplayers); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetServerName")] +internal static extern void SteamAPI_ISteamGameServer_SetServerName(IntPtr instancePtr, string pszServerName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetMapName")] +internal static extern void SteamAPI_ISteamGameServer_SetMapName(IntPtr instancePtr, string pszMapName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetPasswordProtected")] +internal static extern void SteamAPI_ISteamGameServer_SetPasswordProtected(IntPtr instancePtr, bool bPasswordProtected); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetSpectatorPort")] +internal static extern void SteamAPI_ISteamGameServer_SetSpectatorPort(IntPtr instancePtr, char unSpectatorPort); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetSpectatorServerName")] +internal static extern void SteamAPI_ISteamGameServer_SetSpectatorServerName(IntPtr instancePtr, string pszSpectatorServerName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_ClearAllKeyValues")] +internal static extern void SteamAPI_ISteamGameServer_ClearAllKeyValues(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetKeyValue")] +internal static extern void SteamAPI_ISteamGameServer_SetKeyValue(IntPtr instancePtr, string pKey, string pValue); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetGameTags")] +internal static extern void SteamAPI_ISteamGameServer_SetGameTags(IntPtr instancePtr, string pchGameTags); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetGameData")] +internal static extern void SteamAPI_ISteamGameServer_SetGameData(IntPtr instancePtr, string pchGameData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetRegion")] +internal static extern void SteamAPI_ISteamGameServer_SetRegion(IntPtr instancePtr, string pszRegion); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate")] +internal static extern bool SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate(IntPtr instancePtr, uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref CSteamID pSteamIDUser); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection")] +internal static extern ulong SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SendUserDisconnect")] +internal static extern void SteamAPI_ISteamGameServer_SendUserDisconnect(IntPtr instancePtr, ulong steamIDUser); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_BUpdateUserData")] +internal static extern bool SteamAPI_ISteamGameServer_BUpdateUserData(IntPtr instancePtr, ulong steamIDUser, string pchPlayerName, uint uScore); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_GetAuthSessionTicket")] +internal static extern uint SteamAPI_ISteamGameServer_GetAuthSessionTicket(IntPtr instancePtr, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_BeginAuthSession")] +internal static extern uint SteamAPI_ISteamGameServer_BeginAuthSession(IntPtr instancePtr, IntPtr pAuthTicket, int cbAuthTicket, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_EndAuthSession")] +internal static extern void SteamAPI_ISteamGameServer_EndAuthSession(IntPtr instancePtr, ulong steamID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_CancelAuthTicket")] +internal static extern void SteamAPI_ISteamGameServer_CancelAuthTicket(IntPtr instancePtr, uint hAuthTicket); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_UserHasLicenseForApp")] +internal static extern uint SteamAPI_ISteamGameServer_UserHasLicenseForApp(IntPtr instancePtr, ulong steamID, uint appID); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_RequestUserGroupStatus")] +internal static extern bool SteamAPI_ISteamGameServer_RequestUserGroupStatus(IntPtr instancePtr, ulong steamIDUser, ulong steamIDGroup); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_GetGameplayStats")] +internal static extern void SteamAPI_ISteamGameServer_GetGameplayStats(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_GetServerReputation")] +internal static extern ulong SteamAPI_ISteamGameServer_GetServerReputation(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_GetPublicIP")] +internal static extern uint SteamAPI_ISteamGameServer_GetPublicIP(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_HandleIncomingPacket")] +internal static extern bool SteamAPI_ISteamGameServer_HandleIncomingPacket(IntPtr instancePtr, IntPtr pData, int cbData, uint srcIP, char srcPort); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_GetNextOutgoingPacket")] +internal static extern int SteamAPI_ISteamGameServer_GetNextOutgoingPacket(IntPtr instancePtr, IntPtr pOut, int cbMaxOut, ref uint pNetAdr, ref char pPort); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_EnableHeartbeats")] +internal static extern void SteamAPI_ISteamGameServer_EnableHeartbeats(IntPtr instancePtr, bool bActive); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_SetHeartbeatInterval")] +internal static extern void SteamAPI_ISteamGameServer_SetHeartbeatInterval(IntPtr instancePtr, int iHeartbeatInterval); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_ForceHeartbeat")] +internal static extern void SteamAPI_ISteamGameServer_ForceHeartbeat(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_AssociateWithClan")] +internal static extern ulong SteamAPI_ISteamGameServer_AssociateWithClan(IntPtr instancePtr, ulong steamIDClan); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility")] +internal static extern ulong SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility(IntPtr instancePtr, ulong steamIDNewPlayer); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_RequestUserStats")] +internal static extern ulong SteamAPI_ISteamGameServerStats_RequestUserStats(IntPtr instancePtr, ulong steamIDUser); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_GetUserStat")] +internal static extern bool SteamAPI_ISteamGameServerStats_GetUserStat(IntPtr instancePtr, ulong steamIDUser, string pchName, ref int pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_GetUserStat0")] +internal static extern bool SteamAPI_ISteamGameServerStats_GetUserStat0(IntPtr instancePtr, ulong steamIDUser, string pchName, ref float pData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_GetUserAchievement")] +internal static extern bool SteamAPI_ISteamGameServerStats_GetUserAchievement(IntPtr instancePtr, ulong steamIDUser, string pchName, ref bool pbAchieved); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_SetUserStat")] +internal static extern bool SteamAPI_ISteamGameServerStats_SetUserStat(IntPtr instancePtr, ulong steamIDUser, string pchName, int nData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_SetUserStat0")] +internal static extern bool SteamAPI_ISteamGameServerStats_SetUserStat0(IntPtr instancePtr, ulong steamIDUser, string pchName, float fData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat")] +internal static extern bool SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat(IntPtr instancePtr, ulong steamIDUser, string pchName, float flCountThisSession, double dSessionLength); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_SetUserAchievement")] +internal static extern bool SteamAPI_ISteamGameServerStats_SetUserAchievement(IntPtr instancePtr, ulong steamIDUser, string pchName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_ClearUserAchievement")] +internal static extern bool SteamAPI_ISteamGameServerStats_ClearUserAchievement(IntPtr instancePtr, ulong steamIDUser, string pchName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamGameServerStats_StoreUserStats")] +internal static extern ulong SteamAPI_ISteamGameServerStats_StoreUserStats(IntPtr instancePtr, ulong steamIDUser); + +} + +} + +namespace Valve.Steamworks +{ + + public abstract class ISteamClient + { + public abstract IntPtr GetIntPtr(); + public abstract uint CreateSteamPipe(); + public abstract bool BReleaseSteamPipe(uint hSteamPipe); + public abstract uint ConnectToGlobalUser(uint hSteamPipe); + public abstract uint CreateLocalUser(ref uint phSteamPipe,uint eAccountType); + public abstract void ReleaseUser(uint hSteamPipe,uint hUser); + public abstract ISteamUser GetISteamUser(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamGameServer GetISteamGameServer(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract void SetLocalIPBinding(uint unIP,char usPort); + public abstract ISteamFriends GetISteamFriends(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamUtils GetISteamUtils(uint hSteamPipe,string pchVersion); + public abstract ISteamMatchmaking GetISteamMatchmaking(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamMatchmakingServers GetISteamMatchmakingServers(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract IntPtr GetISteamGenericInterface(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamUserStats GetISteamUserStats(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamGameServerStats GetISteamGameServerStats(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract ISteamApps GetISteamApps(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamNetworking GetISteamNetworking(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamRemoteStorage GetISteamRemoteStorage(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract ISteamScreenshots GetISteamScreenshots(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract void RunFrame(); + public abstract uint GetIPCCallCount(); + public abstract void SetWarningMessageHook(IntPtr pFunction); + public abstract bool BShutdownIfAllPipesClosed(); + public abstract ISteamHTTP GetISteamHTTP(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract ISteamUnifiedMessages GetISteamUnifiedMessages(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract ISteamController GetISteamController(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamUGC GetISteamUGC(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamAppList GetISteamAppList(uint hSteamUser,uint hSteamPipe,string pchVersion); + public abstract ISteamMusic GetISteamMusic(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract ISteamMusicRemote GetISteamMusicRemote(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract ISteamHTMLSurface GetISteamHTMLSurface(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract void Set_SteamAPI_CPostAPIResultInProcess(IntPtr func); + public abstract void Remove_SteamAPI_CPostAPIResultInProcess(IntPtr func); + public abstract void Set_SteamAPI_CCheckCallbackRegisteredInProcess(IntPtr func); + public abstract ISteamInventory GetISteamInventory(uint hSteamuser,uint hSteamPipe,string pchVersion); + public abstract ISteamVideo GetISteamVideo(uint hSteamuser,uint hSteamPipe,string pchVersion); + } + + + public abstract class ISteamUser + { + public abstract IntPtr GetIntPtr(); + public abstract uint GetHSteamUser(); + public abstract bool BLoggedOn(); + public abstract ulong GetSteamID(); + public abstract int InitiateGameConnection(IntPtr pAuthBlob,int cbMaxAuthBlob,ulong steamIDGameServer,uint unIPServer,char usPortServer,bool bSecure); + public abstract void TerminateGameConnection(uint unIPServer,char usPortServer); + public abstract void TrackAppUsageEvent(ulong gameID,int eAppUsageEvent,string pchExtraInfo); + public abstract bool GetUserDataFolder(string pchBuffer,int cubBuffer); + public abstract void StartVoiceRecording(); + public abstract void StopVoiceRecording(); + public abstract uint GetAvailableVoice(ref uint pcbCompressed,ref uint pcbUncompressed,uint nUncompressedVoiceDesiredSampleRate); + public abstract uint GetVoice(bool bWantCompressed,IntPtr pDestBuffer,uint cbDestBufferSize,ref uint nBytesWritten,bool bWantUncompressed,IntPtr pUncompressedDestBuffer,uint cbUncompressedDestBufferSize,ref uint nUncompressBytesWritten,uint nUncompressedVoiceDesiredSampleRate); + public abstract uint DecompressVoice(IntPtr pCompressed,uint cbCompressed,IntPtr pDestBuffer,uint cbDestBufferSize,ref uint nBytesWritten,uint nDesiredSampleRate); + public abstract uint GetVoiceOptimalSampleRate(); + public abstract uint GetAuthSessionTicket(IntPtr pTicket,int cbMaxTicket,ref uint pcbTicket); + public abstract uint BeginAuthSession(IntPtr pAuthTicket,int cbAuthTicket,ulong steamID); + public abstract void EndAuthSession(ulong steamID); + public abstract void CancelAuthTicket(uint hAuthTicket); + public abstract uint UserHasLicenseForApp(ulong steamID,uint appID); + public abstract bool BIsBehindNAT(); + public abstract void AdvertiseGame(ulong steamIDGameServer,uint unIPServer,char usPortServer); + public abstract ulong RequestEncryptedAppTicket(IntPtr pDataToInclude,int cbDataToInclude); + public abstract bool GetEncryptedAppTicket(IntPtr pTicket,int cbMaxTicket,ref uint pcbTicket); + public abstract int GetGameBadgeLevel(int nSeries,bool bFoil); + public abstract int GetPlayerSteamLevel(); + public abstract ulong RequestStoreAuthURL(string pchRedirectURL); + } + + + public abstract class ISteamFriends + { + public abstract IntPtr GetIntPtr(); + public abstract string GetPersonaName(); + public abstract ulong SetPersonaName(string pchPersonaName); + public abstract uint GetPersonaState(); + public abstract int GetFriendCount(int iFriendFlags); + public abstract ulong GetFriendByIndex(int iFriend,int iFriendFlags); + public abstract uint GetFriendRelationship(ulong steamIDFriend); + public abstract uint GetFriendPersonaState(ulong steamIDFriend); + public abstract string GetFriendPersonaName(ulong steamIDFriend); + public abstract bool GetFriendGamePlayed(ulong steamIDFriend,out FriendGameInfo_t pFriendGameInfo); + public abstract string GetFriendPersonaNameHistory(ulong steamIDFriend,int iPersonaName); + public abstract int GetFriendSteamLevel(ulong steamIDFriend); + public abstract string GetPlayerNickname(ulong steamIDPlayer); + public abstract int GetFriendsGroupCount(); + public abstract char GetFriendsGroupIDByIndex(int iFG); + public abstract string GetFriendsGroupName(char friendsGroupID); + public abstract int GetFriendsGroupMembersCount(char friendsGroupID); + public abstract void GetFriendsGroupMembersList(char friendsGroupID,out CSteamID [] pOutSteamIDMembers); + public abstract bool HasFriend(ulong steamIDFriend,int iFriendFlags); + public abstract int GetClanCount(); + public abstract ulong GetClanByIndex(int iClan); + public abstract string GetClanName(ulong steamIDClan); + public abstract string GetClanTag(ulong steamIDClan); + public abstract bool GetClanActivityCounts(ulong steamIDClan,ref int pnOnline,ref int pnInGame,ref int pnChatting); + public abstract ulong DownloadClanActivityCounts(CSteamID [] psteamIDClans); + public abstract int GetFriendCountFromSource(ulong steamIDSource); + public abstract ulong GetFriendFromSourceByIndex(ulong steamIDSource,int iFriend); + public abstract bool IsUserInSource(ulong steamIDUser,ulong steamIDSource); + public abstract void SetInGameVoiceSpeaking(ulong steamIDUser,bool bSpeaking); + public abstract void ActivateGameOverlay(string pchDialog); + public abstract void ActivateGameOverlayToUser(string pchDialog,ulong steamID); + public abstract void ActivateGameOverlayToWebPage(string pchURL); + public abstract void ActivateGameOverlayToStore(uint nAppID,char eFlag); + public abstract void SetPlayedWith(ulong steamIDUserPlayedWith); + public abstract void ActivateGameOverlayInviteDialog(ulong steamIDLobby); + public abstract int GetSmallFriendAvatar(ulong steamIDFriend); + public abstract int GetMediumFriendAvatar(ulong steamIDFriend); + public abstract int GetLargeFriendAvatar(ulong steamIDFriend); + public abstract bool RequestUserInformation(ulong steamIDUser,bool bRequireNameOnly); + public abstract ulong RequestClanOfficerList(ulong steamIDClan); + public abstract ulong GetClanOwner(ulong steamIDClan); + public abstract int GetClanOfficerCount(ulong steamIDClan); + public abstract ulong GetClanOfficerByIndex(ulong steamIDClan,int iOfficer); + public abstract uint GetUserRestrictions(); + public abstract bool SetRichPresence(string pchKey,string pchValue); + public abstract void ClearRichPresence(); + public abstract string GetFriendRichPresence(ulong steamIDFriend,string pchKey); + public abstract int GetFriendRichPresenceKeyCount(ulong steamIDFriend); + public abstract string GetFriendRichPresenceKeyByIndex(ulong steamIDFriend,int iKey); + public abstract void RequestFriendRichPresence(ulong steamIDFriend); + public abstract bool InviteUserToGame(ulong steamIDFriend,string pchConnectString); + public abstract int GetCoplayFriendCount(); + public abstract ulong GetCoplayFriend(int iCoplayFriend); + public abstract int GetFriendCoplayTime(ulong steamIDFriend); + public abstract uint GetFriendCoplayGame(ulong steamIDFriend); + public abstract ulong JoinClanChatRoom(ulong steamIDClan); + public abstract bool LeaveClanChatRoom(ulong steamIDClan); + public abstract int GetClanChatMemberCount(ulong steamIDClan); + public abstract ulong GetChatMemberByIndex(ulong steamIDClan,int iUser); + public abstract bool SendClanChatMessage(ulong steamIDClanChat,string pchText); + public abstract int GetClanChatMessage(ulong steamIDClanChat,int iMessage,IntPtr prgchText,int cchTextMax,ref uint peChatEntryType,out CSteamID psteamidChatter); + public abstract bool IsClanChatAdmin(ulong steamIDClanChat,ulong steamIDUser); + public abstract bool IsClanChatWindowOpenInSteam(ulong steamIDClanChat); + public abstract bool OpenClanChatWindowInSteam(ulong steamIDClanChat); + public abstract bool CloseClanChatWindowInSteam(ulong steamIDClanChat); + public abstract bool SetListenForFriendsMessages(bool bInterceptEnabled); + public abstract bool ReplyToFriendMessage(ulong steamIDFriend,string pchMsgToSend); + public abstract int GetFriendMessage(ulong steamIDFriend,int iMessageID,IntPtr pvData,int cubData,ref uint peChatEntryType); + public abstract ulong GetFollowerCount(ulong steamID); + public abstract ulong IsFollowing(ulong steamID); + public abstract ulong EnumerateFollowingList(uint unStartIndex); + } + + + public abstract class ISteamUtils + { + public abstract IntPtr GetIntPtr(); + public abstract uint GetSecondsSinceAppActive(); + public abstract uint GetSecondsSinceComputerActive(); + public abstract int GetConnectedUniverse(); + public abstract uint GetServerRealTime(); + public abstract string GetIPCountry(); + public abstract bool GetImageSize(int iImage,ref uint pnWidth,ref uint pnHeight); + public abstract bool GetImageRGBA(int iImage,IntPtr pubDest,int nDestBufferSize); + public abstract bool GetCSERIPPort(ref uint unIP,ref char usPort); + public abstract byte GetCurrentBatteryPower(); + public abstract uint GetAppID(); + public abstract void SetOverlayNotificationPosition(uint eNotificationPosition); + public abstract bool IsAPICallCompleted(ulong hSteamAPICall,ref bool pbFailed); + public abstract int GetAPICallFailureReason(ulong hSteamAPICall); + public abstract bool GetAPICallResult(ulong hSteamAPICall,IntPtr pCallback,int cubCallback,int iCallbackExpected,ref bool pbFailed); + public abstract void RunFrame(); + public abstract uint GetIPCCallCount(); + public abstract void SetWarningMessageHook(IntPtr pFunction); + public abstract bool IsOverlayEnabled(); + public abstract bool BOverlayNeedsPresent(); + public abstract ulong CheckFileSignature(string szFileName); + public abstract bool ShowGamepadTextInput(int eInputMode,int eLineInputMode,string pchDescription,uint unCharMax,string pchExistingText); + public abstract uint GetEnteredGamepadTextLength(); + public abstract bool GetEnteredGamepadTextInput(string pchText,uint cchText); + public abstract string GetSteamUILanguage(); + public abstract bool IsSteamRunningInVR(); + public abstract void SetOverlayNotificationInset(int nHorizontalInset,int nVerticalInset); + } + + + public abstract class ISteamMatchmaking + { + public abstract IntPtr GetIntPtr(); + public abstract int GetFavoriteGameCount(); + public abstract bool GetFavoriteGame(int iGame,ref uint pnAppID,ref uint pnIP,ref char pnConnPort,ref char pnQueryPort,ref uint punFlags,ref uint pRTime32LastPlayedOnServer); + public abstract int AddFavoriteGame(uint nAppID,uint nIP,char nConnPort,char nQueryPort,uint unFlags,uint rTime32LastPlayedOnServer); + public abstract bool RemoveFavoriteGame(uint nAppID,uint nIP,char nConnPort,char nQueryPort,uint unFlags); + public abstract ulong RequestLobbyList(); + public abstract void AddRequestLobbyListStringFilter(string pchKeyToMatch,string pchValueToMatch,uint eComparisonType); + public abstract void AddRequestLobbyListNumericalFilter(string pchKeyToMatch,int nValueToMatch,uint eComparisonType); + public abstract void AddRequestLobbyListNearValueFilter(string pchKeyToMatch,int nValueToBeCloseTo); + public abstract void AddRequestLobbyListFilterSlotsAvailable(int nSlotsAvailable); + public abstract void AddRequestLobbyListDistanceFilter(uint eLobbyDistanceFilter); + public abstract void AddRequestLobbyListResultCountFilter(int cMaxResults); + public abstract void AddRequestLobbyListCompatibleMembersFilter(ulong steamIDLobby); + public abstract ulong GetLobbyByIndex(int iLobby); + public abstract ulong CreateLobby(uint eLobbyType,int cMaxMembers); + public abstract ulong JoinLobby(ulong steamIDLobby); + public abstract void LeaveLobby(ulong steamIDLobby); + public abstract bool InviteUserToLobby(ulong steamIDLobby,ulong steamIDInvitee); + public abstract int GetNumLobbyMembers(ulong steamIDLobby); + public abstract ulong GetLobbyMemberByIndex(ulong steamIDLobby,int iMember); + public abstract string GetLobbyData(ulong steamIDLobby,string pchKey); + public abstract bool SetLobbyData(ulong steamIDLobby,string pchKey,string pchValue); + public abstract int GetLobbyDataCount(ulong steamIDLobby); + public abstract bool GetLobbyDataByIndex(ulong steamIDLobby,int iLobbyData,string pchKey,int cchKeyBufferSize,string pchValue,int cchValueBufferSize); + public abstract bool DeleteLobbyData(ulong steamIDLobby,string pchKey); + public abstract string GetLobbyMemberData(ulong steamIDLobby,ulong steamIDUser,string pchKey); + public abstract void SetLobbyMemberData(ulong steamIDLobby,string pchKey,string pchValue); + public abstract bool SendLobbyChatMsg(ulong steamIDLobby,IntPtr pvMsgBody,int cubMsgBody); + public abstract int GetLobbyChatEntry(ulong steamIDLobby,int iChatID,out CSteamID pSteamIDUser,IntPtr pvData,int cubData,ref uint peChatEntryType); + public abstract bool RequestLobbyData(ulong steamIDLobby); + public abstract void SetLobbyGameServer(ulong steamIDLobby,uint unGameServerIP,char unGameServerPort,ulong steamIDGameServer); + public abstract bool GetLobbyGameServer(ulong steamIDLobby,ref uint punGameServerIP,ref char punGameServerPort,out CSteamID psteamIDGameServer); + public abstract bool SetLobbyMemberLimit(ulong steamIDLobby,int cMaxMembers); + public abstract int GetLobbyMemberLimit(ulong steamIDLobby); + public abstract bool SetLobbyType(ulong steamIDLobby,uint eLobbyType); + public abstract bool SetLobbyJoinable(ulong steamIDLobby,bool bLobbyJoinable); + public abstract ulong GetLobbyOwner(ulong steamIDLobby); + public abstract bool SetLobbyOwner(ulong steamIDLobby,ulong steamIDNewOwner); + public abstract bool SetLinkedLobby(ulong steamIDLobby,ulong steamIDLobbyDependent); + } + + + public abstract class ISteamMatchmakingServerListResponse + { + public abstract IntPtr GetIntPtr(); + public abstract void ServerResponded(uint hRequest,int iServer); + public abstract void ServerFailedToRespond(uint hRequest,int iServer); + public abstract void RefreshComplete(uint hRequest,uint response); + } + + + public abstract class ISteamMatchmakingPingResponse + { + public abstract IntPtr GetIntPtr(); + public abstract void ServerResponded(IntPtr server); + public abstract void ServerFailedToRespond(); + } + + + public abstract class ISteamMatchmakingPlayersResponse + { + public abstract IntPtr GetIntPtr(); + public abstract void AddPlayerToList(string pchName,int nScore,float flTimePlayed); + public abstract void PlayersFailedToRespond(); + public abstract void PlayersRefreshComplete(); + } + + + public abstract class ISteamMatchmakingRulesResponse + { + public abstract IntPtr GetIntPtr(); + public abstract void RulesResponded(string pchRule,string pchValue); + public abstract void RulesFailedToRespond(); + public abstract void RulesRefreshComplete(); + } + + + public abstract class ISteamMatchmakingServers + { + public abstract IntPtr GetIntPtr(); + public abstract uint RequestInternetServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse); + public abstract uint RequestLANServerList(uint iApp,ISteamMatchmakingServerListResponse pRequestServersResponse); + public abstract uint RequestFriendsServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse); + public abstract uint RequestFavoritesServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse); + public abstract uint RequestHistoryServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse); + public abstract uint RequestSpectatorServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse); + public abstract void ReleaseRequest(uint hServerListRequest); + public abstract gameserveritem_t GetServerDetails(uint hRequest,int iServer); + public abstract void CancelQuery(uint hRequest); + public abstract void RefreshQuery(uint hRequest); + public abstract bool IsRefreshing(uint hRequest); + public abstract int GetServerCount(uint hRequest); + public abstract void RefreshServer(uint hRequest,int iServer); + public abstract uint PingServer(uint unIP,char usPort,ISteamMatchmakingPingResponse pRequestServersResponse); + public abstract uint PlayerDetails(uint unIP,char usPort,ISteamMatchmakingPlayersResponse pRequestServersResponse); + public abstract uint ServerRules(uint unIP,char usPort,ISteamMatchmakingRulesResponse pRequestServersResponse); + public abstract void CancelServerQuery(uint hServerQuery); + } + + + public abstract class ISteamRemoteStorage + { + public abstract IntPtr GetIntPtr(); + public abstract bool FileWrite(string pchFile,IntPtr pvData,int cubData); + public abstract int FileRead(string pchFile,IntPtr pvData,int cubDataToRead); + public abstract ulong FileWriteAsync(string pchFile,IntPtr pvData,uint cubData); + public abstract ulong FileReadAsync(string pchFile,uint nOffset,uint cubToRead); + public abstract bool FileReadAsyncComplete(ulong hReadCall,IntPtr pvBuffer,uint cubToRead); + public abstract bool FileForget(string pchFile); + public abstract bool FileDelete(string pchFile); + public abstract ulong FileShare(string pchFile); + public abstract bool SetSyncPlatforms(string pchFile,uint eRemoteStoragePlatform); + public abstract ulong FileWriteStreamOpen(string pchFile); + public abstract bool FileWriteStreamWriteChunk(ulong writeHandle,IntPtr pvData,int cubData); + public abstract bool FileWriteStreamClose(ulong writeHandle); + public abstract bool FileWriteStreamCancel(ulong writeHandle); + public abstract bool FileExists(string pchFile); + public abstract bool FilePersisted(string pchFile); + public abstract int GetFileSize(string pchFile); + public abstract long GetFileTimestamp(string pchFile); + public abstract uint GetSyncPlatforms(string pchFile); + public abstract int GetFileCount(); + public abstract string GetFileNameAndSize(int iFile,ref int pnFileSizeInBytes); + public abstract bool GetQuota(ref int pnTotalBytes,ref int puAvailableBytes); + public abstract bool IsCloudEnabledForAccount(); + public abstract bool IsCloudEnabledForApp(); + public abstract void SetCloudEnabledForApp(bool bEnabled); + public abstract ulong UGCDownload(ulong hContent,uint unPriority); + public abstract bool GetUGCDownloadProgress(ulong hContent,ref int pnBytesDownloaded,ref int pnBytesExpected); + public abstract bool GetUGCDetails(ulong hContent,ref uint pnAppID,string ppchName,ref int pnFileSizeInBytes,out CSteamID pSteamIDOwner); + public abstract int UGCRead(ulong hContent,IntPtr pvData,int cubDataToRead,uint cOffset,uint eAction); + public abstract int GetCachedUGCCount(); + public abstract ulong GetCachedUGCHandle(int iCachedContent); + public abstract ulong PublishWorkshopFile(string pchFile,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags,uint eWorkshopFileType); + public abstract ulong CreatePublishedFileUpdateRequest(ulong unPublishedFileId); + public abstract bool UpdatePublishedFileFile(ulong updateHandle,string pchFile); + public abstract bool UpdatePublishedFilePreviewFile(ulong updateHandle,string pchPreviewFile); + public abstract bool UpdatePublishedFileTitle(ulong updateHandle,string pchTitle); + public abstract bool UpdatePublishedFileDescription(ulong updateHandle,string pchDescription); + public abstract bool UpdatePublishedFileVisibility(ulong updateHandle,uint eVisibility); + public abstract bool UpdatePublishedFileTags(ulong updateHandle,ref SteamParamStringArray_t pTags); + public abstract ulong CommitPublishedFileUpdate(ulong updateHandle); + public abstract ulong GetPublishedFileDetails(ulong unPublishedFileId,uint unMaxSecondsOld); + public abstract ulong DeletePublishedFile(ulong unPublishedFileId); + public abstract ulong EnumerateUserPublishedFiles(uint unStartIndex); + public abstract ulong SubscribePublishedFile(ulong unPublishedFileId); + public abstract ulong EnumerateUserSubscribedFiles(uint unStartIndex); + public abstract ulong UnsubscribePublishedFile(ulong unPublishedFileId); + public abstract bool UpdatePublishedFileSetChangeDescription(ulong updateHandle,string pchChangeDescription); + public abstract ulong GetPublishedItemVoteDetails(ulong unPublishedFileId); + public abstract ulong UpdateUserPublishedItemVote(ulong unPublishedFileId,bool bVoteUp); + public abstract ulong GetUserPublishedItemVoteDetails(ulong unPublishedFileId); + public abstract ulong EnumerateUserSharedWorkshopFiles(ulong steamId,uint unStartIndex,ref SteamParamStringArray_t pRequiredTags,ref SteamParamStringArray_t pExcludedTags); + public abstract ulong PublishVideo(uint eVideoProvider,string pchVideoAccount,string pchVideoIdentifier,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags); + public abstract ulong SetUserPublishedFileAction(ulong unPublishedFileId,uint eAction); + public abstract ulong EnumeratePublishedFilesByUserAction(uint eAction,uint unStartIndex); + public abstract ulong EnumeratePublishedWorkshopFiles(uint eEnumerationType,uint unStartIndex,uint unCount,uint unDays,ref SteamParamStringArray_t pTags,ref SteamParamStringArray_t pUserTags); + public abstract ulong UGCDownloadToLocation(ulong hContent,string pchLocation,uint unPriority); + } + + + public abstract class ISteamUserStats + { + public abstract IntPtr GetIntPtr(); + public abstract bool RequestCurrentStats(); + public abstract bool GetStat(string pchName,ref int pData); + public abstract bool GetStat0(string pchName,ref float pData); + public abstract bool SetStat(string pchName,int nData); + public abstract bool SetStat0(string pchName,float fData); + public abstract bool UpdateAvgRateStat(string pchName,float flCountThisSession,double dSessionLength); + public abstract bool GetAchievement(string pchName,ref bool pbAchieved); + public abstract bool SetAchievement(string pchName); + public abstract bool ClearAchievement(string pchName); + public abstract bool GetAchievementAndUnlockTime(string pchName,ref bool pbAchieved,ref uint punUnlockTime); + public abstract bool StoreStats(); + public abstract int GetAchievementIcon(string pchName); + public abstract string GetAchievementDisplayAttribute(string pchName,string pchKey); + public abstract bool IndicateAchievementProgress(string pchName,uint nCurProgress,uint nMaxProgress); + public abstract uint GetNumAchievements(); + public abstract string GetAchievementName(uint iAchievement); + public abstract ulong RequestUserStats(ulong steamIDUser); + public abstract bool GetUserStat(ulong steamIDUser,string pchName,ref int pData); + public abstract bool GetUserStat0(ulong steamIDUser,string pchName,ref float pData); + public abstract bool GetUserAchievement(ulong steamIDUser,string pchName,ref bool pbAchieved); + public abstract bool GetUserAchievementAndUnlockTime(ulong steamIDUser,string pchName,ref bool pbAchieved,ref uint punUnlockTime); + public abstract bool ResetAllStats(bool bAchievementsToo); + public abstract ulong FindOrCreateLeaderboard(string pchLeaderboardName,uint eLeaderboardSortMethod,uint eLeaderboardDisplayType); + public abstract ulong FindLeaderboard(string pchLeaderboardName); + public abstract string GetLeaderboardName(ulong hSteamLeaderboard); + public abstract int GetLeaderboardEntryCount(ulong hSteamLeaderboard); + public abstract uint GetLeaderboardSortMethod(ulong hSteamLeaderboard); + public abstract uint GetLeaderboardDisplayType(ulong hSteamLeaderboard); + public abstract ulong DownloadLeaderboardEntries(ulong hSteamLeaderboard,uint eLeaderboardDataRequest,int nRangeStart,int nRangeEnd); + public abstract ulong DownloadLeaderboardEntriesForUsers(ulong hSteamLeaderboard,CSteamID [] prgUsers); + public abstract bool GetDownloadedLeaderboardEntry(ulong hSteamLeaderboardEntries,int index,ref LeaderboardEntry_t pLeaderboardEntry,ref int pDetails,int cDetailsMax); + public abstract ulong UploadLeaderboardScore(ulong hSteamLeaderboard,uint eLeaderboardUploadScoreMethod,int nScore,ref int pScoreDetails,int cScoreDetailsCount); + public abstract ulong AttachLeaderboardUGC(ulong hSteamLeaderboard,ulong hUGC); + public abstract ulong GetNumberOfCurrentPlayers(); + public abstract ulong RequestGlobalAchievementPercentages(); + public abstract int GetMostAchievedAchievementInfo(string pchName,uint unNameBufLen,ref float pflPercent,ref bool pbAchieved); + public abstract int GetNextMostAchievedAchievementInfo(int iIteratorPrevious,string pchName,uint unNameBufLen,ref float pflPercent,ref bool pbAchieved); + public abstract bool GetAchievementAchievedPercent(string pchName,ref float pflPercent); + public abstract ulong RequestGlobalStats(int nHistoryDays); + public abstract bool GetGlobalStat(string pchStatName,ref long pData); + public abstract bool GetGlobalStat0(string pchStatName,ref double pData); + public abstract int GetGlobalStatHistory(string pchStatName,long [] pData); + public abstract int GetGlobalStatHistory0(string pchStatName,double [] pData); + } + + + public abstract class ISteamApps + { + public abstract IntPtr GetIntPtr(); + public abstract bool BIsSubscribed(); + public abstract bool BIsLowViolence(); + public abstract bool BIsCybercafe(); + public abstract bool BIsVACBanned(); + public abstract string GetCurrentGameLanguage(); + public abstract string GetAvailableGameLanguages(); + public abstract bool BIsSubscribedApp(uint appID); + public abstract bool BIsDlcInstalled(uint appID); + public abstract uint GetEarliestPurchaseUnixTime(uint nAppID); + public abstract bool BIsSubscribedFromFreeWeekend(); + public abstract int GetDLCCount(); + public abstract bool BGetDLCDataByIndex(int iDLC,ref uint pAppID,ref bool pbAvailable,string pchName,int cchNameBufferSize); + public abstract void InstallDLC(uint nAppID); + public abstract void UninstallDLC(uint nAppID); + public abstract void RequestAppProofOfPurchaseKey(uint nAppID); + public abstract bool GetCurrentBetaName(string pchName,int cchNameBufferSize); + public abstract bool MarkContentCorrupt(bool bMissingFilesOnly); + public abstract uint GetInstalledDepots(uint appID,ref uint pvecDepots,uint cMaxDepots); + public abstract uint GetAppInstallDir(uint appID,string pchFolder,uint cchFolderBufferSize); + public abstract bool BIsAppInstalled(uint appID); + public abstract ulong GetAppOwner(); + public abstract string GetLaunchQueryParam(string pchKey); + public abstract bool GetDlcDownloadProgress(uint nAppID,ref ulong punBytesDownloaded,ref ulong punBytesTotal); + public abstract int GetAppBuildId(); + } + + + public abstract class ISteamNetworking + { + public abstract IntPtr GetIntPtr(); + public abstract bool SendP2PPacket(ulong steamIDRemote,IntPtr pubData,uint cubData,uint eP2PSendType,int nChannel); + public abstract bool IsP2PPacketAvailable(ref uint pcubMsgSize,int nChannel); + public abstract bool ReadP2PPacket(IntPtr pubDest,uint cubDest,ref uint pcubMsgSize,ref CSteamID psteamIDRemote,int nChannel); + public abstract bool AcceptP2PSessionWithUser(ulong steamIDRemote); + public abstract bool CloseP2PSessionWithUser(ulong steamIDRemote); + public abstract bool CloseP2PChannelWithUser(ulong steamIDRemote,int nChannel); + public abstract bool GetP2PSessionState(ulong steamIDRemote,ref P2PSessionState_t pConnectionState); + public abstract bool AllowP2PPacketRelay(bool bAllow); + public abstract uint CreateListenSocket(int nVirtualP2PPort,uint nIP,char nPort,bool bAllowUseOfPacketRelay); + public abstract uint CreateP2PConnectionSocket(ulong steamIDTarget,int nVirtualPort,int nTimeoutSec,bool bAllowUseOfPacketRelay); + public abstract uint CreateConnectionSocket(uint nIP,char nPort,int nTimeoutSec); + public abstract bool DestroySocket(uint hSocket,bool bNotifyRemoteEnd); + public abstract bool DestroyListenSocket(uint hSocket,bool bNotifyRemoteEnd); + public abstract bool SendDataOnSocket(uint hSocket,IntPtr pubData,uint cubData,bool bReliable); + public abstract bool IsDataAvailableOnSocket(uint hSocket,ref uint pcubMsgSize); + public abstract bool RetrieveDataFromSocket(uint hSocket,IntPtr pubDest,uint cubDest,ref uint pcubMsgSize); + public abstract bool IsDataAvailable(uint hListenSocket,ref uint pcubMsgSize,ref uint phSocket); + public abstract bool RetrieveData(uint hListenSocket,IntPtr pubDest,uint cubDest,ref uint pcubMsgSize,ref uint phSocket); + public abstract bool GetSocketInfo(uint hSocket,ref CSteamID pSteamIDRemote,ref int peSocketStatus,ref uint punIPRemote,ref char punPortRemote); + public abstract bool GetListenSocketInfo(uint hListenSocket,ref uint pnIP,ref char pnPort); + public abstract uint GetSocketConnectionType(uint hSocket); + public abstract int GetMaxPacketSize(uint hSocket); + } + + + public abstract class ISteamScreenshots + { + public abstract IntPtr GetIntPtr(); + public abstract uint WriteScreenshot(IntPtr pubRGB,uint cubRGB,int nWidth,int nHeight); + public abstract uint AddScreenshotToLibrary(string pchFilename,string pchThumbnailFilename,int nWidth,int nHeight); + public abstract void TriggerScreenshot(); + public abstract void HookScreenshots(bool bHook); + public abstract bool SetLocation(uint hScreenshot,string pchLocation); + public abstract bool TagUser(uint hScreenshot,ulong steamID); + public abstract bool TagPublishedFile(uint hScreenshot,ulong unPublishedFileID); + } + + + public abstract class ISteamMusic + { + public abstract IntPtr GetIntPtr(); + public abstract bool BIsEnabled(); + public abstract bool BIsPlaying(); + public abstract int GetPlaybackStatus(); + public abstract void Play(); + public abstract void Pause(); + public abstract void PlayPrevious(); + public abstract void PlayNext(); + public abstract void SetVolume(float flVolume); + public abstract float GetVolume(); + } + + + public abstract class ISteamMusicRemote + { + public abstract IntPtr GetIntPtr(); + public abstract bool RegisterSteamMusicRemote(string pchName); + public abstract bool DeregisterSteamMusicRemote(); + public abstract bool BIsCurrentMusicRemote(); + public abstract bool BActivationSuccess(bool bValue); + public abstract bool SetDisplayName(string pchDisplayName); + public abstract bool SetPNGIcon_64x64(IntPtr pvBuffer,uint cbBufferLength); + public abstract bool EnablePlayPrevious(bool bValue); + public abstract bool EnablePlayNext(bool bValue); + public abstract bool EnableShuffled(bool bValue); + public abstract bool EnableLooped(bool bValue); + public abstract bool EnableQueue(bool bValue); + public abstract bool EnablePlaylists(bool bValue); + public abstract bool UpdatePlaybackStatus(int nStatus); + public abstract bool UpdateShuffled(bool bValue); + public abstract bool UpdateLooped(bool bValue); + public abstract bool UpdateVolume(float flValue); + public abstract bool CurrentEntryWillChange(); + public abstract bool CurrentEntryIsAvailable(bool bAvailable); + public abstract bool UpdateCurrentEntryText(string pchText); + public abstract bool UpdateCurrentEntryElapsedSeconds(int nValue); + public abstract bool UpdateCurrentEntryCoverArt(IntPtr pvBuffer,uint cbBufferLength); + public abstract bool CurrentEntryDidChange(); + public abstract bool QueueWillChange(); + public abstract bool ResetQueueEntries(); + public abstract bool SetQueueEntry(int nID,int nPosition,string pchEntryText); + public abstract bool SetCurrentQueueEntry(int nID); + public abstract bool QueueDidChange(); + public abstract bool PlaylistWillChange(); + public abstract bool ResetPlaylistEntries(); + public abstract bool SetPlaylistEntry(int nID,int nPosition,string pchEntryText); + public abstract bool SetCurrentPlaylistEntry(int nID); + public abstract bool PlaylistDidChange(); + } + + + public abstract class ISteamHTTP + { + public abstract IntPtr GetIntPtr(); + public abstract uint CreateHTTPRequest(uint eHTTPRequestMethod,string pchAbsoluteURL); + public abstract bool SetHTTPRequestContextValue(uint hRequest,ulong ulContextValue); + public abstract bool SetHTTPRequestNetworkActivityTimeout(uint hRequest,uint unTimeoutSeconds); + public abstract bool SetHTTPRequestHeaderValue(uint hRequest,string pchHeaderName,string pchHeaderValue); + public abstract bool SetHTTPRequestGetOrPostParameter(uint hRequest,string pchParamName,string pchParamValue); + public abstract bool SendHTTPRequest(uint hRequest,ref ulong pCallHandle); + public abstract bool SendHTTPRequestAndStreamResponse(uint hRequest,ref ulong pCallHandle); + public abstract bool DeferHTTPRequest(uint hRequest); + public abstract bool PrioritizeHTTPRequest(uint hRequest); + public abstract bool GetHTTPResponseHeaderSize(uint hRequest,string pchHeaderName,ref uint unResponseHeaderSize); + public abstract bool GetHTTPResponseHeaderValue(uint hRequest,string pchHeaderName,IntPtr pHeaderValueBuffer,uint unBufferSize); + public abstract bool GetHTTPResponseBodySize(uint hRequest,ref uint unBodySize); + public abstract bool GetHTTPResponseBodyData(uint hRequest,IntPtr pBodyDataBuffer,uint unBufferSize); + public abstract bool GetHTTPStreamingResponseBodyData(uint hRequest,uint cOffset,IntPtr pBodyDataBuffer,uint unBufferSize); + public abstract bool ReleaseHTTPRequest(uint hRequest); + public abstract bool GetHTTPDownloadProgressPct(uint hRequest,ref float pflPercentOut); + public abstract bool SetHTTPRequestRawPostBody(uint hRequest,string pchContentType,IntPtr pubBody,uint unBodyLen); + public abstract uint CreateCookieContainer(bool bAllowResponsesToModify); + public abstract bool ReleaseCookieContainer(uint hCookieContainer); + public abstract bool SetCookie(uint hCookieContainer,string pchHost,string pchUrl,string pchCookie); + public abstract bool SetHTTPRequestCookieContainer(uint hRequest,uint hCookieContainer); + public abstract bool SetHTTPRequestUserAgentInfo(uint hRequest,string pchUserAgentInfo); + public abstract bool SetHTTPRequestRequiresVerifiedCertificate(uint hRequest,bool bRequireVerifiedCertificate); + public abstract bool SetHTTPRequestAbsoluteTimeoutMS(uint hRequest,uint unMilliseconds); + public abstract bool GetHTTPRequestWasTimedOut(uint hRequest,ref bool pbWasTimedOut); + } + + + public abstract class ISteamUnifiedMessages + { + public abstract IntPtr GetIntPtr(); + public abstract ulong SendMethod(string pchServiceMethod,IntPtr pRequestBuffer,uint unRequestBufferSize,ulong unContext); + public abstract bool GetMethodResponseInfo(ulong hHandle,ref uint punResponseSize,ref uint peResult); + public abstract bool GetMethodResponseData(ulong hHandle,IntPtr pResponseBuffer,uint unResponseBufferSize,bool bAutoRelease); + public abstract bool ReleaseMethod(ulong hHandle); + public abstract bool SendNotification(string pchServiceNotification,IntPtr pNotificationBuffer,uint unNotificationBufferSize); + } + + + public abstract class ISteamController + { + public abstract IntPtr GetIntPtr(); + public abstract bool Init(); + public abstract bool Shutdown(); + public abstract void RunFrame(); + public abstract int GetConnectedControllers(ref ulong handlesOut); + public abstract bool ShowBindingPanel(ulong controllerHandle); + public abstract ulong GetActionSetHandle(string pszActionSetName); + public abstract void ActivateActionSet(ulong controllerHandle,ulong actionSetHandle); + public abstract ulong GetCurrentActionSet(ulong controllerHandle); + public abstract ulong GetDigitalActionHandle(string pszActionName); + public abstract ControllerDigitalActionData_t GetDigitalActionData(ulong controllerHandle,ulong digitalActionHandle); + public abstract int GetDigitalActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong digitalActionHandle,ref uint originsOut); + public abstract ulong GetAnalogActionHandle(string pszActionName); + public abstract ControllerAnalogActionData_t GetAnalogActionData(ulong controllerHandle,ulong analogActionHandle); + public abstract int GetAnalogActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong analogActionHandle,ref uint originsOut); + public abstract void StopAnalogActionMomentum(ulong controllerHandle,ulong eAction); + public abstract void TriggerHapticPulse(ulong controllerHandle,uint eTargetPad,char usDurationMicroSec); + } + + + public abstract class ISteamUGC + { + public abstract IntPtr GetIntPtr(); + public abstract ulong CreateQueryUserUGCRequest(uint unAccountID,uint eListType,uint eMatchingUGCType,uint eSortOrder,uint nCreatorAppID,uint nConsumerAppID,uint unPage); + public abstract ulong CreateQueryAllUGCRequest(uint eQueryType,uint eMatchingeMatchingUGCTypeFileType,uint nCreatorAppID,uint nConsumerAppID,uint unPage); + public abstract ulong CreateQueryUGCDetailsRequest(ref ulong pvecPublishedFileID,uint unNumPublishedFileIDs); + public abstract ulong SendQueryUGCRequest(ulong handle); + public abstract bool GetQueryUGCResult(ulong handle,uint index,ref SteamUGCDetails_t pDetails); + public abstract bool GetQueryUGCPreviewURL(ulong handle,uint index,string pchURL,uint cchURLSize); + public abstract bool GetQueryUGCMetadata(ulong handle,uint index,string pchMetadata,uint cchMetadatasize); + public abstract bool GetQueryUGCChildren(ulong handle,uint index,ref ulong pvecPublishedFileID,uint cMaxEntries); + public abstract bool GetQueryUGCStatistic(ulong handle,uint index,uint eStatType,ref uint pStatValue); + public abstract uint GetQueryUGCNumAdditionalPreviews(ulong handle,uint index); + public abstract bool GetQueryUGCAdditionalPreview(ulong handle,uint index,uint previewIndex,string pchURLOrVideoID,uint cchURLSize,ref bool pbIsImage); + public abstract uint GetQueryUGCNumKeyValueTags(ulong handle,uint index); + public abstract bool GetQueryUGCKeyValueTag(ulong handle,uint index,uint keyValueTagIndex,string pchKey,uint cchKeySize,string pchValue,uint cchValueSize); + public abstract bool ReleaseQueryUGCRequest(ulong handle); + public abstract bool AddRequiredTag(ulong handle,string pTagName); + public abstract bool AddExcludedTag(ulong handle,string pTagName); + public abstract bool SetReturnKeyValueTags(ulong handle,bool bReturnKeyValueTags); + public abstract bool SetReturnLongDescription(ulong handle,bool bReturnLongDescription); + public abstract bool SetReturnMetadata(ulong handle,bool bReturnMetadata); + public abstract bool SetReturnChildren(ulong handle,bool bReturnChildren); + public abstract bool SetReturnAdditionalPreviews(ulong handle,bool bReturnAdditionalPreviews); + public abstract bool SetReturnTotalOnly(ulong handle,bool bReturnTotalOnly); + public abstract bool SetLanguage(ulong handle,string pchLanguage); + public abstract bool SetAllowCachedResponse(ulong handle,uint unMaxAgeSeconds); + public abstract bool SetCloudFileNameFilter(ulong handle,string pMatchCloudFileName); + public abstract bool SetMatchAnyTag(ulong handle,bool bMatchAnyTag); + public abstract bool SetSearchText(ulong handle,string pSearchText); + public abstract bool SetRankedByTrendDays(ulong handle,uint unDays); + public abstract bool AddRequiredKeyValueTag(ulong handle,string pKey,string pValue); + public abstract ulong RequestUGCDetails(ulong nPublishedFileID,uint unMaxAgeSeconds); + public abstract ulong CreateItem(uint nConsumerAppId,uint eFileType); + public abstract ulong StartItemUpdate(uint nConsumerAppId,ulong nPublishedFileID); + public abstract bool SetItemTitle(ulong handle,string pchTitle); + public abstract bool SetItemDescription(ulong handle,string pchDescription); + public abstract bool SetItemUpdateLanguage(ulong handle,string pchLanguage); + public abstract bool SetItemMetadata(ulong handle,string pchMetaData); + public abstract bool SetItemVisibility(ulong handle,uint eVisibility); + public abstract bool SetItemTags(ulong updateHandle,ref SteamParamStringArray_t pTags); + public abstract bool SetItemContent(ulong handle,string pszContentFolder); + public abstract bool SetItemPreview(ulong handle,string pszPreviewFile); + public abstract bool RemoveItemKeyValueTags(ulong handle,string pchKey); + public abstract bool AddItemKeyValueTag(ulong handle,string pchKey,string pchValue); + public abstract ulong SubmitItemUpdate(ulong handle,string pchChangeNote); + public abstract uint GetItemUpdateProgress(ulong handle,ref ulong punBytesProcessed,ref ulong punBytesTotal); + public abstract ulong SetUserItemVote(ulong nPublishedFileID,bool bVoteUp); + public abstract ulong GetUserItemVote(ulong nPublishedFileID); + public abstract ulong AddItemToFavorites(uint nAppId,ulong nPublishedFileID); + public abstract ulong RemoveItemFromFavorites(uint nAppId,ulong nPublishedFileID); + public abstract ulong SubscribeItem(ulong nPublishedFileID); + public abstract ulong UnsubscribeItem(ulong nPublishedFileID); + public abstract uint GetNumSubscribedItems(); + public abstract uint GetSubscribedItems(ref ulong pvecPublishedFileID,uint cMaxEntries); + public abstract uint GetItemState(ulong nPublishedFileID); + public abstract bool GetItemInstallInfo(ulong nPublishedFileID,ref ulong punSizeOnDisk,string pchFolder,uint cchFolderSize,ref uint punTimeStamp); + public abstract bool GetItemDownloadInfo(ulong nPublishedFileID,ref ulong punBytesDownloaded,ref ulong punBytesTotal); + public abstract bool DownloadItem(ulong nPublishedFileID,bool bHighPriority); + public abstract bool BInitWorkshopForGameServer(uint unWorkshopDepotID,string pszFolder); + public abstract void SuspendDownloads(bool bSuspend); + } + + + public abstract class ISteamAppList + { + public abstract IntPtr GetIntPtr(); + public abstract uint GetNumInstalledApps(); + public abstract uint GetInstalledApps(ref uint pvecAppID,uint unMaxAppIDs); + public abstract int GetAppName(uint nAppID,string pchName,int cchNameMax); + public abstract int GetAppInstallDir(uint nAppID,string pchDirectory,int cchNameMax); + public abstract int GetAppBuildId(uint nAppID); + } + + + public abstract class ISteamHTMLSurface + { + public abstract IntPtr GetIntPtr(); + public abstract void DestructISteamHTMLSurface(); + public abstract bool Init(); + public abstract bool Shutdown(); + public abstract ulong CreateBrowser(string pchUserAgent,string pchUserCSS); + public abstract void RemoveBrowser(uint unBrowserHandle); + public abstract void LoadURL(uint unBrowserHandle,string pchURL,string pchPostData); + public abstract void SetSize(uint unBrowserHandle,uint unWidth,uint unHeight); + public abstract void StopLoad(uint unBrowserHandle); + public abstract void Reload(uint unBrowserHandle); + public abstract void GoBack(uint unBrowserHandle); + public abstract void GoForward(uint unBrowserHandle); + public abstract void AddHeader(uint unBrowserHandle,string pchKey,string pchValue); + public abstract void ExecuteJavascript(uint unBrowserHandle,string pchScript); + public abstract void MouseUp(uint unBrowserHandle,uint eMouseButton); + public abstract void MouseDown(uint unBrowserHandle,uint eMouseButton); + public abstract void MouseDoubleClick(uint unBrowserHandle,uint eMouseButton); + public abstract void MouseMove(uint unBrowserHandle,int x,int y); + public abstract void MouseWheel(uint unBrowserHandle,int nDelta); + public abstract void KeyDown(uint unBrowserHandle,uint nNativeKeyCode,uint eHTMLKeyModifiers); + public abstract void KeyUp(uint unBrowserHandle,uint nNativeKeyCode,uint eHTMLKeyModifiers); + public abstract void KeyChar(uint unBrowserHandle,uint cUnicodeChar,uint eHTMLKeyModifiers); + public abstract void SetHorizontalScroll(uint unBrowserHandle,uint nAbsolutePixelScroll); + public abstract void SetVerticalScroll(uint unBrowserHandle,uint nAbsolutePixelScroll); + public abstract void SetKeyFocus(uint unBrowserHandle,bool bHasKeyFocus); + public abstract void ViewSource(uint unBrowserHandle); + public abstract void CopyToClipboard(uint unBrowserHandle); + public abstract void PasteFromClipboard(uint unBrowserHandle); + public abstract void Find(uint unBrowserHandle,string pchSearchStr,bool bCurrentlyInFind,bool bReverse); + public abstract void StopFind(uint unBrowserHandle); + public abstract void GetLinkAtPosition(uint unBrowserHandle,int x,int y); + public abstract void SetCookie(string pchHostname,string pchKey,string pchValue,string pchPath,ulong nExpires,bool bSecure,bool bHTTPOnly); + public abstract void SetPageScaleFactor(uint unBrowserHandle,float flZoom,int nPointX,int nPointY); + public abstract void SetBackgroundMode(uint unBrowserHandle,bool bBackgroundMode); + public abstract void AllowStartRequest(uint unBrowserHandle,bool bAllowed); + public abstract void JSDialogResponse(uint unBrowserHandle,bool bResult); + public abstract void FileLoadDialogResponse(uint unBrowserHandle,string pchSelectedFiles); + } + + + public abstract class ISteamInventory + { + public abstract IntPtr GetIntPtr(); + public abstract uint GetResultStatus(int resultHandle); + public abstract bool GetResultItems(int resultHandle,out SteamItemDetails_t [] pOutItemsArray); + public abstract uint GetResultTimestamp(int resultHandle); + public abstract bool CheckResultSteamID(int resultHandle,ulong steamIDExpected); + public abstract void DestroyResult(int resultHandle); + public abstract bool GetAllItems(ref int pResultHandle); + public abstract bool GetItemsByID(ref int pResultHandle,ulong [] pInstanceIDs); + public abstract bool SerializeResult(int resultHandle,IntPtr pOutBuffer,ref uint punOutBufferSize); + public abstract bool DeserializeResult(ref int pOutResultHandle,IntPtr pBuffer,uint unBufferSize,bool bRESERVED_MUST_BE_FALSE); + public abstract bool GenerateItems(ref int pResultHandle,int [] pArrayItemDefs,uint [] punArrayQuantity); + public abstract bool GrantPromoItems(ref int pResultHandle); + public abstract bool AddPromoItem(ref int pResultHandle,int itemDef); + public abstract bool AddPromoItems(ref int pResultHandle,int [] pArrayItemDefs); + public abstract bool ConsumeItem(ref int pResultHandle,ulong itemConsume,uint unQuantity); + public abstract bool ExchangeItems(ref int pResultHandle,int [] pArrayGenerate,uint [] punArrayGenerateQuantity,ulong [] pArrayDestroy,uint [] punArrayDestroyQuantity); + public abstract bool TransferItemQuantity(ref int pResultHandle,ulong itemIdSource,uint unQuantity,ulong itemIdDest); + public abstract void SendItemDropHeartbeat(); + public abstract bool TriggerItemDrop(ref int pResultHandle,int dropListDefinition); + public abstract bool TradeItems(ref int pResultHandle,ulong steamIDTradePartner,ulong [] pArrayGive,uint [] pArrayGiveQuantity,ulong [] pArrayGet,uint [] pArrayGetQuantity); + public abstract bool LoadItemDefinitions(); + public abstract bool GetItemDefinitionIDs(out int [] pItemDefIDs); + public abstract bool GetItemDefinitionProperty(int iDefinition,string pchPropertyName,out string pchValueBuffer); + } + + + public abstract class ISteamVideo + { + public abstract IntPtr GetIntPtr(); + public abstract void GetVideoURL(uint unVideoAppID); + public abstract bool IsBroadcasting(ref int pnNumViewers); + } + + + public abstract class ISteamGameServer + { + public abstract IntPtr GetIntPtr(); + public abstract bool InitGameServer(uint unIP,char usGamePort,char usQueryPort,uint unFlags,uint nGameAppId,string pchVersionString); + public abstract void SetProduct(string pszProduct); + public abstract void SetGameDescription(string pszGameDescription); + public abstract void SetModDir(string pszModDir); + public abstract void SetDedicatedServer(bool bDedicated); + public abstract void LogOn(string pszToken); + public abstract void LogOnAnonymous(); + public abstract void LogOff(); + public abstract bool BLoggedOn(); + public abstract bool BSecure(); + public abstract ulong GetSteamID(); + public abstract bool WasRestartRequested(); + public abstract void SetMaxPlayerCount(int cPlayersMax); + public abstract void SetBotPlayerCount(int cBotplayers); + public abstract void SetServerName(string pszServerName); + public abstract void SetMapName(string pszMapName); + public abstract void SetPasswordProtected(bool bPasswordProtected); + public abstract void SetSpectatorPort(char unSpectatorPort); + public abstract void SetSpectatorServerName(string pszSpectatorServerName); + public abstract void ClearAllKeyValues(); + public abstract void SetKeyValue(string pKey,string pValue); + public abstract void SetGameTags(string pchGameTags); + public abstract void SetGameData(string pchGameData); + public abstract void SetRegion(string pszRegion); + public abstract bool SendUserConnectAndAuthenticate(uint unIPClient,IntPtr pvAuthBlob,uint cubAuthBlobSize,ref CSteamID pSteamIDUser); + public abstract ulong CreateUnauthenticatedUserConnection(); + public abstract void SendUserDisconnect(ulong steamIDUser); + public abstract bool BUpdateUserData(ulong steamIDUser,string pchPlayerName,uint uScore); + public abstract uint GetAuthSessionTicket(IntPtr pTicket,int cbMaxTicket,ref uint pcbTicket); + public abstract uint BeginAuthSession(IntPtr pAuthTicket,int cbAuthTicket,ulong steamID); + public abstract void EndAuthSession(ulong steamID); + public abstract void CancelAuthTicket(uint hAuthTicket); + public abstract uint UserHasLicenseForApp(ulong steamID,uint appID); + public abstract bool RequestUserGroupStatus(ulong steamIDUser,ulong steamIDGroup); + public abstract void GetGameplayStats(); + public abstract ulong GetServerReputation(); + public abstract uint GetPublicIP(); + public abstract bool HandleIncomingPacket(IntPtr pData,int cbData,uint srcIP,char srcPort); + public abstract int GetNextOutgoingPacket(IntPtr pOut,int cbMaxOut,ref uint pNetAdr,ref char pPort); + public abstract void EnableHeartbeats(bool bActive); + public abstract void SetHeartbeatInterval(int iHeartbeatInterval); + public abstract void ForceHeartbeat(); + public abstract ulong AssociateWithClan(ulong steamIDClan); + public abstract ulong ComputeNewPlayerCompatibility(ulong steamIDNewPlayer); + } + + + public abstract class ISteamGameServerStats + { + public abstract IntPtr GetIntPtr(); + public abstract ulong RequestUserStats(ulong steamIDUser); + public abstract bool GetUserStat(ulong steamIDUser,string pchName,ref int pData); + public abstract bool GetUserStat0(ulong steamIDUser,string pchName,ref float pData); + public abstract bool GetUserAchievement(ulong steamIDUser,string pchName,ref bool pbAchieved); + public abstract bool SetUserStat(ulong steamIDUser,string pchName,int nData); + public abstract bool SetUserStat0(ulong steamIDUser,string pchName,float fData); + public abstract bool UpdateUserAvgRateStat(ulong steamIDUser,string pchName,float flCountThisSession,double dSessionLength); + public abstract bool SetUserAchievement(ulong steamIDUser,string pchName); + public abstract bool ClearUserAchievement(ulong steamIDUser,string pchName); + public abstract ulong StoreUserStats(ulong steamIDUser); + } + + +public class CSteamClient : ISteamClient +{ +public CSteamClient(IntPtr SteamClient) +{ + m_pSteamClient = SteamClient; +} +IntPtr m_pSteamClient; + +public override IntPtr GetIntPtr() { return m_pSteamClient; } + +private void CheckIfUsable() +{ + if (m_pSteamClient == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint CreateSteamPipe() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamClient_CreateSteamPipe(m_pSteamClient); + return result; +} +public override bool BReleaseSteamPipe(uint hSteamPipe) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamClient_BReleaseSteamPipe(m_pSteamClient,hSteamPipe); + return result; +} +public override uint ConnectToGlobalUser(uint hSteamPipe) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamClient_ConnectToGlobalUser(m_pSteamClient,hSteamPipe); + return result; +} +public override uint CreateLocalUser(ref uint phSteamPipe,uint eAccountType) +{ + CheckIfUsable(); + phSteamPipe = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamClient_CreateLocalUser(m_pSteamClient,ref phSteamPipe,eAccountType); + return result; +} +public override void ReleaseUser(uint hSteamPipe,uint hUser) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamClient_ReleaseUser(m_pSteamClient,hSteamPipe,hUser); +} +public override ISteamUser GetISteamUser(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUser(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamUser) Marshal.PtrToStructure(result, typeof(ISteamUser)); +} +public override ISteamGameServer GetISteamGameServer(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamGameServer(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamGameServer) Marshal.PtrToStructure(result, typeof(ISteamGameServer)); +} +public override void SetLocalIPBinding(uint unIP,char usPort) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamClient_SetLocalIPBinding(m_pSteamClient,unIP,usPort); +} +public override ISteamFriends GetISteamFriends(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamFriends(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamFriends) Marshal.PtrToStructure(result, typeof(ISteamFriends)); +} +public override ISteamUtils GetISteamUtils(uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUtils(m_pSteamClient,hSteamPipe,pchVersion); + return (ISteamUtils) Marshal.PtrToStructure(result, typeof(ISteamUtils)); +} +public override ISteamMatchmaking GetISteamMatchmaking(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMatchmaking(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamMatchmaking) Marshal.PtrToStructure(result, typeof(ISteamMatchmaking)); +} +public override ISteamMatchmakingServers GetISteamMatchmakingServers(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMatchmakingServers(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamMatchmakingServers) Marshal.PtrToStructure(result, typeof(ISteamMatchmakingServers)); +} +public override IntPtr GetISteamGenericInterface(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamGenericInterface(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (IntPtr) Marshal.PtrToStructure(result, typeof(IntPtr)); +} +public override ISteamUserStats GetISteamUserStats(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUserStats(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamUserStats) Marshal.PtrToStructure(result, typeof(ISteamUserStats)); +} +public override ISteamGameServerStats GetISteamGameServerStats(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamGameServerStats(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamGameServerStats) Marshal.PtrToStructure(result, typeof(ISteamGameServerStats)); +} +public override ISteamApps GetISteamApps(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamApps(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamApps) Marshal.PtrToStructure(result, typeof(ISteamApps)); +} +public override ISteamNetworking GetISteamNetworking(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamNetworking(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamNetworking) Marshal.PtrToStructure(result, typeof(ISteamNetworking)); +} +public override ISteamRemoteStorage GetISteamRemoteStorage(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamRemoteStorage(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamRemoteStorage) Marshal.PtrToStructure(result, typeof(ISteamRemoteStorage)); +} +public override ISteamScreenshots GetISteamScreenshots(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamScreenshots(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamScreenshots) Marshal.PtrToStructure(result, typeof(ISteamScreenshots)); +} +public override void RunFrame() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamClient_RunFrame(m_pSteamClient); +} +public override uint GetIPCCallCount() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamClient_GetIPCCallCount(m_pSteamClient); + return result; +} +public override void SetWarningMessageHook(IntPtr pFunction) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamClient_SetWarningMessageHook(m_pSteamClient,pFunction); +} +public override bool BShutdownIfAllPipesClosed() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamClient_BShutdownIfAllPipesClosed(m_pSteamClient); + return result; +} +public override ISteamHTTP GetISteamHTTP(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamHTTP(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamHTTP) Marshal.PtrToStructure(result, typeof(ISteamHTTP)); +} +public override ISteamUnifiedMessages GetISteamUnifiedMessages(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUnifiedMessages(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamUnifiedMessages) Marshal.PtrToStructure(result, typeof(ISteamUnifiedMessages)); +} +public override ISteamController GetISteamController(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamController(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamController) Marshal.PtrToStructure(result, typeof(ISteamController)); +} +public override ISteamUGC GetISteamUGC(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUGC(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamUGC) Marshal.PtrToStructure(result, typeof(ISteamUGC)); +} +public override ISteamAppList GetISteamAppList(uint hSteamUser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamAppList(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion); + return (ISteamAppList) Marshal.PtrToStructure(result, typeof(ISteamAppList)); +} +public override ISteamMusic GetISteamMusic(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMusic(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamMusic) Marshal.PtrToStructure(result, typeof(ISteamMusic)); +} +public override ISteamMusicRemote GetISteamMusicRemote(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMusicRemote(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamMusicRemote) Marshal.PtrToStructure(result, typeof(ISteamMusicRemote)); +} +public override ISteamHTMLSurface GetISteamHTMLSurface(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamHTMLSurface(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamHTMLSurface) Marshal.PtrToStructure(result, typeof(ISteamHTMLSurface)); +} +public override void Set_SteamAPI_CPostAPIResultInProcess(IntPtr func) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamClient_Set_SteamAPI_CPostAPIResultInProcess(m_pSteamClient,func); +} +public override void Remove_SteamAPI_CPostAPIResultInProcess(IntPtr func) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamClient_Remove_SteamAPI_CPostAPIResultInProcess(m_pSteamClient,func); +} +public override void Set_SteamAPI_CCheckCallbackRegisteredInProcess(IntPtr func) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamClient_Set_SteamAPI_CCheckCallbackRegisteredInProcess(m_pSteamClient,func); +} +public override ISteamInventory GetISteamInventory(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamInventory(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamInventory) Marshal.PtrToStructure(result, typeof(ISteamInventory)); +} +public override ISteamVideo GetISteamVideo(uint hSteamuser,uint hSteamPipe,string pchVersion) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamVideo(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion); + return (ISteamVideo) Marshal.PtrToStructure(result, typeof(ISteamVideo)); +} +} + + +public class CSteamUser : ISteamUser +{ +public CSteamUser(IntPtr SteamUser) +{ + m_pSteamUser = SteamUser; +} +IntPtr m_pSteamUser; + +public override IntPtr GetIntPtr() { return m_pSteamUser; } + +private void CheckIfUsable() +{ + if (m_pSteamUser == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint GetHSteamUser() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUser_GetHSteamUser(m_pSteamUser); + return result; +} +public override bool BLoggedOn() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUser_BLoggedOn(m_pSteamUser); + return result; +} +public override ulong GetSteamID() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUser_GetSteamID(m_pSteamUser); + return result; +} +public override int InitiateGameConnection(IntPtr pAuthBlob,int cbMaxAuthBlob,ulong steamIDGameServer,uint unIPServer,char usPortServer,bool bSecure) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUser_InitiateGameConnection(m_pSteamUser,pAuthBlob,cbMaxAuthBlob,steamIDGameServer,unIPServer,usPortServer,bSecure); + return result; +} +public override void TerminateGameConnection(uint unIPServer,char usPortServer) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUser_TerminateGameConnection(m_pSteamUser,unIPServer,usPortServer); +} +public override void TrackAppUsageEvent(ulong gameID,int eAppUsageEvent,string pchExtraInfo) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUser_TrackAppUsageEvent(m_pSteamUser,gameID,eAppUsageEvent,pchExtraInfo); +} +public override bool GetUserDataFolder(string pchBuffer,int cubBuffer) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUser_GetUserDataFolder(m_pSteamUser,pchBuffer,cubBuffer); + return result; +} +public override void StartVoiceRecording() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUser_StartVoiceRecording(m_pSteamUser); +} +public override void StopVoiceRecording() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUser_StopVoiceRecording(m_pSteamUser); +} +public override uint GetAvailableVoice(ref uint pcbCompressed,ref uint pcbUncompressed,uint nUncompressedVoiceDesiredSampleRate) +{ + CheckIfUsable(); + pcbCompressed = 0; + pcbUncompressed = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamUser_GetAvailableVoice(m_pSteamUser,ref pcbCompressed,ref pcbUncompressed,nUncompressedVoiceDesiredSampleRate); + return result; +} +public override uint GetVoice(bool bWantCompressed,IntPtr pDestBuffer,uint cbDestBufferSize,ref uint nBytesWritten,bool bWantUncompressed,IntPtr pUncompressedDestBuffer,uint cbUncompressedDestBufferSize,ref uint nUncompressBytesWritten,uint nUncompressedVoiceDesiredSampleRate) +{ + CheckIfUsable(); + nBytesWritten = 0; + nUncompressBytesWritten = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamUser_GetVoice(m_pSteamUser,bWantCompressed,pDestBuffer,cbDestBufferSize,ref nBytesWritten,bWantUncompressed,pUncompressedDestBuffer,cbUncompressedDestBufferSize,ref nUncompressBytesWritten,nUncompressedVoiceDesiredSampleRate); + return result; +} +public override uint DecompressVoice(IntPtr pCompressed,uint cbCompressed,IntPtr pDestBuffer,uint cbDestBufferSize,ref uint nBytesWritten,uint nDesiredSampleRate) +{ + CheckIfUsable(); + nBytesWritten = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamUser_DecompressVoice(m_pSteamUser,pCompressed,cbCompressed,pDestBuffer,cbDestBufferSize,ref nBytesWritten,nDesiredSampleRate); + return result; +} +public override uint GetVoiceOptimalSampleRate() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUser_GetVoiceOptimalSampleRate(m_pSteamUser); + return result; +} +public override uint GetAuthSessionTicket(IntPtr pTicket,int cbMaxTicket,ref uint pcbTicket) +{ + CheckIfUsable(); + pcbTicket = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamUser_GetAuthSessionTicket(m_pSteamUser,pTicket,cbMaxTicket,ref pcbTicket); + return result; +} +public override uint BeginAuthSession(IntPtr pAuthTicket,int cbAuthTicket,ulong steamID) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUser_BeginAuthSession(m_pSteamUser,pAuthTicket,cbAuthTicket,steamID); + return result; +} +public override void EndAuthSession(ulong steamID) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUser_EndAuthSession(m_pSteamUser,steamID); +} +public override void CancelAuthTicket(uint hAuthTicket) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUser_CancelAuthTicket(m_pSteamUser,hAuthTicket); +} +public override uint UserHasLicenseForApp(ulong steamID,uint appID) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUser_UserHasLicenseForApp(m_pSteamUser,steamID,appID); + return result; +} +public override bool BIsBehindNAT() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUser_BIsBehindNAT(m_pSteamUser); + return result; +} +public override void AdvertiseGame(ulong steamIDGameServer,uint unIPServer,char usPortServer) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUser_AdvertiseGame(m_pSteamUser,steamIDGameServer,unIPServer,usPortServer); +} +public override ulong RequestEncryptedAppTicket(IntPtr pDataToInclude,int cbDataToInclude) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUser_RequestEncryptedAppTicket(m_pSteamUser,pDataToInclude,cbDataToInclude); + return result; +} +public override bool GetEncryptedAppTicket(IntPtr pTicket,int cbMaxTicket,ref uint pcbTicket) +{ + CheckIfUsable(); + pcbTicket = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUser_GetEncryptedAppTicket(m_pSteamUser,pTicket,cbMaxTicket,ref pcbTicket); + return result; +} +public override int GetGameBadgeLevel(int nSeries,bool bFoil) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUser_GetGameBadgeLevel(m_pSteamUser,nSeries,bFoil); + return result; +} +public override int GetPlayerSteamLevel() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUser_GetPlayerSteamLevel(m_pSteamUser); + return result; +} +public override ulong RequestStoreAuthURL(string pchRedirectURL) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUser_RequestStoreAuthURL(m_pSteamUser,pchRedirectURL); + return result; +} +} + + +public class CSteamFriends : ISteamFriends +{ +public CSteamFriends(IntPtr SteamFriends) +{ + m_pSteamFriends = SteamFriends; +} +IntPtr m_pSteamFriends; + +public override IntPtr GetIntPtr() { return m_pSteamFriends; } + +private void CheckIfUsable() +{ + if (m_pSteamFriends == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override string GetPersonaName() +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetPersonaName(m_pSteamFriends); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override ulong SetPersonaName(string pchPersonaName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_SetPersonaName(m_pSteamFriends,pchPersonaName); + return result; +} +public override uint GetPersonaState() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamFriends_GetPersonaState(m_pSteamFriends); + return result; +} +public override int GetFriendCount(int iFriendFlags) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendCount(m_pSteamFriends,iFriendFlags); + return result; +} +public override ulong GetFriendByIndex(int iFriend,int iFriendFlags) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendByIndex(m_pSteamFriends,iFriend,iFriendFlags); + return result; +} +public override uint GetFriendRelationship(ulong steamIDFriend) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendRelationship(m_pSteamFriends,steamIDFriend); + return result; +} +public override uint GetFriendPersonaState(ulong steamIDFriend) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendPersonaState(m_pSteamFriends,steamIDFriend); + return result; +} +public override string GetFriendPersonaName(ulong steamIDFriend) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendPersonaName(m_pSteamFriends,steamIDFriend); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool GetFriendGamePlayed(ulong steamIDFriend,out FriendGameInfo_t pFriendGameInfo) +{ + CheckIfUsable(); + pFriendGameInfo = new FriendGameInfo_t(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendGamePlayed(m_pSteamFriends,steamIDFriend,ref pFriendGameInfo); + return result; +} +public override string GetFriendPersonaNameHistory(ulong steamIDFriend,int iPersonaName) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendPersonaNameHistory(m_pSteamFriends,steamIDFriend,iPersonaName); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override int GetFriendSteamLevel(ulong steamIDFriend) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendSteamLevel(m_pSteamFriends,steamIDFriend); + return result; +} +public override string GetPlayerNickname(ulong steamIDPlayer) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetPlayerNickname(m_pSteamFriends,steamIDPlayer); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override int GetFriendsGroupCount() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendsGroupCount(m_pSteamFriends); + return result; +} +public override char GetFriendsGroupIDByIndex(int iFG) +{ + CheckIfUsable(); + char result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex(m_pSteamFriends,iFG); + return result; +} +public override string GetFriendsGroupName(char friendsGroupID) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendsGroupName(m_pSteamFriends,friendsGroupID); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override int GetFriendsGroupMembersCount(char friendsGroupID) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendsGroupMembersCount(m_pSteamFriends,friendsGroupID); + return result; +} +public override void GetFriendsGroupMembersList(char friendsGroupID,out CSteamID [] pOutSteamIDMembers) +{ + CheckIfUsable(); + int nMembersCount = GetFriendsGroupMembersCount (friendsGroupID); + pOutSteamIDMembers = new CSteamID[nMembersCount]; + NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendsGroupMembersList(m_pSteamFriends,friendsGroupID,pOutSteamIDMembers,nMembersCount); +} +public override bool HasFriend(ulong steamIDFriend,int iFriendFlags) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_HasFriend(m_pSteamFriends,steamIDFriend,iFriendFlags); + return result; +} +public override int GetClanCount() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanCount(m_pSteamFriends); + return result; +} +public override ulong GetClanByIndex(int iClan) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanByIndex(m_pSteamFriends,iClan); + return result; +} +public override string GetClanName(ulong steamIDClan) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanName(m_pSteamFriends,steamIDClan); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override string GetClanTag(ulong steamIDClan) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanTag(m_pSteamFriends,steamIDClan); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool GetClanActivityCounts(ulong steamIDClan,ref int pnOnline,ref int pnInGame,ref int pnChatting) +{ + CheckIfUsable(); + pnOnline = 0; + pnInGame = 0; + pnChatting = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanActivityCounts(m_pSteamFriends,steamIDClan,ref pnOnline,ref pnInGame,ref pnChatting); + return result; +} +public override ulong DownloadClanActivityCounts(CSteamID [] psteamIDClans) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_DownloadClanActivityCounts(m_pSteamFriends,psteamIDClans,(int) psteamIDClans.Length); + return result; +} +public override int GetFriendCountFromSource(ulong steamIDSource) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendCountFromSource(m_pSteamFriends,steamIDSource); + return result; +} +public override ulong GetFriendFromSourceByIndex(ulong steamIDSource,int iFriend) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendFromSourceByIndex(m_pSteamFriends,steamIDSource,iFriend); + return result; +} +public override bool IsUserInSource(ulong steamIDUser,ulong steamIDSource) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_IsUserInSource(m_pSteamFriends,steamIDUser,steamIDSource); + return result; +} +public override void SetInGameVoiceSpeaking(ulong steamIDUser,bool bSpeaking) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_SetInGameVoiceSpeaking(m_pSteamFriends,steamIDUser,bSpeaking); +} +public override void ActivateGameOverlay(string pchDialog) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_ActivateGameOverlay(m_pSteamFriends,pchDialog); +} +public override void ActivateGameOverlayToUser(string pchDialog,ulong steamID) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_ActivateGameOverlayToUser(m_pSteamFriends,pchDialog,steamID); +} +public override void ActivateGameOverlayToWebPage(string pchURL) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(m_pSteamFriends,pchURL); +} +public override void ActivateGameOverlayToStore(uint nAppID,char eFlag) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_ActivateGameOverlayToStore(m_pSteamFriends,nAppID,eFlag); +} +public override void SetPlayedWith(ulong steamIDUserPlayedWith) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_SetPlayedWith(m_pSteamFriends,steamIDUserPlayedWith); +} +public override void ActivateGameOverlayInviteDialog(ulong steamIDLobby) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog(m_pSteamFriends,steamIDLobby); +} +public override int GetSmallFriendAvatar(ulong steamIDFriend) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetSmallFriendAvatar(m_pSteamFriends,steamIDFriend); + return result; +} +public override int GetMediumFriendAvatar(ulong steamIDFriend) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetMediumFriendAvatar(m_pSteamFriends,steamIDFriend); + return result; +} +public override int GetLargeFriendAvatar(ulong steamIDFriend) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetLargeFriendAvatar(m_pSteamFriends,steamIDFriend); + return result; +} +public override bool RequestUserInformation(ulong steamIDUser,bool bRequireNameOnly) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_RequestUserInformation(m_pSteamFriends,steamIDUser,bRequireNameOnly); + return result; +} +public override ulong RequestClanOfficerList(ulong steamIDClan) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_RequestClanOfficerList(m_pSteamFriends,steamIDClan); + return result; +} +public override ulong GetClanOwner(ulong steamIDClan) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanOwner(m_pSteamFriends,steamIDClan); + return result; +} +public override int GetClanOfficerCount(ulong steamIDClan) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanOfficerCount(m_pSteamFriends,steamIDClan); + return result; +} +public override ulong GetClanOfficerByIndex(ulong steamIDClan,int iOfficer) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanOfficerByIndex(m_pSteamFriends,steamIDClan,iOfficer); + return result; +} +public override uint GetUserRestrictions() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamFriends_GetUserRestrictions(m_pSteamFriends); + return result; +} +public override bool SetRichPresence(string pchKey,string pchValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_SetRichPresence(m_pSteamFriends,pchKey,pchValue); + return result; +} +public override void ClearRichPresence() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_ClearRichPresence(m_pSteamFriends); +} +public override string GetFriendRichPresence(ulong steamIDFriend,string pchKey) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendRichPresence(m_pSteamFriends,steamIDFriend,pchKey); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override int GetFriendRichPresenceKeyCount(ulong steamIDFriend) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount(m_pSteamFriends,steamIDFriend); + return result; +} +public override string GetFriendRichPresenceKeyByIndex(ulong steamIDFriend,int iKey) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex(m_pSteamFriends,steamIDFriend,iKey); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override void RequestFriendRichPresence(ulong steamIDFriend) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamFriends_RequestFriendRichPresence(m_pSteamFriends,steamIDFriend); +} +public override bool InviteUserToGame(ulong steamIDFriend,string pchConnectString) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_InviteUserToGame(m_pSteamFriends,steamIDFriend,pchConnectString); + return result; +} +public override int GetCoplayFriendCount() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetCoplayFriendCount(m_pSteamFriends); + return result; +} +public override ulong GetCoplayFriend(int iCoplayFriend) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetCoplayFriend(m_pSteamFriends,iCoplayFriend); + return result; +} +public override int GetFriendCoplayTime(ulong steamIDFriend) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendCoplayTime(m_pSteamFriends,steamIDFriend); + return result; +} +public override uint GetFriendCoplayGame(ulong steamIDFriend) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendCoplayGame(m_pSteamFriends,steamIDFriend); + return result; +} +public override ulong JoinClanChatRoom(ulong steamIDClan) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_JoinClanChatRoom(m_pSteamFriends,steamIDClan); + return result; +} +public override bool LeaveClanChatRoom(ulong steamIDClan) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_LeaveClanChatRoom(m_pSteamFriends,steamIDClan); + return result; +} +public override int GetClanChatMemberCount(ulong steamIDClan) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanChatMemberCount(m_pSteamFriends,steamIDClan); + return result; +} +public override ulong GetChatMemberByIndex(ulong steamIDClan,int iUser) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetChatMemberByIndex(m_pSteamFriends,steamIDClan,iUser); + return result; +} +public override bool SendClanChatMessage(ulong steamIDClanChat,string pchText) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_SendClanChatMessage(m_pSteamFriends,steamIDClanChat,pchText); + return result; +} +public override int GetClanChatMessage(ulong steamIDClanChat,int iMessage,IntPtr prgchText,int cchTextMax,ref uint peChatEntryType,out CSteamID psteamidChatter) +{ + CheckIfUsable(); + peChatEntryType = 0; + psteamidChatter = new CSteamID(); + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetClanChatMessage(m_pSteamFriends,steamIDClanChat,iMessage,prgchText,cchTextMax,ref peChatEntryType,ref psteamidChatter); + return result; +} +public override bool IsClanChatAdmin(ulong steamIDClanChat,ulong steamIDUser) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_IsClanChatAdmin(m_pSteamFriends,steamIDClanChat,steamIDUser); + return result; +} +public override bool IsClanChatWindowOpenInSteam(ulong steamIDClanChat) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam(m_pSteamFriends,steamIDClanChat); + return result; +} +public override bool OpenClanChatWindowInSteam(ulong steamIDClanChat) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_OpenClanChatWindowInSteam(m_pSteamFriends,steamIDClanChat); + return result; +} +public override bool CloseClanChatWindowInSteam(ulong steamIDClanChat) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_CloseClanChatWindowInSteam(m_pSteamFriends,steamIDClanChat); + return result; +} +public override bool SetListenForFriendsMessages(bool bInterceptEnabled) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_SetListenForFriendsMessages(m_pSteamFriends,bInterceptEnabled); + return result; +} +public override bool ReplyToFriendMessage(ulong steamIDFriend,string pchMsgToSend) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamFriends_ReplyToFriendMessage(m_pSteamFriends,steamIDFriend,pchMsgToSend); + return result; +} +public override int GetFriendMessage(ulong steamIDFriend,int iMessageID,IntPtr pvData,int cubData,ref uint peChatEntryType) +{ + CheckIfUsable(); + peChatEntryType = 0; + int result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFriendMessage(m_pSteamFriends,steamIDFriend,iMessageID,pvData,cubData,ref peChatEntryType); + return result; +} +public override ulong GetFollowerCount(ulong steamID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_GetFollowerCount(m_pSteamFriends,steamID); + return result; +} +public override ulong IsFollowing(ulong steamID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_IsFollowing(m_pSteamFriends,steamID); + return result; +} +public override ulong EnumerateFollowingList(uint unStartIndex) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamFriends_EnumerateFollowingList(m_pSteamFriends,unStartIndex); + return result; +} +} + + +public class CSteamUtils : ISteamUtils +{ +public CSteamUtils(IntPtr SteamUtils) +{ + m_pSteamUtils = SteamUtils; +} +IntPtr m_pSteamUtils; + +public override IntPtr GetIntPtr() { return m_pSteamUtils; } + +private void CheckIfUsable() +{ + if (m_pSteamUtils == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint GetSecondsSinceAppActive() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUtils_GetSecondsSinceAppActive(m_pSteamUtils); + return result; +} +public override uint GetSecondsSinceComputerActive() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUtils_GetSecondsSinceComputerActive(m_pSteamUtils); + return result; +} +public override int GetConnectedUniverse() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUtils_GetConnectedUniverse(m_pSteamUtils); + return result; +} +public override uint GetServerRealTime() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUtils_GetServerRealTime(m_pSteamUtils); + return result; +} +public override string GetIPCountry() +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamUtils_GetIPCountry(m_pSteamUtils); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool GetImageSize(int iImage,ref uint pnWidth,ref uint pnHeight) +{ + CheckIfUsable(); + pnWidth = 0; + pnHeight = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_GetImageSize(m_pSteamUtils,iImage,ref pnWidth,ref pnHeight); + return result; +} +public override bool GetImageRGBA(int iImage,IntPtr pubDest,int nDestBufferSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_GetImageRGBA(m_pSteamUtils,iImage,pubDest,nDestBufferSize); + return result; +} +public override bool GetCSERIPPort(ref uint unIP,ref char usPort) +{ + CheckIfUsable(); + unIP = 0; + usPort = (char) 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_GetCSERIPPort(m_pSteamUtils,ref unIP,ref usPort); + return result; +} +public override byte GetCurrentBatteryPower() +{ + CheckIfUsable(); + byte result = NativeEntrypoints.SteamAPI_ISteamUtils_GetCurrentBatteryPower(m_pSteamUtils); + return result; +} +public override uint GetAppID() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUtils_GetAppID(m_pSteamUtils); + return result; +} +public override void SetOverlayNotificationPosition(uint eNotificationPosition) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUtils_SetOverlayNotificationPosition(m_pSteamUtils,eNotificationPosition); +} +public override bool IsAPICallCompleted(ulong hSteamAPICall,ref bool pbFailed) +{ + CheckIfUsable(); + pbFailed = false; + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_IsAPICallCompleted(m_pSteamUtils,hSteamAPICall,ref pbFailed); + return result; +} +public override int GetAPICallFailureReason(ulong hSteamAPICall) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUtils_GetAPICallFailureReason(m_pSteamUtils,hSteamAPICall); + return result; +} +public override bool GetAPICallResult(ulong hSteamAPICall,IntPtr pCallback,int cubCallback,int iCallbackExpected,ref bool pbFailed) +{ + CheckIfUsable(); + pbFailed = false; + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_GetAPICallResult(m_pSteamUtils,hSteamAPICall,pCallback,cubCallback,iCallbackExpected,ref pbFailed); + return result; +} +public override void RunFrame() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUtils_RunFrame(m_pSteamUtils); +} +public override uint GetIPCCallCount() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUtils_GetIPCCallCount(m_pSteamUtils); + return result; +} +public override void SetWarningMessageHook(IntPtr pFunction) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUtils_SetWarningMessageHook(m_pSteamUtils,pFunction); +} +public override bool IsOverlayEnabled() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_IsOverlayEnabled(m_pSteamUtils); + return result; +} +public override bool BOverlayNeedsPresent() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_BOverlayNeedsPresent(m_pSteamUtils); + return result; +} +public override ulong CheckFileSignature(string szFileName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUtils_CheckFileSignature(m_pSteamUtils,szFileName); + return result; +} +public override bool ShowGamepadTextInput(int eInputMode,int eLineInputMode,string pchDescription,uint unCharMax,string pchExistingText) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_ShowGamepadTextInput(m_pSteamUtils,eInputMode,eLineInputMode,pchDescription,unCharMax,pchExistingText); + return result; +} +public override uint GetEnteredGamepadTextLength() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUtils_GetEnteredGamepadTextLength(m_pSteamUtils); + return result; +} +public override bool GetEnteredGamepadTextInput(string pchText,uint cchText) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_GetEnteredGamepadTextInput(m_pSteamUtils,pchText,cchText); + return result; +} +public override string GetSteamUILanguage() +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamUtils_GetSteamUILanguage(m_pSteamUtils); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool IsSteamRunningInVR() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUtils_IsSteamRunningInVR(m_pSteamUtils); + return result; +} +public override void SetOverlayNotificationInset(int nHorizontalInset,int nVerticalInset) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUtils_SetOverlayNotificationInset(m_pSteamUtils,nHorizontalInset,nVerticalInset); +} +} + + +public class CSteamMatchmaking : ISteamMatchmaking +{ +public CSteamMatchmaking(IntPtr SteamMatchmaking) +{ + m_pSteamMatchmaking = SteamMatchmaking; +} +IntPtr m_pSteamMatchmaking; + +public override IntPtr GetIntPtr() { return m_pSteamMatchmaking; } + +private void CheckIfUsable() +{ + if (m_pSteamMatchmaking == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override int GetFavoriteGameCount() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetFavoriteGameCount(m_pSteamMatchmaking); + return result; +} +public override bool GetFavoriteGame(int iGame,ref uint pnAppID,ref uint pnIP,ref char pnConnPort,ref char pnQueryPort,ref uint punFlags,ref uint pRTime32LastPlayedOnServer) +{ + CheckIfUsable(); + pnAppID = 0; + pnIP = 0; + pnConnPort = (char) 0; + pnQueryPort = (char) 0; + punFlags = 0; + pRTime32LastPlayedOnServer = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetFavoriteGame(m_pSteamMatchmaking,iGame,ref pnAppID,ref pnIP,ref pnConnPort,ref pnQueryPort,ref punFlags,ref pRTime32LastPlayedOnServer); + return result; +} +public override int AddFavoriteGame(uint nAppID,uint nIP,char nConnPort,char nQueryPort,uint unFlags,uint rTime32LastPlayedOnServer) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddFavoriteGame(m_pSteamMatchmaking,nAppID,nIP,nConnPort,nQueryPort,unFlags,rTime32LastPlayedOnServer); + return result; +} +public override bool RemoveFavoriteGame(uint nAppID,uint nIP,char nConnPort,char nQueryPort,uint unFlags) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_RemoveFavoriteGame(m_pSteamMatchmaking,nAppID,nIP,nConnPort,nQueryPort,unFlags); + return result; +} +public override ulong RequestLobbyList() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_RequestLobbyList(m_pSteamMatchmaking); + return result; +} +public override void AddRequestLobbyListStringFilter(string pchKeyToMatch,string pchValueToMatch,uint eComparisonType) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter(m_pSteamMatchmaking,pchKeyToMatch,pchValueToMatch,eComparisonType); +} +public override void AddRequestLobbyListNumericalFilter(string pchKeyToMatch,int nValueToMatch,uint eComparisonType) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter(m_pSteamMatchmaking,pchKeyToMatch,nValueToMatch,eComparisonType); +} +public override void AddRequestLobbyListNearValueFilter(string pchKeyToMatch,int nValueToBeCloseTo) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter(m_pSteamMatchmaking,pchKeyToMatch,nValueToBeCloseTo); +} +public override void AddRequestLobbyListFilterSlotsAvailable(int nSlotsAvailable) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable(m_pSteamMatchmaking,nSlotsAvailable); +} +public override void AddRequestLobbyListDistanceFilter(uint eLobbyDistanceFilter) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter(m_pSteamMatchmaking,eLobbyDistanceFilter); +} +public override void AddRequestLobbyListResultCountFilter(int cMaxResults) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter(m_pSteamMatchmaking,cMaxResults); +} +public override void AddRequestLobbyListCompatibleMembersFilter(ulong steamIDLobby) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter(m_pSteamMatchmaking,steamIDLobby); +} +public override ulong GetLobbyByIndex(int iLobby) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyByIndex(m_pSteamMatchmaking,iLobby); + return result; +} +public override ulong CreateLobby(uint eLobbyType,int cMaxMembers) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_CreateLobby(m_pSteamMatchmaking,eLobbyType,cMaxMembers); + return result; +} +public override ulong JoinLobby(ulong steamIDLobby) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_JoinLobby(m_pSteamMatchmaking,steamIDLobby); + return result; +} +public override void LeaveLobby(ulong steamIDLobby) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_LeaveLobby(m_pSteamMatchmaking,steamIDLobby); +} +public override bool InviteUserToLobby(ulong steamIDLobby,ulong steamIDInvitee) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_InviteUserToLobby(m_pSteamMatchmaking,steamIDLobby,steamIDInvitee); + return result; +} +public override int GetNumLobbyMembers(ulong steamIDLobby) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetNumLobbyMembers(m_pSteamMatchmaking,steamIDLobby); + return result; +} +public override ulong GetLobbyMemberByIndex(ulong steamIDLobby,int iMember) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex(m_pSteamMatchmaking,steamIDLobby,iMember); + return result; +} +public override string GetLobbyData(ulong steamIDLobby,string pchKey) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyData(m_pSteamMatchmaking,steamIDLobby,pchKey); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool SetLobbyData(ulong steamIDLobby,string pchKey,string pchValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLobbyData(m_pSteamMatchmaking,steamIDLobby,pchKey,pchValue); + return result; +} +public override int GetLobbyDataCount(ulong steamIDLobby) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyDataCount(m_pSteamMatchmaking,steamIDLobby); + return result; +} +public override bool GetLobbyDataByIndex(ulong steamIDLobby,int iLobbyData,string pchKey,int cchKeyBufferSize,string pchValue,int cchValueBufferSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex(m_pSteamMatchmaking,steamIDLobby,iLobbyData,pchKey,cchKeyBufferSize,pchValue,cchValueBufferSize); + return result; +} +public override bool DeleteLobbyData(ulong steamIDLobby,string pchKey) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_DeleteLobbyData(m_pSteamMatchmaking,steamIDLobby,pchKey); + return result; +} +public override string GetLobbyMemberData(ulong steamIDLobby,ulong steamIDUser,string pchKey) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyMemberData(m_pSteamMatchmaking,steamIDLobby,steamIDUser,pchKey); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override void SetLobbyMemberData(ulong steamIDLobby,string pchKey,string pchValue) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLobbyMemberData(m_pSteamMatchmaking,steamIDLobby,pchKey,pchValue); +} +public override bool SendLobbyChatMsg(ulong steamIDLobby,IntPtr pvMsgBody,int cubMsgBody) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_SendLobbyChatMsg(m_pSteamMatchmaking,steamIDLobby,pvMsgBody,cubMsgBody); + return result; +} +public override int GetLobbyChatEntry(ulong steamIDLobby,int iChatID,out CSteamID pSteamIDUser,IntPtr pvData,int cubData,ref uint peChatEntryType) +{ + CheckIfUsable(); + pSteamIDUser = new CSteamID(); + peChatEntryType = 0; + int result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyChatEntry(m_pSteamMatchmaking,steamIDLobby,iChatID,ref pSteamIDUser,pvData,cubData,ref peChatEntryType); + return result; +} +public override bool RequestLobbyData(ulong steamIDLobby) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_RequestLobbyData(m_pSteamMatchmaking,steamIDLobby); + return result; +} +public override void SetLobbyGameServer(ulong steamIDLobby,uint unGameServerIP,char unGameServerPort,ulong steamIDGameServer) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLobbyGameServer(m_pSteamMatchmaking,steamIDLobby,unGameServerIP,unGameServerPort,steamIDGameServer); +} +public override bool GetLobbyGameServer(ulong steamIDLobby,ref uint punGameServerIP,ref char punGameServerPort,out CSteamID psteamIDGameServer) +{ + CheckIfUsable(); + punGameServerIP = 0; + punGameServerPort = (char) 0; + psteamIDGameServer = new CSteamID(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyGameServer(m_pSteamMatchmaking,steamIDLobby,ref punGameServerIP,ref punGameServerPort,ref psteamIDGameServer); + return result; +} +public override bool SetLobbyMemberLimit(ulong steamIDLobby,int cMaxMembers) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit(m_pSteamMatchmaking,steamIDLobby,cMaxMembers); + return result; +} +public override int GetLobbyMemberLimit(ulong steamIDLobby) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit(m_pSteamMatchmaking,steamIDLobby); + return result; +} +public override bool SetLobbyType(ulong steamIDLobby,uint eLobbyType) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLobbyType(m_pSteamMatchmaking,steamIDLobby,eLobbyType); + return result; +} +public override bool SetLobbyJoinable(ulong steamIDLobby,bool bLobbyJoinable) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLobbyJoinable(m_pSteamMatchmaking,steamIDLobby,bLobbyJoinable); + return result; +} +public override ulong GetLobbyOwner(ulong steamIDLobby) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_GetLobbyOwner(m_pSteamMatchmaking,steamIDLobby); + return result; +} +public override bool SetLobbyOwner(ulong steamIDLobby,ulong steamIDNewOwner) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLobbyOwner(m_pSteamMatchmaking,steamIDLobby,steamIDNewOwner); + return result; +} +public override bool SetLinkedLobby(ulong steamIDLobby,ulong steamIDLobbyDependent) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmaking_SetLinkedLobby(m_pSteamMatchmaking,steamIDLobby,steamIDLobbyDependent); + return result; +} +} + + +public class CSteamMatchmakingServerListResponse : ISteamMatchmakingServerListResponse +{ +public CSteamMatchmakingServerListResponse(IntPtr SteamMatchmakingServerListResponse) +{ + m_pSteamMatchmakingServerListResponse = SteamMatchmakingServerListResponse; +} +IntPtr m_pSteamMatchmakingServerListResponse; + +public override IntPtr GetIntPtr() { return m_pSteamMatchmakingServerListResponse; } + +private void CheckIfUsable() +{ + if (m_pSteamMatchmakingServerListResponse == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override void ServerResponded(uint hRequest,int iServer) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServerListResponse_ServerResponded(m_pSteamMatchmakingServerListResponse,hRequest,iServer); +} +public override void ServerFailedToRespond(uint hRequest,int iServer) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServerListResponse_ServerFailedToRespond(m_pSteamMatchmakingServerListResponse,hRequest,iServer); +} +public override void RefreshComplete(uint hRequest,uint response) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServerListResponse_RefreshComplete(m_pSteamMatchmakingServerListResponse,hRequest,response); +} +} + + +public class CSteamMatchmakingPingResponse : ISteamMatchmakingPingResponse +{ +public CSteamMatchmakingPingResponse(IntPtr SteamMatchmakingPingResponse) +{ + m_pSteamMatchmakingPingResponse = SteamMatchmakingPingResponse; +} +IntPtr m_pSteamMatchmakingPingResponse; + +public override IntPtr GetIntPtr() { return m_pSteamMatchmakingPingResponse; } + +private void CheckIfUsable() +{ + if (m_pSteamMatchmakingPingResponse == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override void ServerResponded(IntPtr server) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingPingResponse_ServerResponded(m_pSteamMatchmakingPingResponse,server); +} +public override void ServerFailedToRespond() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingPingResponse_ServerFailedToRespond(m_pSteamMatchmakingPingResponse); +} +} + + +public class CSteamMatchmakingPlayersResponse : ISteamMatchmakingPlayersResponse +{ +public CSteamMatchmakingPlayersResponse(IntPtr SteamMatchmakingPlayersResponse) +{ + m_pSteamMatchmakingPlayersResponse = SteamMatchmakingPlayersResponse; +} +IntPtr m_pSteamMatchmakingPlayersResponse; + +public override IntPtr GetIntPtr() { return m_pSteamMatchmakingPlayersResponse; } + +private void CheckIfUsable() +{ + if (m_pSteamMatchmakingPlayersResponse == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override void AddPlayerToList(string pchName,int nScore,float flTimePlayed) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingPlayersResponse_AddPlayerToList(m_pSteamMatchmakingPlayersResponse,pchName,nScore,flTimePlayed); +} +public override void PlayersFailedToRespond() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingPlayersResponse_PlayersFailedToRespond(m_pSteamMatchmakingPlayersResponse); +} +public override void PlayersRefreshComplete() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingPlayersResponse_PlayersRefreshComplete(m_pSteamMatchmakingPlayersResponse); +} +} + + +public class CSteamMatchmakingRulesResponse : ISteamMatchmakingRulesResponse +{ +public CSteamMatchmakingRulesResponse(IntPtr SteamMatchmakingRulesResponse) +{ + m_pSteamMatchmakingRulesResponse = SteamMatchmakingRulesResponse; +} +IntPtr m_pSteamMatchmakingRulesResponse; + +public override IntPtr GetIntPtr() { return m_pSteamMatchmakingRulesResponse; } + +private void CheckIfUsable() +{ + if (m_pSteamMatchmakingRulesResponse == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override void RulesResponded(string pchRule,string pchValue) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingRulesResponse_RulesResponded(m_pSteamMatchmakingRulesResponse,pchRule,pchValue); +} +public override void RulesFailedToRespond() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingRulesResponse_RulesFailedToRespond(m_pSteamMatchmakingRulesResponse); +} +public override void RulesRefreshComplete() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingRulesResponse_RulesRefreshComplete(m_pSteamMatchmakingRulesResponse); +} +} + + +public class CSteamMatchmakingServers : ISteamMatchmakingServers +{ +public CSteamMatchmakingServers(IntPtr SteamMatchmakingServers) +{ + m_pSteamMatchmakingServers = SteamMatchmakingServers; +} +IntPtr m_pSteamMatchmakingServers; + +public override IntPtr GetIntPtr() { return m_pSteamMatchmakingServers; } + +private void CheckIfUsable() +{ + if (m_pSteamMatchmakingServers == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint RequestInternetServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RequestInternetServerList(m_pSteamMatchmakingServers,iApp,ppchFilters,(uint) ppchFilters.Length,pRequestServersResponse.GetIntPtr()); + return result; +} +public override uint RequestLANServerList(uint iApp,ISteamMatchmakingServerListResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RequestLANServerList(m_pSteamMatchmakingServers,iApp,pRequestServersResponse.GetIntPtr()); + return result; +} +public override uint RequestFriendsServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList(m_pSteamMatchmakingServers,iApp,ppchFilters,(uint) ppchFilters.Length,pRequestServersResponse.GetIntPtr()); + return result; +} +public override uint RequestFavoritesServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList(m_pSteamMatchmakingServers,iApp,ppchFilters,(uint) ppchFilters.Length,pRequestServersResponse.GetIntPtr()); + return result; +} +public override uint RequestHistoryServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList(m_pSteamMatchmakingServers,iApp,ppchFilters,(uint) ppchFilters.Length,pRequestServersResponse.GetIntPtr()); + return result; +} +public override uint RequestSpectatorServerList(uint iApp,MatchMakingKeyValuePair_t [] ppchFilters,ISteamMatchmakingServerListResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList(m_pSteamMatchmakingServers,iApp,ppchFilters,(uint) ppchFilters.Length,pRequestServersResponse.GetIntPtr()); + return result; +} +public override void ReleaseRequest(uint hServerListRequest) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_ReleaseRequest(m_pSteamMatchmakingServers,hServerListRequest); +} +public override gameserveritem_t GetServerDetails(uint hRequest,int iServer) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_GetServerDetails(m_pSteamMatchmakingServers,hRequest,iServer); + return (gameserveritem_t) Marshal.PtrToStructure(result, typeof(gameserveritem_t)); +} +public override void CancelQuery(uint hRequest) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_CancelQuery(m_pSteamMatchmakingServers,hRequest); +} +public override void RefreshQuery(uint hRequest) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RefreshQuery(m_pSteamMatchmakingServers,hRequest); +} +public override bool IsRefreshing(uint hRequest) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_IsRefreshing(m_pSteamMatchmakingServers,hRequest); + return result; +} +public override int GetServerCount(uint hRequest) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_GetServerCount(m_pSteamMatchmakingServers,hRequest); + return result; +} +public override void RefreshServer(uint hRequest,int iServer) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_RefreshServer(m_pSteamMatchmakingServers,hRequest,iServer); +} +public override uint PingServer(uint unIP,char usPort,ISteamMatchmakingPingResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_PingServer(m_pSteamMatchmakingServers,unIP,usPort,pRequestServersResponse.GetIntPtr()); + return result; +} +public override uint PlayerDetails(uint unIP,char usPort,ISteamMatchmakingPlayersResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_PlayerDetails(m_pSteamMatchmakingServers,unIP,usPort,pRequestServersResponse.GetIntPtr()); + return result; +} +public override uint ServerRules(uint unIP,char usPort,ISteamMatchmakingRulesResponse pRequestServersResponse) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_ServerRules(m_pSteamMatchmakingServers,unIP,usPort,pRequestServersResponse.GetIntPtr()); + return result; +} +public override void CancelServerQuery(uint hServerQuery) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMatchmakingServers_CancelServerQuery(m_pSteamMatchmakingServers,hServerQuery); +} +} + + +public class CSteamRemoteStorage : ISteamRemoteStorage +{ +public CSteamRemoteStorage(IntPtr SteamRemoteStorage) +{ + m_pSteamRemoteStorage = SteamRemoteStorage; +} +IntPtr m_pSteamRemoteStorage; + +public override IntPtr GetIntPtr() { return m_pSteamRemoteStorage; } + +private void CheckIfUsable() +{ + if (m_pSteamRemoteStorage == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool FileWrite(string pchFile,IntPtr pvData,int cubData) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileWrite(m_pSteamRemoteStorage,pchFile,pvData,cubData); + return result; +} +public override int FileRead(string pchFile,IntPtr pvData,int cubDataToRead) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileRead(m_pSteamRemoteStorage,pchFile,pvData,cubDataToRead); + return result; +} +public override ulong FileWriteAsync(string pchFile,IntPtr pvData,uint cubData) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileWriteAsync(m_pSteamRemoteStorage,pchFile,pvData,cubData); + return result; +} +public override ulong FileReadAsync(string pchFile,uint nOffset,uint cubToRead) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileReadAsync(m_pSteamRemoteStorage,pchFile,nOffset,cubToRead); + return result; +} +public override bool FileReadAsyncComplete(ulong hReadCall,IntPtr pvBuffer,uint cubToRead) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete(m_pSteamRemoteStorage,hReadCall,pvBuffer,cubToRead); + return result; +} +public override bool FileForget(string pchFile) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileForget(m_pSteamRemoteStorage,pchFile); + return result; +} +public override bool FileDelete(string pchFile) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileDelete(m_pSteamRemoteStorage,pchFile); + return result; +} +public override ulong FileShare(string pchFile) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileShare(m_pSteamRemoteStorage,pchFile); + return result; +} +public override bool SetSyncPlatforms(string pchFile,uint eRemoteStoragePlatform) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_SetSyncPlatforms(m_pSteamRemoteStorage,pchFile,eRemoteStoragePlatform); + return result; +} +public override ulong FileWriteStreamOpen(string pchFile) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen(m_pSteamRemoteStorage,pchFile); + return result; +} +public override bool FileWriteStreamWriteChunk(ulong writeHandle,IntPtr pvData,int cubData) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk(m_pSteamRemoteStorage,writeHandle,pvData,cubData); + return result; +} +public override bool FileWriteStreamClose(ulong writeHandle) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileWriteStreamClose(m_pSteamRemoteStorage,writeHandle); + return result; +} +public override bool FileWriteStreamCancel(ulong writeHandle) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel(m_pSteamRemoteStorage,writeHandle); + return result; +} +public override bool FileExists(string pchFile) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileExists(m_pSteamRemoteStorage,pchFile); + return result; +} +public override bool FilePersisted(string pchFile) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FilePersisted(m_pSteamRemoteStorage,pchFile); + return result; +} +public override int GetFileSize(string pchFile) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetFileSize(m_pSteamRemoteStorage,pchFile); + return result; +} +public override long GetFileTimestamp(string pchFile) +{ + CheckIfUsable(); + long result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetFileTimestamp(m_pSteamRemoteStorage,pchFile); + return result; +} +public override uint GetSyncPlatforms(string pchFile) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetSyncPlatforms(m_pSteamRemoteStorage,pchFile); + return result; +} +public override int GetFileCount() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetFileCount(m_pSteamRemoteStorage); + return result; +} +public override string GetFileNameAndSize(int iFile,ref int pnFileSizeInBytes) +{ + CheckIfUsable(); + pnFileSizeInBytes = 0; + IntPtr result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(m_pSteamRemoteStorage,iFile,ref pnFileSizeInBytes); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool GetQuota(ref int pnTotalBytes,ref int puAvailableBytes) +{ + CheckIfUsable(); + pnTotalBytes = 0; + puAvailableBytes = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetQuota(m_pSteamRemoteStorage,ref pnTotalBytes,ref puAvailableBytes); + return result; +} +public override bool IsCloudEnabledForAccount() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount(m_pSteamRemoteStorage); + return result; +} +public override bool IsCloudEnabledForApp() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp(m_pSteamRemoteStorage); + return result; +} +public override void SetCloudEnabledForApp(bool bEnabled) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp(m_pSteamRemoteStorage,bEnabled); +} +public override ulong UGCDownload(ulong hContent,uint unPriority) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UGCDownload(m_pSteamRemoteStorage,hContent,unPriority); + return result; +} +public override bool GetUGCDownloadProgress(ulong hContent,ref int pnBytesDownloaded,ref int pnBytesExpected) +{ + CheckIfUsable(); + pnBytesDownloaded = 0; + pnBytesExpected = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(m_pSteamRemoteStorage,hContent,ref pnBytesDownloaded,ref pnBytesExpected); + return result; +} +public override bool GetUGCDetails(ulong hContent,ref uint pnAppID,string ppchName,ref int pnFileSizeInBytes,out CSteamID pSteamIDOwner) +{ + CheckIfUsable(); + pnAppID = 0; + ppchName = ""; + pnFileSizeInBytes = 0; + pSteamIDOwner = new CSteamID(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetUGCDetails(m_pSteamRemoteStorage,hContent,ref pnAppID,ppchName,ref pnFileSizeInBytes,ref pSteamIDOwner); + return result; +} +public override int UGCRead(ulong hContent,IntPtr pvData,int cubDataToRead,uint cOffset,uint eAction) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UGCRead(m_pSteamRemoteStorage,hContent,pvData,cubDataToRead,cOffset,eAction); + return result; +} +public override int GetCachedUGCCount() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetCachedUGCCount(m_pSteamRemoteStorage); + return result; +} +public override ulong GetCachedUGCHandle(int iCachedContent) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle(m_pSteamRemoteStorage,iCachedContent); + return result; +} +public override ulong PublishWorkshopFile(string pchFile,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags,uint eWorkshopFileType) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_PublishWorkshopFile(m_pSteamRemoteStorage,pchFile,pchPreviewFile,nConsumerAppId,pchTitle,pchDescription,eVisibility,ref pTags,eWorkshopFileType); + return result; +} +public override ulong CreatePublishedFileUpdateRequest(ulong unPublishedFileId) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest(m_pSteamRemoteStorage,unPublishedFileId); + return result; +} +public override bool UpdatePublishedFileFile(ulong updateHandle,string pchFile) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile(m_pSteamRemoteStorage,updateHandle,pchFile); + return result; +} +public override bool UpdatePublishedFilePreviewFile(ulong updateHandle,string pchPreviewFile) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile(m_pSteamRemoteStorage,updateHandle,pchPreviewFile); + return result; +} +public override bool UpdatePublishedFileTitle(ulong updateHandle,string pchTitle) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle(m_pSteamRemoteStorage,updateHandle,pchTitle); + return result; +} +public override bool UpdatePublishedFileDescription(ulong updateHandle,string pchDescription) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription(m_pSteamRemoteStorage,updateHandle,pchDescription); + return result; +} +public override bool UpdatePublishedFileVisibility(ulong updateHandle,uint eVisibility) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility(m_pSteamRemoteStorage,updateHandle,eVisibility); + return result; +} +public override bool UpdatePublishedFileTags(ulong updateHandle,ref SteamParamStringArray_t pTags) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags(m_pSteamRemoteStorage,updateHandle,ref pTags); + return result; +} +public override ulong CommitPublishedFileUpdate(ulong updateHandle) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate(m_pSteamRemoteStorage,updateHandle); + return result; +} +public override ulong GetPublishedFileDetails(ulong unPublishedFileId,uint unMaxSecondsOld) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails(m_pSteamRemoteStorage,unPublishedFileId,unMaxSecondsOld); + return result; +} +public override ulong DeletePublishedFile(ulong unPublishedFileId) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_DeletePublishedFile(m_pSteamRemoteStorage,unPublishedFileId); + return result; +} +public override ulong EnumerateUserPublishedFiles(uint unStartIndex) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles(m_pSteamRemoteStorage,unStartIndex); + return result; +} +public override ulong SubscribePublishedFile(ulong unPublishedFileId) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_SubscribePublishedFile(m_pSteamRemoteStorage,unPublishedFileId); + return result; +} +public override ulong EnumerateUserSubscribedFiles(uint unStartIndex) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles(m_pSteamRemoteStorage,unStartIndex); + return result; +} +public override ulong UnsubscribePublishedFile(ulong unPublishedFileId) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile(m_pSteamRemoteStorage,unPublishedFileId); + return result; +} +public override bool UpdatePublishedFileSetChangeDescription(ulong updateHandle,string pchChangeDescription) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription(m_pSteamRemoteStorage,updateHandle,pchChangeDescription); + return result; +} +public override ulong GetPublishedItemVoteDetails(ulong unPublishedFileId) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails(m_pSteamRemoteStorage,unPublishedFileId); + return result; +} +public override ulong UpdateUserPublishedItemVote(ulong unPublishedFileId,bool bVoteUp) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote(m_pSteamRemoteStorage,unPublishedFileId,bVoteUp); + return result; +} +public override ulong GetUserPublishedItemVoteDetails(ulong unPublishedFileId) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails(m_pSteamRemoteStorage,unPublishedFileId); + return result; +} +public override ulong EnumerateUserSharedWorkshopFiles(ulong steamId,uint unStartIndex,ref SteamParamStringArray_t pRequiredTags,ref SteamParamStringArray_t pExcludedTags) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles(m_pSteamRemoteStorage,steamId,unStartIndex,ref pRequiredTags,ref pExcludedTags); + return result; +} +public override ulong PublishVideo(uint eVideoProvider,string pchVideoAccount,string pchVideoIdentifier,string pchPreviewFile,uint nConsumerAppId,string pchTitle,string pchDescription,uint eVisibility,ref SteamParamStringArray_t pTags) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_PublishVideo(m_pSteamRemoteStorage,eVideoProvider,pchVideoAccount,pchVideoIdentifier,pchPreviewFile,nConsumerAppId,pchTitle,pchDescription,eVisibility,ref pTags); + return result; +} +public override ulong SetUserPublishedFileAction(ulong unPublishedFileId,uint eAction) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction(m_pSteamRemoteStorage,unPublishedFileId,eAction); + return result; +} +public override ulong EnumeratePublishedFilesByUserAction(uint eAction,uint unStartIndex) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction(m_pSteamRemoteStorage,eAction,unStartIndex); + return result; +} +public override ulong EnumeratePublishedWorkshopFiles(uint eEnumerationType,uint unStartIndex,uint unCount,uint unDays,ref SteamParamStringArray_t pTags,ref SteamParamStringArray_t pUserTags) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles(m_pSteamRemoteStorage,eEnumerationType,unStartIndex,unCount,unDays,ref pTags,ref pUserTags); + return result; +} +public override ulong UGCDownloadToLocation(ulong hContent,string pchLocation,uint unPriority) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation(m_pSteamRemoteStorage,hContent,pchLocation,unPriority); + return result; +} +} + + +public class CSteamUserStats : ISteamUserStats +{ +public CSteamUserStats(IntPtr SteamUserStats) +{ + m_pSteamUserStats = SteamUserStats; +} +IntPtr m_pSteamUserStats; + +public override IntPtr GetIntPtr() { return m_pSteamUserStats; } + +private void CheckIfUsable() +{ + if (m_pSteamUserStats == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool RequestCurrentStats() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_RequestCurrentStats(m_pSteamUserStats); + return result; +} +public override bool GetStat(string pchName,ref int pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetStat(m_pSteamUserStats,pchName,ref pData); + return result; +} +public override bool GetStat0(string pchName,ref float pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetStat0(m_pSteamUserStats,pchName,ref pData); + return result; +} +public override bool SetStat(string pchName,int nData) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_SetStat(m_pSteamUserStats,pchName,nData); + return result; +} +public override bool SetStat0(string pchName,float fData) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_SetStat0(m_pSteamUserStats,pchName,fData); + return result; +} +public override bool UpdateAvgRateStat(string pchName,float flCountThisSession,double dSessionLength) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_UpdateAvgRateStat(m_pSteamUserStats,pchName,flCountThisSession,dSessionLength); + return result; +} +public override bool GetAchievement(string pchName,ref bool pbAchieved) +{ + CheckIfUsable(); + pbAchieved = false; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetAchievement(m_pSteamUserStats,pchName,ref pbAchieved); + return result; +} +public override bool SetAchievement(string pchName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_SetAchievement(m_pSteamUserStats,pchName); + return result; +} +public override bool ClearAchievement(string pchName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_ClearAchievement(m_pSteamUserStats,pchName); + return result; +} +public override bool GetAchievementAndUnlockTime(string pchName,ref bool pbAchieved,ref uint punUnlockTime) +{ + CheckIfUsable(); + pbAchieved = false; + punUnlockTime = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime(m_pSteamUserStats,pchName,ref pbAchieved,ref punUnlockTime); + return result; +} +public override bool StoreStats() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_StoreStats(m_pSteamUserStats); + return result; +} +public override int GetAchievementIcon(string pchName) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetAchievementIcon(m_pSteamUserStats,pchName); + return result; +} +public override string GetAchievementDisplayAttribute(string pchName,string pchKey) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute(m_pSteamUserStats,pchName,pchKey); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool IndicateAchievementProgress(string pchName,uint nCurProgress,uint nMaxProgress) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_IndicateAchievementProgress(m_pSteamUserStats,pchName,nCurProgress,nMaxProgress); + return result; +} +public override uint GetNumAchievements() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetNumAchievements(m_pSteamUserStats); + return result; +} +public override string GetAchievementName(uint iAchievement) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetAchievementName(m_pSteamUserStats,iAchievement); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override ulong RequestUserStats(ulong steamIDUser) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_RequestUserStats(m_pSteamUserStats,steamIDUser); + return result; +} +public override bool GetUserStat(ulong steamIDUser,string pchName,ref int pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetUserStat(m_pSteamUserStats,steamIDUser,pchName,ref pData); + return result; +} +public override bool GetUserStat0(ulong steamIDUser,string pchName,ref float pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetUserStat0(m_pSteamUserStats,steamIDUser,pchName,ref pData); + return result; +} +public override bool GetUserAchievement(ulong steamIDUser,string pchName,ref bool pbAchieved) +{ + CheckIfUsable(); + pbAchieved = false; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetUserAchievement(m_pSteamUserStats,steamIDUser,pchName,ref pbAchieved); + return result; +} +public override bool GetUserAchievementAndUnlockTime(ulong steamIDUser,string pchName,ref bool pbAchieved,ref uint punUnlockTime) +{ + CheckIfUsable(); + pbAchieved = false; + punUnlockTime = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime(m_pSteamUserStats,steamIDUser,pchName,ref pbAchieved,ref punUnlockTime); + return result; +} +public override bool ResetAllStats(bool bAchievementsToo) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_ResetAllStats(m_pSteamUserStats,bAchievementsToo); + return result; +} +public override ulong FindOrCreateLeaderboard(string pchLeaderboardName,uint eLeaderboardSortMethod,uint eLeaderboardDisplayType) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_FindOrCreateLeaderboard(m_pSteamUserStats,pchLeaderboardName,eLeaderboardSortMethod,eLeaderboardDisplayType); + return result; +} +public override ulong FindLeaderboard(string pchLeaderboardName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_FindLeaderboard(m_pSteamUserStats,pchLeaderboardName); + return result; +} +public override string GetLeaderboardName(ulong hSteamLeaderboard) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetLeaderboardName(m_pSteamUserStats,hSteamLeaderboard); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override int GetLeaderboardEntryCount(ulong hSteamLeaderboard) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetLeaderboardEntryCount(m_pSteamUserStats,hSteamLeaderboard); + return result; +} +public override uint GetLeaderboardSortMethod(ulong hSteamLeaderboard) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetLeaderboardSortMethod(m_pSteamUserStats,hSteamLeaderboard); + return result; +} +public override uint GetLeaderboardDisplayType(ulong hSteamLeaderboard) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetLeaderboardDisplayType(m_pSteamUserStats,hSteamLeaderboard); + return result; +} +public override ulong DownloadLeaderboardEntries(ulong hSteamLeaderboard,uint eLeaderboardDataRequest,int nRangeStart,int nRangeEnd) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_DownloadLeaderboardEntries(m_pSteamUserStats,hSteamLeaderboard,eLeaderboardDataRequest,nRangeStart,nRangeEnd); + return result; +} +public override ulong DownloadLeaderboardEntriesForUsers(ulong hSteamLeaderboard,CSteamID [] prgUsers) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers(m_pSteamUserStats,hSteamLeaderboard,prgUsers,(int) prgUsers.Length); + return result; +} +public override bool GetDownloadedLeaderboardEntry(ulong hSteamLeaderboardEntries,int index,ref LeaderboardEntry_t pLeaderboardEntry,ref int pDetails,int cDetailsMax) +{ + CheckIfUsable(); + pDetails = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry(m_pSteamUserStats,hSteamLeaderboardEntries,index,ref pLeaderboardEntry,ref pDetails,cDetailsMax); + return result; +} +public override ulong UploadLeaderboardScore(ulong hSteamLeaderboard,uint eLeaderboardUploadScoreMethod,int nScore,ref int pScoreDetails,int cScoreDetailsCount) +{ + CheckIfUsable(); + pScoreDetails = 0; + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_UploadLeaderboardScore(m_pSteamUserStats,hSteamLeaderboard,eLeaderboardUploadScoreMethod,nScore,ref pScoreDetails,cScoreDetailsCount); + return result; +} +public override ulong AttachLeaderboardUGC(ulong hSteamLeaderboard,ulong hUGC) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_AttachLeaderboardUGC(m_pSteamUserStats,hSteamLeaderboard,hUGC); + return result; +} +public override ulong GetNumberOfCurrentPlayers() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers(m_pSteamUserStats); + return result; +} +public override ulong RequestGlobalAchievementPercentages() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages(m_pSteamUserStats); + return result; +} +public override int GetMostAchievedAchievementInfo(string pchName,uint unNameBufLen,ref float pflPercent,ref bool pbAchieved) +{ + CheckIfUsable(); + pflPercent = 0; + pbAchieved = false; + int result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo(m_pSteamUserStats,pchName,unNameBufLen,ref pflPercent,ref pbAchieved); + return result; +} +public override int GetNextMostAchievedAchievementInfo(int iIteratorPrevious,string pchName,uint unNameBufLen,ref float pflPercent,ref bool pbAchieved) +{ + CheckIfUsable(); + pflPercent = 0; + pbAchieved = false; + int result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo(m_pSteamUserStats,iIteratorPrevious,pchName,unNameBufLen,ref pflPercent,ref pbAchieved); + return result; +} +public override bool GetAchievementAchievedPercent(string pchName,ref float pflPercent) +{ + CheckIfUsable(); + pflPercent = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetAchievementAchievedPercent(m_pSteamUserStats,pchName,ref pflPercent); + return result; +} +public override ulong RequestGlobalStats(int nHistoryDays) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUserStats_RequestGlobalStats(m_pSteamUserStats,nHistoryDays); + return result; +} +public override bool GetGlobalStat(string pchStatName,ref long pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetGlobalStat(m_pSteamUserStats,pchStatName,ref pData); + return result; +} +public override bool GetGlobalStat0(string pchStatName,ref double pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetGlobalStat0(m_pSteamUserStats,pchStatName,ref pData); + return result; +} +public override int GetGlobalStatHistory(string pchStatName,long [] pData) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetGlobalStatHistory(m_pSteamUserStats,pchStatName,pData,(uint) pData.Length); + return result; +} +public override int GetGlobalStatHistory0(string pchStatName,double [] pData) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamUserStats_GetGlobalStatHistory0(m_pSteamUserStats,pchStatName,pData,(uint) pData.Length); + return result; +} +} + + +public class CSteamApps : ISteamApps +{ +public CSteamApps(IntPtr SteamApps) +{ + m_pSteamApps = SteamApps; +} +IntPtr m_pSteamApps; + +public override IntPtr GetIntPtr() { return m_pSteamApps; } + +private void CheckIfUsable() +{ + if (m_pSteamApps == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool BIsSubscribed() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsSubscribed(m_pSteamApps); + return result; +} +public override bool BIsLowViolence() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsLowViolence(m_pSteamApps); + return result; +} +public override bool BIsCybercafe() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsCybercafe(m_pSteamApps); + return result; +} +public override bool BIsVACBanned() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsVACBanned(m_pSteamApps); + return result; +} +public override string GetCurrentGameLanguage() +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamApps_GetCurrentGameLanguage(m_pSteamApps); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override string GetAvailableGameLanguages() +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamApps_GetAvailableGameLanguages(m_pSteamApps); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool BIsSubscribedApp(uint appID) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsSubscribedApp(m_pSteamApps,appID); + return result; +} +public override bool BIsDlcInstalled(uint appID) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsDlcInstalled(m_pSteamApps,appID); + return result; +} +public override uint GetEarliestPurchaseUnixTime(uint nAppID) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime(m_pSteamApps,nAppID); + return result; +} +public override bool BIsSubscribedFromFreeWeekend() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend(m_pSteamApps); + return result; +} +public override int GetDLCCount() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamApps_GetDLCCount(m_pSteamApps); + return result; +} +public override bool BGetDLCDataByIndex(int iDLC,ref uint pAppID,ref bool pbAvailable,string pchName,int cchNameBufferSize) +{ + CheckIfUsable(); + pAppID = 0; + pbAvailable = false; + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BGetDLCDataByIndex(m_pSteamApps,iDLC,ref pAppID,ref pbAvailable,pchName,cchNameBufferSize); + return result; +} +public override void InstallDLC(uint nAppID) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamApps_InstallDLC(m_pSteamApps,nAppID); +} +public override void UninstallDLC(uint nAppID) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamApps_UninstallDLC(m_pSteamApps,nAppID); +} +public override void RequestAppProofOfPurchaseKey(uint nAppID) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey(m_pSteamApps,nAppID); +} +public override bool GetCurrentBetaName(string pchName,int cchNameBufferSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_GetCurrentBetaName(m_pSteamApps,pchName,cchNameBufferSize); + return result; +} +public override bool MarkContentCorrupt(bool bMissingFilesOnly) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_MarkContentCorrupt(m_pSteamApps,bMissingFilesOnly); + return result; +} +public override uint GetInstalledDepots(uint appID,ref uint pvecDepots,uint cMaxDepots) +{ + CheckIfUsable(); + pvecDepots = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamApps_GetInstalledDepots(m_pSteamApps,appID,ref pvecDepots,cMaxDepots); + return result; +} +public override uint GetAppInstallDir(uint appID,string pchFolder,uint cchFolderBufferSize) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamApps_GetAppInstallDir(m_pSteamApps,appID,pchFolder,cchFolderBufferSize); + return result; +} +public override bool BIsAppInstalled(uint appID) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamApps_BIsAppInstalled(m_pSteamApps,appID); + return result; +} +public override ulong GetAppOwner() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamApps_GetAppOwner(m_pSteamApps); + return result; +} +public override string GetLaunchQueryParam(string pchKey) +{ + CheckIfUsable(); + IntPtr result = NativeEntrypoints.SteamAPI_ISteamApps_GetLaunchQueryParam(m_pSteamApps,pchKey); + return (string) Marshal.PtrToStructure(result, typeof(string)); +} +public override bool GetDlcDownloadProgress(uint nAppID,ref ulong punBytesDownloaded,ref ulong punBytesTotal) +{ + CheckIfUsable(); + punBytesDownloaded = 0; + punBytesTotal = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamApps_GetDlcDownloadProgress(m_pSteamApps,nAppID,ref punBytesDownloaded,ref punBytesTotal); + return result; +} +public override int GetAppBuildId() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamApps_GetAppBuildId(m_pSteamApps); + return result; +} +} + + +public class CSteamNetworking : ISteamNetworking +{ +public CSteamNetworking(IntPtr SteamNetworking) +{ + m_pSteamNetworking = SteamNetworking; +} +IntPtr m_pSteamNetworking; + +public override IntPtr GetIntPtr() { return m_pSteamNetworking; } + +private void CheckIfUsable() +{ + if (m_pSteamNetworking == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool SendP2PPacket(ulong steamIDRemote,IntPtr pubData,uint cubData,uint eP2PSendType,int nChannel) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_SendP2PPacket(m_pSteamNetworking,steamIDRemote,pubData,cubData,eP2PSendType,nChannel); + return result; +} +public override bool IsP2PPacketAvailable(ref uint pcubMsgSize,int nChannel) +{ + CheckIfUsable(); + pcubMsgSize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_IsP2PPacketAvailable(m_pSteamNetworking,ref pcubMsgSize,nChannel); + return result; +} +public override bool ReadP2PPacket(IntPtr pubDest,uint cubDest,ref uint pcubMsgSize,ref CSteamID psteamIDRemote,int nChannel) +{ + CheckIfUsable(); + pcubMsgSize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_ReadP2PPacket(m_pSteamNetworking,pubDest,cubDest,ref pcubMsgSize,ref psteamIDRemote,nChannel); + return result; +} +public override bool AcceptP2PSessionWithUser(ulong steamIDRemote) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser(m_pSteamNetworking,steamIDRemote); + return result; +} +public override bool CloseP2PSessionWithUser(ulong steamIDRemote) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_CloseP2PSessionWithUser(m_pSteamNetworking,steamIDRemote); + return result; +} +public override bool CloseP2PChannelWithUser(ulong steamIDRemote,int nChannel) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_CloseP2PChannelWithUser(m_pSteamNetworking,steamIDRemote,nChannel); + return result; +} +public override bool GetP2PSessionState(ulong steamIDRemote,ref P2PSessionState_t pConnectionState) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_GetP2PSessionState(m_pSteamNetworking,steamIDRemote,ref pConnectionState); + return result; +} +public override bool AllowP2PPacketRelay(bool bAllow) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_AllowP2PPacketRelay(m_pSteamNetworking,bAllow); + return result; +} +public override uint CreateListenSocket(int nVirtualP2PPort,uint nIP,char nPort,bool bAllowUseOfPacketRelay) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamNetworking_CreateListenSocket(m_pSteamNetworking,nVirtualP2PPort,nIP,nPort,bAllowUseOfPacketRelay); + return result; +} +public override uint CreateP2PConnectionSocket(ulong steamIDTarget,int nVirtualPort,int nTimeoutSec,bool bAllowUseOfPacketRelay) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamNetworking_CreateP2PConnectionSocket(m_pSteamNetworking,steamIDTarget,nVirtualPort,nTimeoutSec,bAllowUseOfPacketRelay); + return result; +} +public override uint CreateConnectionSocket(uint nIP,char nPort,int nTimeoutSec) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamNetworking_CreateConnectionSocket(m_pSteamNetworking,nIP,nPort,nTimeoutSec); + return result; +} +public override bool DestroySocket(uint hSocket,bool bNotifyRemoteEnd) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_DestroySocket(m_pSteamNetworking,hSocket,bNotifyRemoteEnd); + return result; +} +public override bool DestroyListenSocket(uint hSocket,bool bNotifyRemoteEnd) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_DestroyListenSocket(m_pSteamNetworking,hSocket,bNotifyRemoteEnd); + return result; +} +public override bool SendDataOnSocket(uint hSocket,IntPtr pubData,uint cubData,bool bReliable) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_SendDataOnSocket(m_pSteamNetworking,hSocket,pubData,cubData,bReliable); + return result; +} +public override bool IsDataAvailableOnSocket(uint hSocket,ref uint pcubMsgSize) +{ + CheckIfUsable(); + pcubMsgSize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_IsDataAvailableOnSocket(m_pSteamNetworking,hSocket,ref pcubMsgSize); + return result; +} +public override bool RetrieveDataFromSocket(uint hSocket,IntPtr pubDest,uint cubDest,ref uint pcubMsgSize) +{ + CheckIfUsable(); + pcubMsgSize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_RetrieveDataFromSocket(m_pSteamNetworking,hSocket,pubDest,cubDest,ref pcubMsgSize); + return result; +} +public override bool IsDataAvailable(uint hListenSocket,ref uint pcubMsgSize,ref uint phSocket) +{ + CheckIfUsable(); + pcubMsgSize = 0; + phSocket = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_IsDataAvailable(m_pSteamNetworking,hListenSocket,ref pcubMsgSize,ref phSocket); + return result; +} +public override bool RetrieveData(uint hListenSocket,IntPtr pubDest,uint cubDest,ref uint pcubMsgSize,ref uint phSocket) +{ + CheckIfUsable(); + pcubMsgSize = 0; + phSocket = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_RetrieveData(m_pSteamNetworking,hListenSocket,pubDest,cubDest,ref pcubMsgSize,ref phSocket); + return result; +} +public override bool GetSocketInfo(uint hSocket,ref CSteamID pSteamIDRemote,ref int peSocketStatus,ref uint punIPRemote,ref char punPortRemote) +{ + CheckIfUsable(); + peSocketStatus = 0; + punIPRemote = 0; + punPortRemote = (char) 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_GetSocketInfo(m_pSteamNetworking,hSocket,ref pSteamIDRemote,ref peSocketStatus,ref punIPRemote,ref punPortRemote); + return result; +} +public override bool GetListenSocketInfo(uint hListenSocket,ref uint pnIP,ref char pnPort) +{ + CheckIfUsable(); + pnIP = 0; + pnPort = (char) 0; + bool result = NativeEntrypoints.SteamAPI_ISteamNetworking_GetListenSocketInfo(m_pSteamNetworking,hListenSocket,ref pnIP,ref pnPort); + return result; +} +public override uint GetSocketConnectionType(uint hSocket) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamNetworking_GetSocketConnectionType(m_pSteamNetworking,hSocket); + return result; +} +public override int GetMaxPacketSize(uint hSocket) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamNetworking_GetMaxPacketSize(m_pSteamNetworking,hSocket); + return result; +} +} + + +public class CSteamScreenshots : ISteamScreenshots +{ +public CSteamScreenshots(IntPtr SteamScreenshots) +{ + m_pSteamScreenshots = SteamScreenshots; +} +IntPtr m_pSteamScreenshots; + +public override IntPtr GetIntPtr() { return m_pSteamScreenshots; } + +private void CheckIfUsable() +{ + if (m_pSteamScreenshots == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint WriteScreenshot(IntPtr pubRGB,uint cubRGB,int nWidth,int nHeight) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamScreenshots_WriteScreenshot(m_pSteamScreenshots,pubRGB,cubRGB,nWidth,nHeight); + return result; +} +public override uint AddScreenshotToLibrary(string pchFilename,string pchThumbnailFilename,int nWidth,int nHeight) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamScreenshots_AddScreenshotToLibrary(m_pSteamScreenshots,pchFilename,pchThumbnailFilename,nWidth,nHeight); + return result; +} +public override void TriggerScreenshot() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamScreenshots_TriggerScreenshot(m_pSteamScreenshots); +} +public override void HookScreenshots(bool bHook) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamScreenshots_HookScreenshots(m_pSteamScreenshots,bHook); +} +public override bool SetLocation(uint hScreenshot,string pchLocation) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamScreenshots_SetLocation(m_pSteamScreenshots,hScreenshot,pchLocation); + return result; +} +public override bool TagUser(uint hScreenshot,ulong steamID) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamScreenshots_TagUser(m_pSteamScreenshots,hScreenshot,steamID); + return result; +} +public override bool TagPublishedFile(uint hScreenshot,ulong unPublishedFileID) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamScreenshots_TagPublishedFile(m_pSteamScreenshots,hScreenshot,unPublishedFileID); + return result; +} +} + + +public class CSteamMusic : ISteamMusic +{ +public CSteamMusic(IntPtr SteamMusic) +{ + m_pSteamMusic = SteamMusic; +} +IntPtr m_pSteamMusic; + +public override IntPtr GetIntPtr() { return m_pSteamMusic; } + +private void CheckIfUsable() +{ + if (m_pSteamMusic == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool BIsEnabled() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusic_BIsEnabled(m_pSteamMusic); + return result; +} +public override bool BIsPlaying() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusic_BIsPlaying(m_pSteamMusic); + return result; +} +public override int GetPlaybackStatus() +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamMusic_GetPlaybackStatus(m_pSteamMusic); + return result; +} +public override void Play() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMusic_Play(m_pSteamMusic); +} +public override void Pause() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMusic_Pause(m_pSteamMusic); +} +public override void PlayPrevious() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMusic_PlayPrevious(m_pSteamMusic); +} +public override void PlayNext() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMusic_PlayNext(m_pSteamMusic); +} +public override void SetVolume(float flVolume) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamMusic_SetVolume(m_pSteamMusic,flVolume); +} +public override float GetVolume() +{ + CheckIfUsable(); + float result = NativeEntrypoints.SteamAPI_ISteamMusic_GetVolume(m_pSteamMusic); + return result; +} +} + + +public class CSteamMusicRemote : ISteamMusicRemote +{ +public CSteamMusicRemote(IntPtr SteamMusicRemote) +{ + m_pSteamMusicRemote = SteamMusicRemote; +} +IntPtr m_pSteamMusicRemote; + +public override IntPtr GetIntPtr() { return m_pSteamMusicRemote; } + +private void CheckIfUsable() +{ + if (m_pSteamMusicRemote == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool RegisterSteamMusicRemote(string pchName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote(m_pSteamMusicRemote,pchName); + return result; +} +public override bool DeregisterSteamMusicRemote() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote(m_pSteamMusicRemote); + return result; +} +public override bool BIsCurrentMusicRemote() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote(m_pSteamMusicRemote); + return result; +} +public override bool BActivationSuccess(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_BActivationSuccess(m_pSteamMusicRemote,bValue); + return result; +} +public override bool SetDisplayName(string pchDisplayName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_SetDisplayName(m_pSteamMusicRemote,pchDisplayName); + return result; +} +public override bool SetPNGIcon_64x64(IntPtr pvBuffer,uint cbBufferLength) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64(m_pSteamMusicRemote,pvBuffer,cbBufferLength); + return result; +} +public override bool EnablePlayPrevious(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_EnablePlayPrevious(m_pSteamMusicRemote,bValue); + return result; +} +public override bool EnablePlayNext(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_EnablePlayNext(m_pSteamMusicRemote,bValue); + return result; +} +public override bool EnableShuffled(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_EnableShuffled(m_pSteamMusicRemote,bValue); + return result; +} +public override bool EnableLooped(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_EnableLooped(m_pSteamMusicRemote,bValue); + return result; +} +public override bool EnableQueue(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_EnableQueue(m_pSteamMusicRemote,bValue); + return result; +} +public override bool EnablePlaylists(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_EnablePlaylists(m_pSteamMusicRemote,bValue); + return result; +} +public override bool UpdatePlaybackStatus(int nStatus) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus(m_pSteamMusicRemote,nStatus); + return result; +} +public override bool UpdateShuffled(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_UpdateShuffled(m_pSteamMusicRemote,bValue); + return result; +} +public override bool UpdateLooped(bool bValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_UpdateLooped(m_pSteamMusicRemote,bValue); + return result; +} +public override bool UpdateVolume(float flValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_UpdateVolume(m_pSteamMusicRemote,flValue); + return result; +} +public override bool CurrentEntryWillChange() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_CurrentEntryWillChange(m_pSteamMusicRemote); + return result; +} +public override bool CurrentEntryIsAvailable(bool bAvailable) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable(m_pSteamMusicRemote,bAvailable); + return result; +} +public override bool UpdateCurrentEntryText(string pchText) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText(m_pSteamMusicRemote,pchText); + return result; +} +public override bool UpdateCurrentEntryElapsedSeconds(int nValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds(m_pSteamMusicRemote,nValue); + return result; +} +public override bool UpdateCurrentEntryCoverArt(IntPtr pvBuffer,uint cbBufferLength) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt(m_pSteamMusicRemote,pvBuffer,cbBufferLength); + return result; +} +public override bool CurrentEntryDidChange() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_CurrentEntryDidChange(m_pSteamMusicRemote); + return result; +} +public override bool QueueWillChange() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_QueueWillChange(m_pSteamMusicRemote); + return result; +} +public override bool ResetQueueEntries() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_ResetQueueEntries(m_pSteamMusicRemote); + return result; +} +public override bool SetQueueEntry(int nID,int nPosition,string pchEntryText) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_SetQueueEntry(m_pSteamMusicRemote,nID,nPosition,pchEntryText); + return result; +} +public override bool SetCurrentQueueEntry(int nID) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry(m_pSteamMusicRemote,nID); + return result; +} +public override bool QueueDidChange() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_QueueDidChange(m_pSteamMusicRemote); + return result; +} +public override bool PlaylistWillChange() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_PlaylistWillChange(m_pSteamMusicRemote); + return result; +} +public override bool ResetPlaylistEntries() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_ResetPlaylistEntries(m_pSteamMusicRemote); + return result; +} +public override bool SetPlaylistEntry(int nID,int nPosition,string pchEntryText) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_SetPlaylistEntry(m_pSteamMusicRemote,nID,nPosition,pchEntryText); + return result; +} +public override bool SetCurrentPlaylistEntry(int nID) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry(m_pSteamMusicRemote,nID); + return result; +} +public override bool PlaylistDidChange() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamMusicRemote_PlaylistDidChange(m_pSteamMusicRemote); + return result; +} +} + + +public class CSteamHTTP : ISteamHTTP +{ +public CSteamHTTP(IntPtr SteamHTTP) +{ + m_pSteamHTTP = SteamHTTP; +} +IntPtr m_pSteamHTTP; + +public override IntPtr GetIntPtr() { return m_pSteamHTTP; } + +private void CheckIfUsable() +{ + if (m_pSteamHTTP == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint CreateHTTPRequest(uint eHTTPRequestMethod,string pchAbsoluteURL) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamHTTP_CreateHTTPRequest(m_pSteamHTTP,eHTTPRequestMethod,pchAbsoluteURL); + return result; +} +public override bool SetHTTPRequestContextValue(uint hRequest,ulong ulContextValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestContextValue(m_pSteamHTTP,hRequest,ulContextValue); + return result; +} +public override bool SetHTTPRequestNetworkActivityTimeout(uint hRequest,uint unTimeoutSeconds) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(m_pSteamHTTP,hRequest,unTimeoutSeconds); + return result; +} +public override bool SetHTTPRequestHeaderValue(uint hRequest,string pchHeaderName,string pchHeaderValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue(m_pSteamHTTP,hRequest,pchHeaderName,pchHeaderValue); + return result; +} +public override bool SetHTTPRequestGetOrPostParameter(uint hRequest,string pchParamName,string pchParamValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter(m_pSteamHTTP,hRequest,pchParamName,pchParamValue); + return result; +} +public override bool SendHTTPRequest(uint hRequest,ref ulong pCallHandle) +{ + CheckIfUsable(); + pCallHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SendHTTPRequest(m_pSteamHTTP,hRequest,ref pCallHandle); + return result; +} +public override bool SendHTTPRequestAndStreamResponse(uint hRequest,ref ulong pCallHandle) +{ + CheckIfUsable(); + pCallHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse(m_pSteamHTTP,hRequest,ref pCallHandle); + return result; +} +public override bool DeferHTTPRequest(uint hRequest) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_DeferHTTPRequest(m_pSteamHTTP,hRequest); + return result; +} +public override bool PrioritizeHTTPRequest(uint hRequest) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_PrioritizeHTTPRequest(m_pSteamHTTP,hRequest); + return result; +} +public override bool GetHTTPResponseHeaderSize(uint hRequest,string pchHeaderName,ref uint unResponseHeaderSize) +{ + CheckIfUsable(); + unResponseHeaderSize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize(m_pSteamHTTP,hRequest,pchHeaderName,ref unResponseHeaderSize); + return result; +} +public override bool GetHTTPResponseHeaderValue(uint hRequest,string pchHeaderName,IntPtr pHeaderValueBuffer,uint unBufferSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue(m_pSteamHTTP,hRequest,pchHeaderName,pHeaderValueBuffer,unBufferSize); + return result; +} +public override bool GetHTTPResponseBodySize(uint hRequest,ref uint unBodySize) +{ + CheckIfUsable(); + unBodySize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_GetHTTPResponseBodySize(m_pSteamHTTP,hRequest,ref unBodySize); + return result; +} +public override bool GetHTTPResponseBodyData(uint hRequest,IntPtr pBodyDataBuffer,uint unBufferSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_GetHTTPResponseBodyData(m_pSteamHTTP,hRequest,pBodyDataBuffer,unBufferSize); + return result; +} +public override bool GetHTTPStreamingResponseBodyData(uint hRequest,uint cOffset,IntPtr pBodyDataBuffer,uint unBufferSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData(m_pSteamHTTP,hRequest,cOffset,pBodyDataBuffer,unBufferSize); + return result; +} +public override bool ReleaseHTTPRequest(uint hRequest) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_ReleaseHTTPRequest(m_pSteamHTTP,hRequest); + return result; +} +public override bool GetHTTPDownloadProgressPct(uint hRequest,ref float pflPercentOut) +{ + CheckIfUsable(); + pflPercentOut = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct(m_pSteamHTTP,hRequest,ref pflPercentOut); + return result; +} +public override bool SetHTTPRequestRawPostBody(uint hRequest,string pchContentType,IntPtr pubBody,uint unBodyLen) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody(m_pSteamHTTP,hRequest,pchContentType,pubBody,unBodyLen); + return result; +} +public override uint CreateCookieContainer(bool bAllowResponsesToModify) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamHTTP_CreateCookieContainer(m_pSteamHTTP,bAllowResponsesToModify); + return result; +} +public override bool ReleaseCookieContainer(uint hCookieContainer) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_ReleaseCookieContainer(m_pSteamHTTP,hCookieContainer); + return result; +} +public override bool SetCookie(uint hCookieContainer,string pchHost,string pchUrl,string pchCookie) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetCookie(m_pSteamHTTP,hCookieContainer,pchHost,pchUrl,pchCookie); + return result; +} +public override bool SetHTTPRequestCookieContainer(uint hRequest,uint hCookieContainer) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer(m_pSteamHTTP,hRequest,hCookieContainer); + return result; +} +public override bool SetHTTPRequestUserAgentInfo(uint hRequest,string pchUserAgentInfo) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo(m_pSteamHTTP,hRequest,pchUserAgentInfo); + return result; +} +public override bool SetHTTPRequestRequiresVerifiedCertificate(uint hRequest,bool bRequireVerifiedCertificate) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(m_pSteamHTTP,hRequest,bRequireVerifiedCertificate); + return result; +} +public override bool SetHTTPRequestAbsoluteTimeoutMS(uint hRequest,uint unMilliseconds) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(m_pSteamHTTP,hRequest,unMilliseconds); + return result; +} +public override bool GetHTTPRequestWasTimedOut(uint hRequest,ref bool pbWasTimedOut) +{ + CheckIfUsable(); + pbWasTimedOut = false; + bool result = NativeEntrypoints.SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut(m_pSteamHTTP,hRequest,ref pbWasTimedOut); + return result; +} +} + + +public class CSteamUnifiedMessages : ISteamUnifiedMessages +{ +public CSteamUnifiedMessages(IntPtr SteamUnifiedMessages) +{ + m_pSteamUnifiedMessages = SteamUnifiedMessages; +} +IntPtr m_pSteamUnifiedMessages; + +public override IntPtr GetIntPtr() { return m_pSteamUnifiedMessages; } + +private void CheckIfUsable() +{ + if (m_pSteamUnifiedMessages == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override ulong SendMethod(string pchServiceMethod,IntPtr pRequestBuffer,uint unRequestBufferSize,ulong unContext) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUnifiedMessages_SendMethod(m_pSteamUnifiedMessages,pchServiceMethod,pRequestBuffer,unRequestBufferSize,unContext); + return result; +} +public override bool GetMethodResponseInfo(ulong hHandle,ref uint punResponseSize,ref uint peResult) +{ + CheckIfUsable(); + punResponseSize = 0; + peResult = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUnifiedMessages_GetMethodResponseInfo(m_pSteamUnifiedMessages,hHandle,ref punResponseSize,ref peResult); + return result; +} +public override bool GetMethodResponseData(ulong hHandle,IntPtr pResponseBuffer,uint unResponseBufferSize,bool bAutoRelease) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUnifiedMessages_GetMethodResponseData(m_pSteamUnifiedMessages,hHandle,pResponseBuffer,unResponseBufferSize,bAutoRelease); + return result; +} +public override bool ReleaseMethod(ulong hHandle) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUnifiedMessages_ReleaseMethod(m_pSteamUnifiedMessages,hHandle); + return result; +} +public override bool SendNotification(string pchServiceNotification,IntPtr pNotificationBuffer,uint unNotificationBufferSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUnifiedMessages_SendNotification(m_pSteamUnifiedMessages,pchServiceNotification,pNotificationBuffer,unNotificationBufferSize); + return result; +} +} + + +public class CSteamController : ISteamController +{ +public CSteamController(IntPtr SteamController) +{ + m_pSteamController = SteamController; +} +IntPtr m_pSteamController; + +public override IntPtr GetIntPtr() { return m_pSteamController; } + +private void CheckIfUsable() +{ + if (m_pSteamController == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool Init() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamController_Init(m_pSteamController); + return result; +} +public override bool Shutdown() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamController_Shutdown(m_pSteamController); + return result; +} +public override void RunFrame() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamController_RunFrame(m_pSteamController); +} +public override int GetConnectedControllers(ref ulong handlesOut) +{ + CheckIfUsable(); + handlesOut = 0; + int result = NativeEntrypoints.SteamAPI_ISteamController_GetConnectedControllers(m_pSteamController,ref handlesOut); + return result; +} +public override bool ShowBindingPanel(ulong controllerHandle) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamController_ShowBindingPanel(m_pSteamController,controllerHandle); + return result; +} +public override ulong GetActionSetHandle(string pszActionSetName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetActionSetHandle(m_pSteamController,pszActionSetName); + return result; +} +public override void ActivateActionSet(ulong controllerHandle,ulong actionSetHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamController_ActivateActionSet(m_pSteamController,controllerHandle,actionSetHandle); +} +public override ulong GetCurrentActionSet(ulong controllerHandle) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetCurrentActionSet(m_pSteamController,controllerHandle); + return result; +} +public override ulong GetDigitalActionHandle(string pszActionName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetDigitalActionHandle(m_pSteamController,pszActionName); + return result; +} +public override ControllerDigitalActionData_t GetDigitalActionData(ulong controllerHandle,ulong digitalActionHandle) +{ + CheckIfUsable(); + ControllerDigitalActionData_t result = NativeEntrypoints.SteamAPI_ISteamController_GetDigitalActionData(m_pSteamController,controllerHandle,digitalActionHandle); + return result; +} +public override int GetDigitalActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong digitalActionHandle,ref uint originsOut) +{ + CheckIfUsable(); + originsOut = 0; + int result = NativeEntrypoints.SteamAPI_ISteamController_GetDigitalActionOrigins(m_pSteamController,controllerHandle,actionSetHandle,digitalActionHandle,ref originsOut); + return result; +} +public override ulong GetAnalogActionHandle(string pszActionName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetAnalogActionHandle(m_pSteamController,pszActionName); + return result; +} +public override ControllerAnalogActionData_t GetAnalogActionData(ulong controllerHandle,ulong analogActionHandle) +{ + CheckIfUsable(); + ControllerAnalogActionData_t result = NativeEntrypoints.SteamAPI_ISteamController_GetAnalogActionData(m_pSteamController,controllerHandle,analogActionHandle); + return result; +} +public override int GetAnalogActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong analogActionHandle,ref uint originsOut) +{ + CheckIfUsable(); + originsOut = 0; + int result = NativeEntrypoints.SteamAPI_ISteamController_GetAnalogActionOrigins(m_pSteamController,controllerHandle,actionSetHandle,analogActionHandle,ref originsOut); + return result; +} +public override void StopAnalogActionMomentum(ulong controllerHandle,ulong eAction) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamController_StopAnalogActionMomentum(m_pSteamController,controllerHandle,eAction); +} +public override void TriggerHapticPulse(ulong controllerHandle,uint eTargetPad,char usDurationMicroSec) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamController_TriggerHapticPulse(m_pSteamController,controllerHandle,eTargetPad,usDurationMicroSec); +} +} + + +public class CSteamUGC : ISteamUGC +{ +public CSteamUGC(IntPtr SteamUGC) +{ + m_pSteamUGC = SteamUGC; +} +IntPtr m_pSteamUGC; + +public override IntPtr GetIntPtr() { return m_pSteamUGC; } + +private void CheckIfUsable() +{ + if (m_pSteamUGC == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override ulong CreateQueryUserUGCRequest(uint unAccountID,uint eListType,uint eMatchingUGCType,uint eSortOrder,uint nCreatorAppID,uint nConsumerAppID,uint unPage) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(m_pSteamUGC,unAccountID,eListType,eMatchingUGCType,eSortOrder,nCreatorAppID,nConsumerAppID,unPage); + return result; +} +public override ulong CreateQueryAllUGCRequest(uint eQueryType,uint eMatchingeMatchingUGCTypeFileType,uint nCreatorAppID,uint nConsumerAppID,uint unPage) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_CreateQueryAllUGCRequest(m_pSteamUGC,eQueryType,eMatchingeMatchingUGCTypeFileType,nCreatorAppID,nConsumerAppID,unPage); + return result; +} +public override ulong CreateQueryUGCDetailsRequest(ref ulong pvecPublishedFileID,uint unNumPublishedFileIDs) +{ + CheckIfUsable(); + pvecPublishedFileID = 0; + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(m_pSteamUGC,ref pvecPublishedFileID,unNumPublishedFileIDs); + return result; +} +public override ulong SendQueryUGCRequest(ulong handle) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_SendQueryUGCRequest(m_pSteamUGC,handle); + return result; +} +public override bool GetQueryUGCResult(ulong handle,uint index,ref SteamUGCDetails_t pDetails) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCResult(m_pSteamUGC,handle,index,ref pDetails); + return result; +} +public override bool GetQueryUGCPreviewURL(ulong handle,uint index,string pchURL,uint cchURLSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCPreviewURL(m_pSteamUGC,handle,index,pchURL,cchURLSize); + return result; +} +public override bool GetQueryUGCMetadata(ulong handle,uint index,string pchMetadata,uint cchMetadatasize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCMetadata(m_pSteamUGC,handle,index,pchMetadata,cchMetadatasize); + return result; +} +public override bool GetQueryUGCChildren(ulong handle,uint index,ref ulong pvecPublishedFileID,uint cMaxEntries) +{ + CheckIfUsable(); + pvecPublishedFileID = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCChildren(m_pSteamUGC,handle,index,ref pvecPublishedFileID,cMaxEntries); + return result; +} +public override bool GetQueryUGCStatistic(ulong handle,uint index,uint eStatType,ref uint pStatValue) +{ + CheckIfUsable(); + pStatValue = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCStatistic(m_pSteamUGC,handle,index,eStatType,ref pStatValue); + return result; +} +public override uint GetQueryUGCNumAdditionalPreviews(ulong handle,uint index) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews(m_pSteamUGC,handle,index); + return result; +} +public override bool GetQueryUGCAdditionalPreview(ulong handle,uint index,uint previewIndex,string pchURLOrVideoID,uint cchURLSize,ref bool pbIsImage) +{ + CheckIfUsable(); + pbIsImage = false; + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview(m_pSteamUGC,handle,index,previewIndex,pchURLOrVideoID,cchURLSize,ref pbIsImage); + return result; +} +public override uint GetQueryUGCNumKeyValueTags(ulong handle,uint index) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags(m_pSteamUGC,handle,index); + return result; +} +public override bool GetQueryUGCKeyValueTag(ulong handle,uint index,uint keyValueTagIndex,string pchKey,uint cchKeySize,string pchValue,uint cchValueSize) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag(m_pSteamUGC,handle,index,keyValueTagIndex,pchKey,cchKeySize,pchValue,cchValueSize); + return result; +} +public override bool ReleaseQueryUGCRequest(ulong handle) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(m_pSteamUGC,handle); + return result; +} +public override bool AddRequiredTag(ulong handle,string pTagName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_AddRequiredTag(m_pSteamUGC,handle,pTagName); + return result; +} +public override bool AddExcludedTag(ulong handle,string pTagName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_AddExcludedTag(m_pSteamUGC,handle,pTagName); + return result; +} +public override bool SetReturnKeyValueTags(ulong handle,bool bReturnKeyValueTags) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetReturnKeyValueTags(m_pSteamUGC,handle,bReturnKeyValueTags); + return result; +} +public override bool SetReturnLongDescription(ulong handle,bool bReturnLongDescription) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetReturnLongDescription(m_pSteamUGC,handle,bReturnLongDescription); + return result; +} +public override bool SetReturnMetadata(ulong handle,bool bReturnMetadata) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetReturnMetadata(m_pSteamUGC,handle,bReturnMetadata); + return result; +} +public override bool SetReturnChildren(ulong handle,bool bReturnChildren) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetReturnChildren(m_pSteamUGC,handle,bReturnChildren); + return result; +} +public override bool SetReturnAdditionalPreviews(ulong handle,bool bReturnAdditionalPreviews) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetReturnAdditionalPreviews(m_pSteamUGC,handle,bReturnAdditionalPreviews); + return result; +} +public override bool SetReturnTotalOnly(ulong handle,bool bReturnTotalOnly) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetReturnTotalOnly(m_pSteamUGC,handle,bReturnTotalOnly); + return result; +} +public override bool SetLanguage(ulong handle,string pchLanguage) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetLanguage(m_pSteamUGC,handle,pchLanguage); + return result; +} +public override bool SetAllowCachedResponse(ulong handle,uint unMaxAgeSeconds) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetAllowCachedResponse(m_pSteamUGC,handle,unMaxAgeSeconds); + return result; +} +public override bool SetCloudFileNameFilter(ulong handle,string pMatchCloudFileName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetCloudFileNameFilter(m_pSteamUGC,handle,pMatchCloudFileName); + return result; +} +public override bool SetMatchAnyTag(ulong handle,bool bMatchAnyTag) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetMatchAnyTag(m_pSteamUGC,handle,bMatchAnyTag); + return result; +} +public override bool SetSearchText(ulong handle,string pSearchText) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetSearchText(m_pSteamUGC,handle,pSearchText); + return result; +} +public override bool SetRankedByTrendDays(ulong handle,uint unDays) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetRankedByTrendDays(m_pSteamUGC,handle,unDays); + return result; +} +public override bool AddRequiredKeyValueTag(ulong handle,string pKey,string pValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_AddRequiredKeyValueTag(m_pSteamUGC,handle,pKey,pValue); + return result; +} +public override ulong RequestUGCDetails(ulong nPublishedFileID,uint unMaxAgeSeconds) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_RequestUGCDetails(m_pSteamUGC,nPublishedFileID,unMaxAgeSeconds); + return result; +} +public override ulong CreateItem(uint nConsumerAppId,uint eFileType) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_CreateItem(m_pSteamUGC,nConsumerAppId,eFileType); + return result; +} +public override ulong StartItemUpdate(uint nConsumerAppId,ulong nPublishedFileID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_StartItemUpdate(m_pSteamUGC,nConsumerAppId,nPublishedFileID); + return result; +} +public override bool SetItemTitle(ulong handle,string pchTitle) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemTitle(m_pSteamUGC,handle,pchTitle); + return result; +} +public override bool SetItemDescription(ulong handle,string pchDescription) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemDescription(m_pSteamUGC,handle,pchDescription); + return result; +} +public override bool SetItemUpdateLanguage(ulong handle,string pchLanguage) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemUpdateLanguage(m_pSteamUGC,handle,pchLanguage); + return result; +} +public override bool SetItemMetadata(ulong handle,string pchMetaData) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemMetadata(m_pSteamUGC,handle,pchMetaData); + return result; +} +public override bool SetItemVisibility(ulong handle,uint eVisibility) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemVisibility(m_pSteamUGC,handle,eVisibility); + return result; +} +public override bool SetItemTags(ulong updateHandle,ref SteamParamStringArray_t pTags) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemTags(m_pSteamUGC,updateHandle,ref pTags); + return result; +} +public override bool SetItemContent(ulong handle,string pszContentFolder) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemContent(m_pSteamUGC,handle,pszContentFolder); + return result; +} +public override bool SetItemPreview(ulong handle,string pszPreviewFile) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_SetItemPreview(m_pSteamUGC,handle,pszPreviewFile); + return result; +} +public override bool RemoveItemKeyValueTags(ulong handle,string pchKey) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_RemoveItemKeyValueTags(m_pSteamUGC,handle,pchKey); + return result; +} +public override bool AddItemKeyValueTag(ulong handle,string pchKey,string pchValue) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_AddItemKeyValueTag(m_pSteamUGC,handle,pchKey,pchValue); + return result; +} +public override ulong SubmitItemUpdate(ulong handle,string pchChangeNote) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_SubmitItemUpdate(m_pSteamUGC,handle,pchChangeNote); + return result; +} +public override uint GetItemUpdateProgress(ulong handle,ref ulong punBytesProcessed,ref ulong punBytesTotal) +{ + CheckIfUsable(); + punBytesProcessed = 0; + punBytesTotal = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamUGC_GetItemUpdateProgress(m_pSteamUGC,handle,ref punBytesProcessed,ref punBytesTotal); + return result; +} +public override ulong SetUserItemVote(ulong nPublishedFileID,bool bVoteUp) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_SetUserItemVote(m_pSteamUGC,nPublishedFileID,bVoteUp); + return result; +} +public override ulong GetUserItemVote(ulong nPublishedFileID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_GetUserItemVote(m_pSteamUGC,nPublishedFileID); + return result; +} +public override ulong AddItemToFavorites(uint nAppId,ulong nPublishedFileID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_AddItemToFavorites(m_pSteamUGC,nAppId,nPublishedFileID); + return result; +} +public override ulong RemoveItemFromFavorites(uint nAppId,ulong nPublishedFileID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_RemoveItemFromFavorites(m_pSteamUGC,nAppId,nPublishedFileID); + return result; +} +public override ulong SubscribeItem(ulong nPublishedFileID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_SubscribeItem(m_pSteamUGC,nPublishedFileID); + return result; +} +public override ulong UnsubscribeItem(ulong nPublishedFileID) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamUGC_UnsubscribeItem(m_pSteamUGC,nPublishedFileID); + return result; +} +public override uint GetNumSubscribedItems() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUGC_GetNumSubscribedItems(m_pSteamUGC); + return result; +} +public override uint GetSubscribedItems(ref ulong pvecPublishedFileID,uint cMaxEntries) +{ + CheckIfUsable(); + pvecPublishedFileID = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamUGC_GetSubscribedItems(m_pSteamUGC,ref pvecPublishedFileID,cMaxEntries); + return result; +} +public override uint GetItemState(ulong nPublishedFileID) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamUGC_GetItemState(m_pSteamUGC,nPublishedFileID); + return result; +} +public override bool GetItemInstallInfo(ulong nPublishedFileID,ref ulong punSizeOnDisk,string pchFolder,uint cchFolderSize,ref uint punTimeStamp) +{ + CheckIfUsable(); + punSizeOnDisk = 0; + punTimeStamp = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetItemInstallInfo(m_pSteamUGC,nPublishedFileID,ref punSizeOnDisk,pchFolder,cchFolderSize,ref punTimeStamp); + return result; +} +public override bool GetItemDownloadInfo(ulong nPublishedFileID,ref ulong punBytesDownloaded,ref ulong punBytesTotal) +{ + CheckIfUsable(); + punBytesDownloaded = 0; + punBytesTotal = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetItemDownloadInfo(m_pSteamUGC,nPublishedFileID,ref punBytesDownloaded,ref punBytesTotal); + return result; +} +public override bool DownloadItem(ulong nPublishedFileID,bool bHighPriority) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_DownloadItem(m_pSteamUGC,nPublishedFileID,bHighPriority); + return result; +} +public override bool BInitWorkshopForGameServer(uint unWorkshopDepotID,string pszFolder) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_BInitWorkshopForGameServer(m_pSteamUGC,unWorkshopDepotID,pszFolder); + return result; +} +public override void SuspendDownloads(bool bSuspend) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUGC_SuspendDownloads(m_pSteamUGC,bSuspend); +} +} + + +public class CSteamAppList : ISteamAppList +{ +public CSteamAppList(IntPtr SteamAppList) +{ + m_pSteamAppList = SteamAppList; +} +IntPtr m_pSteamAppList; + +public override IntPtr GetIntPtr() { return m_pSteamAppList; } + +private void CheckIfUsable() +{ + if (m_pSteamAppList == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint GetNumInstalledApps() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamAppList_GetNumInstalledApps(m_pSteamAppList); + return result; +} +public override uint GetInstalledApps(ref uint pvecAppID,uint unMaxAppIDs) +{ + CheckIfUsable(); + pvecAppID = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamAppList_GetInstalledApps(m_pSteamAppList,ref pvecAppID,unMaxAppIDs); + return result; +} +public override int GetAppName(uint nAppID,string pchName,int cchNameMax) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamAppList_GetAppName(m_pSteamAppList,nAppID,pchName,cchNameMax); + return result; +} +public override int GetAppInstallDir(uint nAppID,string pchDirectory,int cchNameMax) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamAppList_GetAppInstallDir(m_pSteamAppList,nAppID,pchDirectory,cchNameMax); + return result; +} +public override int GetAppBuildId(uint nAppID) +{ + CheckIfUsable(); + int result = NativeEntrypoints.SteamAPI_ISteamAppList_GetAppBuildId(m_pSteamAppList,nAppID); + return result; +} +} + + +public class CSteamHTMLSurface : ISteamHTMLSurface +{ +public CSteamHTMLSurface(IntPtr SteamHTMLSurface) +{ + m_pSteamHTMLSurface = SteamHTMLSurface; +} +IntPtr m_pSteamHTMLSurface; + +public override IntPtr GetIntPtr() { return m_pSteamHTMLSurface; } + +private void CheckIfUsable() +{ + if (m_pSteamHTMLSurface == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override void DestructISteamHTMLSurface() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface(m_pSteamHTMLSurface); +} +public override bool Init() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTMLSurface_Init(m_pSteamHTMLSurface); + return result; +} +public override bool Shutdown() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamHTMLSurface_Shutdown(m_pSteamHTMLSurface); + return result; +} +public override ulong CreateBrowser(string pchUserAgent,string pchUserCSS) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamHTMLSurface_CreateBrowser(m_pSteamHTMLSurface,pchUserAgent,pchUserCSS); + return result; +} +public override void RemoveBrowser(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_RemoveBrowser(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void LoadURL(uint unBrowserHandle,string pchURL,string pchPostData) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_LoadURL(m_pSteamHTMLSurface,unBrowserHandle,pchURL,pchPostData); +} +public override void SetSize(uint unBrowserHandle,uint unWidth,uint unHeight) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_SetSize(m_pSteamHTMLSurface,unBrowserHandle,unWidth,unHeight); +} +public override void StopLoad(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_StopLoad(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void Reload(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_Reload(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void GoBack(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_GoBack(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void GoForward(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_GoForward(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void AddHeader(uint unBrowserHandle,string pchKey,string pchValue) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_AddHeader(m_pSteamHTMLSurface,unBrowserHandle,pchKey,pchValue); +} +public override void ExecuteJavascript(uint unBrowserHandle,string pchScript) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_ExecuteJavascript(m_pSteamHTMLSurface,unBrowserHandle,pchScript); +} +public override void MouseUp(uint unBrowserHandle,uint eMouseButton) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_MouseUp(m_pSteamHTMLSurface,unBrowserHandle,eMouseButton); +} +public override void MouseDown(uint unBrowserHandle,uint eMouseButton) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_MouseDown(m_pSteamHTMLSurface,unBrowserHandle,eMouseButton); +} +public override void MouseDoubleClick(uint unBrowserHandle,uint eMouseButton) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_MouseDoubleClick(m_pSteamHTMLSurface,unBrowserHandle,eMouseButton); +} +public override void MouseMove(uint unBrowserHandle,int x,int y) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_MouseMove(m_pSteamHTMLSurface,unBrowserHandle,x,y); +} +public override void MouseWheel(uint unBrowserHandle,int nDelta) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_MouseWheel(m_pSteamHTMLSurface,unBrowserHandle,nDelta); +} +public override void KeyDown(uint unBrowserHandle,uint nNativeKeyCode,uint eHTMLKeyModifiers) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_KeyDown(m_pSteamHTMLSurface,unBrowserHandle,nNativeKeyCode,eHTMLKeyModifiers); +} +public override void KeyUp(uint unBrowserHandle,uint nNativeKeyCode,uint eHTMLKeyModifiers) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_KeyUp(m_pSteamHTMLSurface,unBrowserHandle,nNativeKeyCode,eHTMLKeyModifiers); +} +public override void KeyChar(uint unBrowserHandle,uint cUnicodeChar,uint eHTMLKeyModifiers) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_KeyChar(m_pSteamHTMLSurface,unBrowserHandle,cUnicodeChar,eHTMLKeyModifiers); +} +public override void SetHorizontalScroll(uint unBrowserHandle,uint nAbsolutePixelScroll) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_SetHorizontalScroll(m_pSteamHTMLSurface,unBrowserHandle,nAbsolutePixelScroll); +} +public override void SetVerticalScroll(uint unBrowserHandle,uint nAbsolutePixelScroll) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_SetVerticalScroll(m_pSteamHTMLSurface,unBrowserHandle,nAbsolutePixelScroll); +} +public override void SetKeyFocus(uint unBrowserHandle,bool bHasKeyFocus) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_SetKeyFocus(m_pSteamHTMLSurface,unBrowserHandle,bHasKeyFocus); +} +public override void ViewSource(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_ViewSource(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void CopyToClipboard(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_CopyToClipboard(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void PasteFromClipboard(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_PasteFromClipboard(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void Find(uint unBrowserHandle,string pchSearchStr,bool bCurrentlyInFind,bool bReverse) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_Find(m_pSteamHTMLSurface,unBrowserHandle,pchSearchStr,bCurrentlyInFind,bReverse); +} +public override void StopFind(uint unBrowserHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_StopFind(m_pSteamHTMLSurface,unBrowserHandle); +} +public override void GetLinkAtPosition(uint unBrowserHandle,int x,int y) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_GetLinkAtPosition(m_pSteamHTMLSurface,unBrowserHandle,x,y); +} +public override void SetCookie(string pchHostname,string pchKey,string pchValue,string pchPath,ulong nExpires,bool bSecure,bool bHTTPOnly) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_SetCookie(m_pSteamHTMLSurface,pchHostname,pchKey,pchValue,pchPath,nExpires,bSecure,bHTTPOnly); +} +public override void SetPageScaleFactor(uint unBrowserHandle,float flZoom,int nPointX,int nPointY) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_SetPageScaleFactor(m_pSteamHTMLSurface,unBrowserHandle,flZoom,nPointX,nPointY); +} +public override void SetBackgroundMode(uint unBrowserHandle,bool bBackgroundMode) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_SetBackgroundMode(m_pSteamHTMLSurface,unBrowserHandle,bBackgroundMode); +} +public override void AllowStartRequest(uint unBrowserHandle,bool bAllowed) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_AllowStartRequest(m_pSteamHTMLSurface,unBrowserHandle,bAllowed); +} +public override void JSDialogResponse(uint unBrowserHandle,bool bResult) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_JSDialogResponse(m_pSteamHTMLSurface,unBrowserHandle,bResult); +} +public override void FileLoadDialogResponse(uint unBrowserHandle,string pchSelectedFiles) +{ + CheckIfUsable(); + pchSelectedFiles = ""; + NativeEntrypoints.SteamAPI_ISteamHTMLSurface_FileLoadDialogResponse(m_pSteamHTMLSurface,unBrowserHandle,pchSelectedFiles); +} +} + + +public class CSteamInventory : ISteamInventory +{ +public CSteamInventory(IntPtr SteamInventory) +{ + m_pSteamInventory = SteamInventory; +} +IntPtr m_pSteamInventory; + +public override IntPtr GetIntPtr() { return m_pSteamInventory; } + +private void CheckIfUsable() +{ + if (m_pSteamInventory == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override uint GetResultStatus(int resultHandle) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultStatus(m_pSteamInventory,resultHandle); + return result; +} +public override bool GetResultItems(int resultHandle,out SteamItemDetails_t [] pOutItemsArray) +{ + CheckIfUsable(); + uint punOutItemsArraySize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultItems(m_pSteamInventory,resultHandle,null,ref punOutItemsArraySize); + pOutItemsArray= new SteamItemDetails_t[punOutItemsArraySize]; + result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultItems(m_pSteamInventory,resultHandle,pOutItemsArray,ref punOutItemsArraySize); + return result; +} +public override uint GetResultTimestamp(int resultHandle) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultTimestamp(m_pSteamInventory,resultHandle); + return result; +} +public override bool CheckResultSteamID(int resultHandle,ulong steamIDExpected) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_CheckResultSteamID(m_pSteamInventory,resultHandle,steamIDExpected); + return result; +} +public override void DestroyResult(int resultHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamInventory_DestroyResult(m_pSteamInventory,resultHandle); +} +public override bool GetAllItems(ref int pResultHandle) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetAllItems(m_pSteamInventory,ref pResultHandle); + return result; +} +public override bool GetItemsByID(ref int pResultHandle,ulong [] pInstanceIDs) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemsByID(m_pSteamInventory,ref pResultHandle,pInstanceIDs,(uint) pInstanceIDs.Length); + return result; +} +public override bool SerializeResult(int resultHandle,IntPtr pOutBuffer,ref uint punOutBufferSize) +{ + CheckIfUsable(); + punOutBufferSize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_SerializeResult(m_pSteamInventory,resultHandle,pOutBuffer,ref punOutBufferSize); + return result; +} +public override bool DeserializeResult(ref int pOutResultHandle,IntPtr pBuffer,uint unBufferSize,bool bRESERVED_MUST_BE_FALSE) +{ + CheckIfUsable(); + pOutResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_DeserializeResult(m_pSteamInventory,ref pOutResultHandle,pBuffer,unBufferSize,bRESERVED_MUST_BE_FALSE); + return result; +} +public override bool GenerateItems(ref int pResultHandle,int [] pArrayItemDefs,uint [] punArrayQuantity) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GenerateItems(m_pSteamInventory,ref pResultHandle,pArrayItemDefs,punArrayQuantity,(uint) punArrayQuantity.Length); + return result; +} +public override bool GrantPromoItems(ref int pResultHandle) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GrantPromoItems(m_pSteamInventory,ref pResultHandle); + return result; +} +public override bool AddPromoItem(ref int pResultHandle,int itemDef) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_AddPromoItem(m_pSteamInventory,ref pResultHandle,itemDef); + return result; +} +public override bool AddPromoItems(ref int pResultHandle,int [] pArrayItemDefs) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_AddPromoItems(m_pSteamInventory,ref pResultHandle,pArrayItemDefs,(uint) pArrayItemDefs.Length); + return result; +} +public override bool ConsumeItem(ref int pResultHandle,ulong itemConsume,uint unQuantity) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_ConsumeItem(m_pSteamInventory,ref pResultHandle,itemConsume,unQuantity); + return result; +} +public override bool ExchangeItems(ref int pResultHandle,int [] pArrayGenerate,uint [] punArrayGenerateQuantity,ulong [] pArrayDestroy,uint [] punArrayDestroyQuantity) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_ExchangeItems(m_pSteamInventory,ref pResultHandle,pArrayGenerate,punArrayGenerateQuantity,(uint) punArrayGenerateQuantity.Length,pArrayDestroy,punArrayDestroyQuantity,(uint) punArrayDestroyQuantity.Length); + return result; +} +public override bool TransferItemQuantity(ref int pResultHandle,ulong itemIdSource,uint unQuantity,ulong itemIdDest) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_TransferItemQuantity(m_pSteamInventory,ref pResultHandle,itemIdSource,unQuantity,itemIdDest); + return result; +} +public override void SendItemDropHeartbeat() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamInventory_SendItemDropHeartbeat(m_pSteamInventory); +} +public override bool TriggerItemDrop(ref int pResultHandle,int dropListDefinition) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_TriggerItemDrop(m_pSteamInventory,ref pResultHandle,dropListDefinition); + return result; +} +public override bool TradeItems(ref int pResultHandle,ulong steamIDTradePartner,ulong [] pArrayGive,uint [] pArrayGiveQuantity,ulong [] pArrayGet,uint [] pArrayGetQuantity) +{ + CheckIfUsable(); + pResultHandle = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_TradeItems(m_pSteamInventory,ref pResultHandle,steamIDTradePartner,pArrayGive,pArrayGiveQuantity,(uint) pArrayGiveQuantity.Length,pArrayGet,pArrayGetQuantity,(uint) pArrayGetQuantity.Length); + return result; +} +public override bool LoadItemDefinitions() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_LoadItemDefinitions(m_pSteamInventory); + return result; +} +public override bool GetItemDefinitionIDs(out int [] pItemDefIDs) +{ + CheckIfUsable(); + uint punItemDefIDsArraySize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemDefinitionIDs(m_pSteamInventory,null,ref punItemDefIDsArraySize); + pItemDefIDs= new int[punItemDefIDsArraySize]; + result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemDefinitionIDs(m_pSteamInventory,pItemDefIDs,ref punItemDefIDsArraySize); + return result; +} +public override bool GetItemDefinitionProperty(int iDefinition,string pchPropertyName,out string pchValueBuffer) +{ + CheckIfUsable(); + uint punValueBufferSize = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemDefinitionProperty(m_pSteamInventory,iDefinition,pchPropertyName,null,ref punValueBufferSize); + System.Text.StringBuilder pStrBuffer = new System.Text.StringBuilder((int)punValueBufferSize); + result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemDefinitionProperty(m_pSteamInventory,iDefinition,pchPropertyName,pStrBuffer,ref punValueBufferSize); + pchValueBuffer = pStrBuffer.ToString(); + return result; +} +} + + +public class CSteamVideo : ISteamVideo +{ +public CSteamVideo(IntPtr SteamVideo) +{ + m_pSteamVideo = SteamVideo; +} +IntPtr m_pSteamVideo; + +public override IntPtr GetIntPtr() { return m_pSteamVideo; } + +private void CheckIfUsable() +{ + if (m_pSteamVideo == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override void GetVideoURL(uint unVideoAppID) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamVideo_GetVideoURL(m_pSteamVideo,unVideoAppID); +} +public override bool IsBroadcasting(ref int pnNumViewers) +{ + CheckIfUsable(); + pnNumViewers = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamVideo_IsBroadcasting(m_pSteamVideo,ref pnNumViewers); + return result; +} +} + + +public class CSteamGameServer : ISteamGameServer +{ +public CSteamGameServer(IntPtr SteamGameServer) +{ + m_pSteamGameServer = SteamGameServer; +} +IntPtr m_pSteamGameServer; + +public override IntPtr GetIntPtr() { return m_pSteamGameServer; } + +private void CheckIfUsable() +{ + if (m_pSteamGameServer == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override bool InitGameServer(uint unIP,char usGamePort,char usQueryPort,uint unFlags,uint nGameAppId,string pchVersionString) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_InitGameServer(m_pSteamGameServer,unIP,usGamePort,usQueryPort,unFlags,nGameAppId,pchVersionString); + return result; +} +public override void SetProduct(string pszProduct) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetProduct(m_pSteamGameServer,pszProduct); +} +public override void SetGameDescription(string pszGameDescription) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetGameDescription(m_pSteamGameServer,pszGameDescription); +} +public override void SetModDir(string pszModDir) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetModDir(m_pSteamGameServer,pszModDir); +} +public override void SetDedicatedServer(bool bDedicated) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetDedicatedServer(m_pSteamGameServer,bDedicated); +} +public override void LogOn(string pszToken) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_LogOn(m_pSteamGameServer,pszToken); +} +public override void LogOnAnonymous() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_LogOnAnonymous(m_pSteamGameServer); +} +public override void LogOff() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_LogOff(m_pSteamGameServer); +} +public override bool BLoggedOn() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_BLoggedOn(m_pSteamGameServer); + return result; +} +public override bool BSecure() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_BSecure(m_pSteamGameServer); + return result; +} +public override ulong GetSteamID() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamGameServer_GetSteamID(m_pSteamGameServer); + return result; +} +public override bool WasRestartRequested() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_WasRestartRequested(m_pSteamGameServer); + return result; +} +public override void SetMaxPlayerCount(int cPlayersMax) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetMaxPlayerCount(m_pSteamGameServer,cPlayersMax); +} +public override void SetBotPlayerCount(int cBotplayers) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetBotPlayerCount(m_pSteamGameServer,cBotplayers); +} +public override void SetServerName(string pszServerName) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetServerName(m_pSteamGameServer,pszServerName); +} +public override void SetMapName(string pszMapName) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetMapName(m_pSteamGameServer,pszMapName); +} +public override void SetPasswordProtected(bool bPasswordProtected) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetPasswordProtected(m_pSteamGameServer,bPasswordProtected); +} +public override void SetSpectatorPort(char unSpectatorPort) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetSpectatorPort(m_pSteamGameServer,unSpectatorPort); +} +public override void SetSpectatorServerName(string pszSpectatorServerName) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetSpectatorServerName(m_pSteamGameServer,pszSpectatorServerName); +} +public override void ClearAllKeyValues() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_ClearAllKeyValues(m_pSteamGameServer); +} +public override void SetKeyValue(string pKey,string pValue) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetKeyValue(m_pSteamGameServer,pKey,pValue); +} +public override void SetGameTags(string pchGameTags) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetGameTags(m_pSteamGameServer,pchGameTags); +} +public override void SetGameData(string pchGameData) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetGameData(m_pSteamGameServer,pchGameData); +} +public override void SetRegion(string pszRegion) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetRegion(m_pSteamGameServer,pszRegion); +} +public override bool SendUserConnectAndAuthenticate(uint unIPClient,IntPtr pvAuthBlob,uint cubAuthBlobSize,ref CSteamID pSteamIDUser) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate(m_pSteamGameServer,unIPClient,pvAuthBlob,cubAuthBlobSize,ref pSteamIDUser); + return result; +} +public override ulong CreateUnauthenticatedUserConnection() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection(m_pSteamGameServer); + return result; +} +public override void SendUserDisconnect(ulong steamIDUser) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SendUserDisconnect(m_pSteamGameServer,steamIDUser); +} +public override bool BUpdateUserData(ulong steamIDUser,string pchPlayerName,uint uScore) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_BUpdateUserData(m_pSteamGameServer,steamIDUser,pchPlayerName,uScore); + return result; +} +public override uint GetAuthSessionTicket(IntPtr pTicket,int cbMaxTicket,ref uint pcbTicket) +{ + CheckIfUsable(); + pcbTicket = 0; + uint result = NativeEntrypoints.SteamAPI_ISteamGameServer_GetAuthSessionTicket(m_pSteamGameServer,pTicket,cbMaxTicket,ref pcbTicket); + return result; +} +public override uint BeginAuthSession(IntPtr pAuthTicket,int cbAuthTicket,ulong steamID) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamGameServer_BeginAuthSession(m_pSteamGameServer,pAuthTicket,cbAuthTicket,steamID); + return result; +} +public override void EndAuthSession(ulong steamID) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_EndAuthSession(m_pSteamGameServer,steamID); +} +public override void CancelAuthTicket(uint hAuthTicket) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_CancelAuthTicket(m_pSteamGameServer,hAuthTicket); +} +public override uint UserHasLicenseForApp(ulong steamID,uint appID) +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamGameServer_UserHasLicenseForApp(m_pSteamGameServer,steamID,appID); + return result; +} +public override bool RequestUserGroupStatus(ulong steamIDUser,ulong steamIDGroup) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_RequestUserGroupStatus(m_pSteamGameServer,steamIDUser,steamIDGroup); + return result; +} +public override void GetGameplayStats() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_GetGameplayStats(m_pSteamGameServer); +} +public override ulong GetServerReputation() +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamGameServer_GetServerReputation(m_pSteamGameServer); + return result; +} +public override uint GetPublicIP() +{ + CheckIfUsable(); + uint result = NativeEntrypoints.SteamAPI_ISteamGameServer_GetPublicIP(m_pSteamGameServer); + return result; +} +public override bool HandleIncomingPacket(IntPtr pData,int cbData,uint srcIP,char srcPort) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServer_HandleIncomingPacket(m_pSteamGameServer,pData,cbData,srcIP,srcPort); + return result; +} +public override int GetNextOutgoingPacket(IntPtr pOut,int cbMaxOut,ref uint pNetAdr,ref char pPort) +{ + CheckIfUsable(); + pNetAdr = 0; + pPort = (char) 0; + int result = NativeEntrypoints.SteamAPI_ISteamGameServer_GetNextOutgoingPacket(m_pSteamGameServer,pOut,cbMaxOut,ref pNetAdr,ref pPort); + return result; +} +public override void EnableHeartbeats(bool bActive) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_EnableHeartbeats(m_pSteamGameServer,bActive); +} +public override void SetHeartbeatInterval(int iHeartbeatInterval) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_SetHeartbeatInterval(m_pSteamGameServer,iHeartbeatInterval); +} +public override void ForceHeartbeat() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamGameServer_ForceHeartbeat(m_pSteamGameServer); +} +public override ulong AssociateWithClan(ulong steamIDClan) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamGameServer_AssociateWithClan(m_pSteamGameServer,steamIDClan); + return result; +} +public override ulong ComputeNewPlayerCompatibility(ulong steamIDNewPlayer) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility(m_pSteamGameServer,steamIDNewPlayer); + return result; +} +} + + +public class CSteamGameServerStats : ISteamGameServerStats +{ +public CSteamGameServerStats(IntPtr SteamGameServerStats) +{ + m_pSteamGameServerStats = SteamGameServerStats; +} +IntPtr m_pSteamGameServerStats; + +public override IntPtr GetIntPtr() { return m_pSteamGameServerStats; } + +private void CheckIfUsable() +{ + if (m_pSteamGameServerStats == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override ulong RequestUserStats(ulong steamIDUser) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_RequestUserStats(m_pSteamGameServerStats,steamIDUser); + return result; +} +public override bool GetUserStat(ulong steamIDUser,string pchName,ref int pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_GetUserStat(m_pSteamGameServerStats,steamIDUser,pchName,ref pData); + return result; +} +public override bool GetUserStat0(ulong steamIDUser,string pchName,ref float pData) +{ + CheckIfUsable(); + pData = 0; + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_GetUserStat0(m_pSteamGameServerStats,steamIDUser,pchName,ref pData); + return result; +} +public override bool GetUserAchievement(ulong steamIDUser,string pchName,ref bool pbAchieved) +{ + CheckIfUsable(); + pbAchieved = false; + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_GetUserAchievement(m_pSteamGameServerStats,steamIDUser,pchName,ref pbAchieved); + return result; +} +public override bool SetUserStat(ulong steamIDUser,string pchName,int nData) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_SetUserStat(m_pSteamGameServerStats,steamIDUser,pchName,nData); + return result; +} +public override bool SetUserStat0(ulong steamIDUser,string pchName,float fData) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_SetUserStat0(m_pSteamGameServerStats,steamIDUser,pchName,fData); + return result; +} +public override bool UpdateUserAvgRateStat(ulong steamIDUser,string pchName,float flCountThisSession,double dSessionLength) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat(m_pSteamGameServerStats,steamIDUser,pchName,flCountThisSession,dSessionLength); + return result; +} +public override bool SetUserAchievement(ulong steamIDUser,string pchName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_SetUserAchievement(m_pSteamGameServerStats,steamIDUser,pchName); + return result; +} +public override bool ClearUserAchievement(ulong steamIDUser,string pchName) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_ClearUserAchievement(m_pSteamGameServerStats,steamIDUser,pchName); + return result; +} +public override ulong StoreUserStats(ulong steamIDUser) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamGameServerStats_StoreUserStats(m_pSteamGameServerStats,steamIDUser); + return result; +} +} + + +public class SteamAPIInterop +{ +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_RestartAppIfNecessary")] +internal static extern void SteamAPI_RestartAppIfNecessary(uint unOwnAppID ); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_Init")] +internal static extern void SteamAPI_Init(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_RunCallbacks")] +internal static extern void SteamAPI_RunCallbacks(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_RegisterCallback")] +internal static extern void SteamAPI_RegisterCallback(IntPtr pCallback, int iCallback); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_UnregisterCallback")] +internal static extern void SteamAPI_UnregisterCallback(IntPtr pCallback); +[DllImportAttribute("Steam_api", EntryPoint = "SteamClient")] +internal static extern IntPtr SteamClient(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamUser")] +internal static extern IntPtr SteamUser(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamFriends")] +internal static extern IntPtr SteamFriends(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamUtils")] +internal static extern IntPtr SteamUtils(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmaking")] +internal static extern IntPtr SteamMatchmaking(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingServerListResponse")] +internal static extern IntPtr SteamMatchmakingServerListResponse(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingPingResponse")] +internal static extern IntPtr SteamMatchmakingPingResponse(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingPlayersResponse")] +internal static extern IntPtr SteamMatchmakingPlayersResponse(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingRulesResponse")] +internal static extern IntPtr SteamMatchmakingRulesResponse(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingServers")] +internal static extern IntPtr SteamMatchmakingServers(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamRemoteStorage")] +internal static extern IntPtr SteamRemoteStorage(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamUserStats")] +internal static extern IntPtr SteamUserStats(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamApps")] +internal static extern IntPtr SteamApps(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamNetworking")] +internal static extern IntPtr SteamNetworking(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamScreenshots")] +internal static extern IntPtr SteamScreenshots(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMusic")] +internal static extern IntPtr SteamMusic(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamMusicRemote")] +internal static extern IntPtr SteamMusicRemote(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamHTTP")] +internal static extern IntPtr SteamHTTP(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamUnifiedMessages")] +internal static extern IntPtr SteamUnifiedMessages(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamController")] +internal static extern IntPtr SteamController(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamUGC")] +internal static extern IntPtr SteamUGC(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAppList")] +internal static extern IntPtr SteamAppList(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamHTMLSurface")] +internal static extern IntPtr SteamHTMLSurface(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamInventory")] +internal static extern IntPtr SteamInventory(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamVideo")] +internal static extern IntPtr SteamVideo(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamGameServer")] +internal static extern IntPtr SteamGameServer(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamGameServerStats")] +internal static extern IntPtr SteamGameServerStats(); +} + + +public enum EUniverse +{ + k_EUniverseInvalid = 0, + k_EUniversePublic = 1, + k_EUniverseBeta = 2, + k_EUniverseInternal = 3, + k_EUniverseDev = 4, + k_EUniverseMax = 5, +} +public enum EResult +{ + k_EResultOK = 1, + k_EResultFail = 2, + k_EResultNoConnection = 3, + k_EResultInvalidPassword = 5, + k_EResultLoggedInElsewhere = 6, + k_EResultInvalidProtocolVer = 7, + k_EResultInvalidParam = 8, + k_EResultFileNotFound = 9, + k_EResultBusy = 10, + k_EResultInvalidState = 11, + k_EResultInvalidName = 12, + k_EResultInvalidEmail = 13, + k_EResultDuplicateName = 14, + k_EResultAccessDenied = 15, + k_EResultTimeout = 16, + k_EResultBanned = 17, + k_EResultAccountNotFound = 18, + k_EResultInvalidSteamID = 19, + k_EResultServiceUnavailable = 20, + k_EResultNotLoggedOn = 21, + k_EResultPending = 22, + k_EResultEncryptionFailure = 23, + k_EResultInsufficientPrivilege = 24, + k_EResultLimitExceeded = 25, + k_EResultRevoked = 26, + k_EResultExpired = 27, + k_EResultAlreadyRedeemed = 28, + k_EResultDuplicateRequest = 29, + k_EResultAlreadyOwned = 30, + k_EResultIPNotFound = 31, + k_EResultPersistFailed = 32, + k_EResultLockingFailed = 33, + k_EResultLogonSessionReplaced = 34, + k_EResultConnectFailed = 35, + k_EResultHandshakeFailed = 36, + k_EResultIOFailure = 37, + k_EResultRemoteDisconnect = 38, + k_EResultShoppingCartNotFound = 39, + k_EResultBlocked = 40, + k_EResultIgnored = 41, + k_EResultNoMatch = 42, + k_EResultAccountDisabled = 43, + k_EResultServiceReadOnly = 44, + k_EResultAccountNotFeatured = 45, + k_EResultAdministratorOK = 46, + k_EResultContentVersion = 47, + k_EResultTryAnotherCM = 48, + k_EResultPasswordRequiredToKickSession = 49, + k_EResultAlreadyLoggedInElsewhere = 50, + k_EResultSuspended = 51, + k_EResultCancelled = 52, + k_EResultDataCorruption = 53, + k_EResultDiskFull = 54, + k_EResultRemoteCallFailed = 55, + k_EResultPasswordUnset = 56, + k_EResultExternalAccountUnlinked = 57, + k_EResultPSNTicketInvalid = 58, + k_EResultExternalAccountAlreadyLinked = 59, + k_EResultRemoteFileConflict = 60, + k_EResultIllegalPassword = 61, + k_EResultSameAsPreviousValue = 62, + k_EResultAccountLogonDenied = 63, + k_EResultCannotUseOldPassword = 64, + k_EResultInvalidLoginAuthCode = 65, + k_EResultAccountLogonDeniedNoMail = 66, + k_EResultHardwareNotCapableOfIPT = 67, + k_EResultIPTInitError = 68, + k_EResultParentalControlRestricted = 69, + k_EResultFacebookQueryError = 70, + k_EResultExpiredLoginAuthCode = 71, + k_EResultIPLoginRestrictionFailed = 72, + k_EResultAccountLockedDown = 73, + k_EResultAccountLogonDeniedVerifiedEmailRequired = 74, + k_EResultNoMatchingURL = 75, + k_EResultBadResponse = 76, + k_EResultRequirePasswordReEntry = 77, + k_EResultValueOutOfRange = 78, + k_EResultUnexpectedError = 79, + k_EResultDisabled = 80, + k_EResultInvalidCEGSubmission = 81, + k_EResultRestrictedDevice = 82, + k_EResultRegionLocked = 83, + k_EResultRateLimitExceeded = 84, + k_EResultAccountLoginDeniedNeedTwoFactor = 85, + k_EResultItemDeleted = 86, + k_EResultAccountLoginDeniedThrottle = 87, + k_EResultTwoFactorCodeMismatch = 88, + k_EResultTwoFactorActivationCodeMismatch = 89, + k_EResultAccountAssociatedToMultiplePartners = 90, + k_EResultNotModified = 91, + k_EResultNoMobileDevice = 92, + k_EResultTimeNotSynced = 93, + k_EResultSmsCodeFailed = 94, + k_EResultAccountLimitExceeded = 95, + k_EResultAccountActivityLimitExceeded = 96, + k_EResultPhoneActivityLimitExceeded = 97, + k_EResultRefundToWallet = 98, + k_EResultEmailSendFailure = 99, + k_EResultNotSettled = 100, + k_EResultNeedCaptcha = 101, +} +public enum EVoiceResult +{ + k_EVoiceResultOK = 0, + k_EVoiceResultNotInitialized = 1, + k_EVoiceResultNotRecording = 2, + k_EVoiceResultNoData = 3, + k_EVoiceResultBufferTooSmall = 4, + k_EVoiceResultDataCorrupted = 5, + k_EVoiceResultRestricted = 6, + k_EVoiceResultUnsupportedCodec = 7, + k_EVoiceResultReceiverOutOfDate = 8, + k_EVoiceResultReceiverDidNotAnswer = 9, +} +public enum EDenyReason +{ + k_EDenyInvalid = 0, + k_EDenyInvalidVersion = 1, + k_EDenyGeneric = 2, + k_EDenyNotLoggedOn = 3, + k_EDenyNoLicense = 4, + k_EDenyCheater = 5, + k_EDenyLoggedInElseWhere = 6, + k_EDenyUnknownText = 7, + k_EDenyIncompatibleAnticheat = 8, + k_EDenyMemoryCorruption = 9, + k_EDenyIncompatibleSoftware = 10, + k_EDenySteamConnectionLost = 11, + k_EDenySteamConnectionError = 12, + k_EDenySteamResponseTimedOut = 13, + k_EDenySteamValidationStalled = 14, + k_EDenySteamOwnerLeftGuestUser = 15, +} +public enum EBeginAuthSessionResult +{ + k_EBeginAuthSessionResultOK = 0, + k_EBeginAuthSessionResultInvalidTicket = 1, + k_EBeginAuthSessionResultDuplicateRequest = 2, + k_EBeginAuthSessionResultInvalidVersion = 3, + k_EBeginAuthSessionResultGameMismatch = 4, + k_EBeginAuthSessionResultExpiredTicket = 5, +} +public enum EAuthSessionResponse +{ + k_EAuthSessionResponseOK = 0, + k_EAuthSessionResponseUserNotConnectedToSteam = 1, + k_EAuthSessionResponseNoLicenseOrExpired = 2, + k_EAuthSessionResponseVACBanned = 3, + k_EAuthSessionResponseLoggedInElseWhere = 4, + k_EAuthSessionResponseVACCheckTimedOut = 5, + k_EAuthSessionResponseAuthTicketCanceled = 6, + k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, + k_EAuthSessionResponseAuthTicketInvalid = 8, + k_EAuthSessionResponsePublisherIssuedBan = 9, +} +public enum EUserHasLicenseForAppResult +{ + k_EUserHasLicenseResultHasLicense = 0, + k_EUserHasLicenseResultDoesNotHaveLicense = 1, + k_EUserHasLicenseResultNoAuth = 2, +} +public enum EAccountType +{ + k_EAccountTypeInvalid = 0, + k_EAccountTypeIndividual = 1, + k_EAccountTypeMultiseat = 2, + k_EAccountTypeGameServer = 3, + k_EAccountTypeAnonGameServer = 4, + k_EAccountTypePending = 5, + k_EAccountTypeContentServer = 6, + k_EAccountTypeClan = 7, + k_EAccountTypeChat = 8, + k_EAccountTypeConsoleUser = 9, + k_EAccountTypeAnonUser = 10, + k_EAccountTypeMax = 11, +} +public enum EAppReleaseState +{ + k_EAppReleaseState_Unknown = 0, + k_EAppReleaseState_Unavailable = 1, + k_EAppReleaseState_Prerelease = 2, + k_EAppReleaseState_PreloadOnly = 3, + k_EAppReleaseState_Released = 4, +} +public enum EAppOwnershipFlags +{ + k_EAppOwnershipFlags_None = 0, + k_EAppOwnershipFlags_OwnsLicense = 1, + k_EAppOwnershipFlags_FreeLicense = 2, + k_EAppOwnershipFlags_RegionRestricted = 4, + k_EAppOwnershipFlags_LowViolence = 8, + k_EAppOwnershipFlags_InvalidPlatform = 16, + k_EAppOwnershipFlags_SharedLicense = 32, + k_EAppOwnershipFlags_FreeWeekend = 64, + k_EAppOwnershipFlags_RetailLicense = 128, + k_EAppOwnershipFlags_LicenseLocked = 256, + k_EAppOwnershipFlags_LicensePending = 512, + k_EAppOwnershipFlags_LicenseExpired = 1024, + k_EAppOwnershipFlags_LicensePermanent = 2048, + k_EAppOwnershipFlags_LicenseRecurring = 4096, + k_EAppOwnershipFlags_LicenseCanceled = 8192, + k_EAppOwnershipFlags_AutoGrant = 16384, + k_EAppOwnershipFlags_PendingGift = 32768, +} +public enum EAppType +{ + k_EAppType_Invalid = 0, + k_EAppType_Game = 1, + k_EAppType_Application = 2, + k_EAppType_Tool = 4, + k_EAppType_Demo = 8, + k_EAppType_Media_DEPRECATED = 16, + k_EAppType_DLC = 32, + k_EAppType_Guide = 64, + k_EAppType_Driver = 128, + k_EAppType_Config = 256, + k_EAppType_Hardware = 512, + k_EAppType_Video = 2048, + k_EAppType_Plugin = 4096, + k_EAppType_Music = 8192, + k_EAppType_Shortcut = 1073741824, + k_EAppType_DepotOnly = -2147483648, +} +public enum ESteamUserStatType +{ + k_ESteamUserStatTypeINVALID = 0, + k_ESteamUserStatTypeINT = 1, + k_ESteamUserStatTypeFLOAT = 2, + k_ESteamUserStatTypeAVGRATE = 3, + k_ESteamUserStatTypeACHIEVEMENTS = 4, + k_ESteamUserStatTypeGROUPACHIEVEMENTS = 5, + k_ESteamUserStatTypeMAX = 6, +} +public enum EChatEntryType +{ + k_EChatEntryTypeInvalid = 0, + k_EChatEntryTypeChatMsg = 1, + k_EChatEntryTypeTyping = 2, + k_EChatEntryTypeInviteGame = 3, + k_EChatEntryTypeEmote = 4, + k_EChatEntryTypeLeftConversation = 6, + k_EChatEntryTypeEntered = 7, + k_EChatEntryTypeWasKicked = 8, + k_EChatEntryTypeWasBanned = 9, + k_EChatEntryTypeDisconnected = 10, + k_EChatEntryTypeHistoricalChat = 11, + k_EChatEntryTypeReserved1 = 12, + k_EChatEntryTypeReserved2 = 13, + k_EChatEntryTypeLinkBlocked = 14, +} +public enum EChatRoomEnterResponse +{ + k_EChatRoomEnterResponseSuccess = 1, + k_EChatRoomEnterResponseDoesntExist = 2, + k_EChatRoomEnterResponseNotAllowed = 3, + k_EChatRoomEnterResponseFull = 4, + k_EChatRoomEnterResponseError = 5, + k_EChatRoomEnterResponseBanned = 6, + k_EChatRoomEnterResponseLimited = 7, + k_EChatRoomEnterResponseClanDisabled = 8, + k_EChatRoomEnterResponseCommunityBan = 9, + k_EChatRoomEnterResponseMemberBlockedYou = 10, + k_EChatRoomEnterResponseYouBlockedMember = 11, +} +public enum EChatSteamIDInstanceFlags +{ + k_EChatAccountInstanceMask = 4095, + k_EChatInstanceFlagClan = 524288, + k_EChatInstanceFlagLobby = 262144, + k_EChatInstanceFlagMMSLobby = 131072, +} +public enum EMarketingMessageFlags +{ + k_EMarketingMessageFlagsNone = 0, + k_EMarketingMessageFlagsHighPriority = 1, + k_EMarketingMessageFlagsPlatformWindows = 2, + k_EMarketingMessageFlagsPlatformMac = 4, + k_EMarketingMessageFlagsPlatformLinux = 8, + k_EMarketingMessageFlagsPlatformRestrictions = 14, +} +public enum ENotificationPosition +{ + k_EPositionTopLeft = 0, + k_EPositionTopRight = 1, + k_EPositionBottomLeft = 2, + k_EPositionBottomRight = 3, +} +public enum EBroadcastUploadResult +{ + k_EBroadcastUploadResultNone = 0, + k_EBroadcastUploadResultOK = 1, + k_EBroadcastUploadResultInitFailed = 2, + k_EBroadcastUploadResultFrameFailed = 3, + k_EBroadcastUploadResultTimeout = 4, + k_EBroadcastUploadResultBandwidthExceeded = 5, + k_EBroadcastUploadResultLowFPS = 6, + k_EBroadcastUploadResultMissingKeyFrames = 7, + k_EBroadcastUploadResultNoConnection = 8, + k_EBroadcastUploadResultRelayFailed = 9, + k_EBroadcastUploadResultSettingsChanged = 10, + k_EBroadcastUploadResultMissingAudio = 11, + k_EBroadcastUploadResultTooFarBehind = 12, + k_EBroadcastUploadResultTranscodeBehind = 13, +} +public enum ELaunchOptionType +{ + k_ELaunchOptionType_None = 0, + k_ELaunchOptionType_Default = 1, + k_ELaunchOptionType_SafeMode = 2, + k_ELaunchOptionType_Multiplayer = 3, + k_ELaunchOptionType_Config = 4, + k_ELaunchOptionType_VR = 5, + k_ELaunchOptionType_Server = 6, + k_ELaunchOptionType_Editor = 7, + k_ELaunchOptionType_Manual = 8, + k_ELaunchOptionType_Benchmark = 9, + k_ELaunchOptionType_Option1 = 10, + k_ELaunchOptionType_Option2 = 11, + k_ELaunchOptionType_Option3 = 12, + k_ELaunchOptionType_Dialog = 1000, +} +public enum EFailureType +{ + k_EFailureFlushedCallbackQueue = 0, + k_EFailurePipeFail = 1, +} +public enum EFriendRelationship +{ + k_EFriendRelationshipNone = 0, + k_EFriendRelationshipBlocked = 1, + k_EFriendRelationshipRequestRecipient = 2, + k_EFriendRelationshipFriend = 3, + k_EFriendRelationshipRequestInitiator = 4, + k_EFriendRelationshipIgnored = 5, + k_EFriendRelationshipIgnoredFriend = 6, + k_EFriendRelationshipSuggested = 7, + k_EFriendRelationshipMax = 8, +} +public enum EPersonaState +{ + k_EPersonaStateOffline = 0, + k_EPersonaStateOnline = 1, + k_EPersonaStateBusy = 2, + k_EPersonaStateAway = 3, + k_EPersonaStateSnooze = 4, + k_EPersonaStateLookingToTrade = 5, + k_EPersonaStateLookingToPlay = 6, + k_EPersonaStateMax = 7, +} +public enum EFriendFlags +{ + k_EFriendFlagNone = 0, + k_EFriendFlagBlocked = 1, + k_EFriendFlagFriendshipRequested = 2, + k_EFriendFlagImmediate = 4, + k_EFriendFlagClanMember = 8, + k_EFriendFlagOnGameServer = 16, + k_EFriendFlagRequestingFriendship = 128, + k_EFriendFlagRequestingInfo = 256, + k_EFriendFlagIgnored = 512, + k_EFriendFlagIgnoredFriend = 1024, + k_EFriendFlagSuggested = 2048, + k_EFriendFlagAll = 65535, +} +public enum EUserRestriction +{ + k_nUserRestrictionNone = 0, + k_nUserRestrictionUnknown = 1, + k_nUserRestrictionAnyChat = 2, + k_nUserRestrictionVoiceChat = 4, + k_nUserRestrictionGroupChat = 8, + k_nUserRestrictionRating = 16, + k_nUserRestrictionGameInvites = 32, + k_nUserRestrictionTrading = 64, +} +public enum EOverlayToStoreFlag +{ + k_EOverlayToStoreFlag_None = 0, + k_EOverlayToStoreFlag_AddToCart = 1, + k_EOverlayToStoreFlag_AddToCartAndShow = 2, +} +public enum EPersonaChange +{ + k_EPersonaChangeName = 1, + k_EPersonaChangeStatus = 2, + k_EPersonaChangeComeOnline = 4, + k_EPersonaChangeGoneOffline = 8, + k_EPersonaChangeGamePlayed = 16, + k_EPersonaChangeGameServer = 32, + k_EPersonaChangeAvatar = 64, + k_EPersonaChangeJoinedSource = 128, + k_EPersonaChangeLeftSource = 256, + k_EPersonaChangeRelationshipChanged = 512, + k_EPersonaChangeNameFirstSet = 1024, + k_EPersonaChangeFacebookInfo = 2048, + k_EPersonaChangeNickname = 4096, + k_EPersonaChangeSteamLevel = 8192, +} +public enum ESteamAPICallFailure +{ + k_ESteamAPICallFailureNone = -1, + k_ESteamAPICallFailureSteamGone = 0, + k_ESteamAPICallFailureNetworkFailure = 1, + k_ESteamAPICallFailureInvalidHandle = 2, + k_ESteamAPICallFailureMismatchedCallback = 3, +} +public enum EGamepadTextInputMode +{ + k_EGamepadTextInputModeNormal = 0, + k_EGamepadTextInputModePassword = 1, +} +public enum EGamepadTextInputLineMode +{ + k_EGamepadTextInputLineModeSingleLine = 0, + k_EGamepadTextInputLineModeMultipleLines = 1, +} +public enum ECheckFileSignature +{ + k_ECheckFileSignatureInvalidSignature = 0, + k_ECheckFileSignatureValidSignature = 1, + k_ECheckFileSignatureFileNotFound = 2, + k_ECheckFileSignatureNoSignaturesFoundForThisApp = 3, + k_ECheckFileSignatureNoSignaturesFoundForThisFile = 4, +} +public enum EMatchMakingServerResponse +{ + eServerResponded = 0, + eServerFailedToRespond = 1, + eNoServersListedOnMasterServer = 2, +} +public enum ELobbyType +{ + k_ELobbyTypePrivate = 0, + k_ELobbyTypeFriendsOnly = 1, + k_ELobbyTypePublic = 2, + k_ELobbyTypeInvisible = 3, +} +public enum ELobbyComparison +{ + k_ELobbyComparisonEqualToOrLessThan = -2, + k_ELobbyComparisonLessThan = -1, + k_ELobbyComparisonEqual = 0, + k_ELobbyComparisonGreaterThan = 1, + k_ELobbyComparisonEqualToOrGreaterThan = 2, + k_ELobbyComparisonNotEqual = 3, +} +public enum ELobbyDistanceFilter +{ + k_ELobbyDistanceFilterClose = 0, + k_ELobbyDistanceFilterDefault = 1, + k_ELobbyDistanceFilterFar = 2, + k_ELobbyDistanceFilterWorldwide = 3, +} +public enum EChatMemberStateChange +{ + k_EChatMemberStateChangeEntered = 1, + k_EChatMemberStateChangeLeft = 2, + k_EChatMemberStateChangeDisconnected = 4, + k_EChatMemberStateChangeKicked = 8, + k_EChatMemberStateChangeBanned = 16, +} +public enum EResolveConflict +{ + k_EResolveConflictKeepClient = 1, + k_EResolveConflictKeepServer = 2, +} +public enum ERemoteStoragePlatform +{ + k_ERemoteStoragePlatformNone = 0, + k_ERemoteStoragePlatformWindows = 1, + k_ERemoteStoragePlatformOSX = 2, + k_ERemoteStoragePlatformPS3 = 4, + k_ERemoteStoragePlatformLinux = 8, + k_ERemoteStoragePlatformReserved2 = 16, + k_ERemoteStoragePlatformAll = -1, +} +public enum ERemoteStoragePublishedFileVisibility +{ + k_ERemoteStoragePublishedFileVisibilityPublic = 0, + k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1, + k_ERemoteStoragePublishedFileVisibilityPrivate = 2, +} +public enum EWorkshopFileType +{ + k_EWorkshopFileTypeFirst = 0, + k_EWorkshopFileTypeCommunity = 0, + k_EWorkshopFileTypeMicrotransaction = 1, + k_EWorkshopFileTypeCollection = 2, + k_EWorkshopFileTypeArt = 3, + k_EWorkshopFileTypeVideo = 4, + k_EWorkshopFileTypeScreenshot = 5, + k_EWorkshopFileTypeGame = 6, + k_EWorkshopFileTypeSoftware = 7, + k_EWorkshopFileTypeConcept = 8, + k_EWorkshopFileTypeWebGuide = 9, + k_EWorkshopFileTypeIntegratedGuide = 10, + k_EWorkshopFileTypeMerch = 11, + k_EWorkshopFileTypeControllerBinding = 12, + k_EWorkshopFileTypeSteamworksAccessInvite = 13, + k_EWorkshopFileTypeSteamVideo = 14, + k_EWorkshopFileTypeGameManagedItem = 15, + k_EWorkshopFileTypeMax = 16, +} +public enum EWorkshopVote +{ + k_EWorkshopVoteUnvoted = 0, + k_EWorkshopVoteFor = 1, + k_EWorkshopVoteAgainst = 2, + k_EWorkshopVoteLater = 3, +} +public enum EWorkshopFileAction +{ + k_EWorkshopFileActionPlayed = 0, + k_EWorkshopFileActionCompleted = 1, +} +public enum EWorkshopEnumerationType +{ + k_EWorkshopEnumerationTypeRankedByVote = 0, + k_EWorkshopEnumerationTypeRecent = 1, + k_EWorkshopEnumerationTypeTrending = 2, + k_EWorkshopEnumerationTypeFavoritesOfFriends = 3, + k_EWorkshopEnumerationTypeVotedByFriends = 4, + k_EWorkshopEnumerationTypeContentByFriends = 5, + k_EWorkshopEnumerationTypeRecentFromFollowedUsers = 6, +} +public enum EWorkshopVideoProvider +{ + k_EWorkshopVideoProviderNone = 0, + k_EWorkshopVideoProviderYoutube = 1, +} +public enum EUGCReadAction +{ + k_EUGCRead_ContinueReadingUntilFinished = 0, + k_EUGCRead_ContinueReading = 1, + k_EUGCRead_Close = 2, +} +public enum ELeaderboardDataRequest +{ + k_ELeaderboardDataRequestGlobal = 0, + k_ELeaderboardDataRequestGlobalAroundUser = 1, + k_ELeaderboardDataRequestFriends = 2, + k_ELeaderboardDataRequestUsers = 3, +} +public enum ELeaderboardSortMethod +{ + k_ELeaderboardSortMethodNone = 0, + k_ELeaderboardSortMethodAscending = 1, + k_ELeaderboardSortMethodDescending = 2, +} +public enum ELeaderboardDisplayType +{ + k_ELeaderboardDisplayTypeNone = 0, + k_ELeaderboardDisplayTypeNumeric = 1, + k_ELeaderboardDisplayTypeTimeSeconds = 2, + k_ELeaderboardDisplayTypeTimeMilliSeconds = 3, +} +public enum ELeaderboardUploadScoreMethod +{ + k_ELeaderboardUploadScoreMethodNone = 0, + k_ELeaderboardUploadScoreMethodKeepBest = 1, + k_ELeaderboardUploadScoreMethodForceUpdate = 2, +} +public enum ERegisterActivationCodeResult +{ + k_ERegisterActivationCodeResultOK = 0, + k_ERegisterActivationCodeResultFail = 1, + k_ERegisterActivationCodeResultAlreadyRegistered = 2, + k_ERegisterActivationCodeResultTimeout = 3, + k_ERegisterActivationCodeAlreadyOwned = 4, +} +public enum EP2PSessionError +{ + k_EP2PSessionErrorNone = 0, + k_EP2PSessionErrorNotRunningApp = 1, + k_EP2PSessionErrorNoRightsToApp = 2, + k_EP2PSessionErrorDestinationNotLoggedIn = 3, + k_EP2PSessionErrorTimeout = 4, + k_EP2PSessionErrorMax = 5, +} +public enum EP2PSend +{ + k_EP2PSendUnreliable = 0, + k_EP2PSendUnreliableNoDelay = 1, + k_EP2PSendReliable = 2, + k_EP2PSendReliableWithBuffering = 3, +} +public enum ESNetSocketState +{ + k_ESNetSocketStateInvalid = 0, + k_ESNetSocketStateConnected = 1, + k_ESNetSocketStateInitiated = 10, + k_ESNetSocketStateLocalCandidatesFound = 11, + k_ESNetSocketStateReceivedRemoteCandidates = 12, + k_ESNetSocketStateChallengeHandshake = 15, + k_ESNetSocketStateDisconnecting = 21, + k_ESNetSocketStateLocalDisconnect = 22, + k_ESNetSocketStateTimeoutDuringConnect = 23, + k_ESNetSocketStateRemoteEndDisconnected = 24, + k_ESNetSocketStateConnectionBroken = 25, +} +public enum ESNetSocketConnectionType +{ + k_ESNetSocketConnectionTypeNotConnected = 0, + k_ESNetSocketConnectionTypeUDP = 1, + k_ESNetSocketConnectionTypeUDPRelay = 2, +} +public enum AudioPlayback_Status +{ + AudioPlayback_Undefined = 0, + AudioPlayback_Playing = 1, + AudioPlayback_Paused = 2, + AudioPlayback_Idle = 3, +} +public enum EHTTPMethod +{ + k_EHTTPMethodInvalid = 0, + k_EHTTPMethodGET = 1, + k_EHTTPMethodHEAD = 2, + k_EHTTPMethodPOST = 3, + k_EHTTPMethodPUT = 4, + k_EHTTPMethodDELETE = 5, + k_EHTTPMethodOPTIONS = 6, +} +public enum EHTTPStatusCode +{ + k_EHTTPStatusCodeInvalid = 0, + k_EHTTPStatusCode100Continue = 100, + k_EHTTPStatusCode101SwitchingProtocols = 101, + k_EHTTPStatusCode200OK = 200, + k_EHTTPStatusCode201Created = 201, + k_EHTTPStatusCode202Accepted = 202, + k_EHTTPStatusCode203NonAuthoritative = 203, + k_EHTTPStatusCode204NoContent = 204, + k_EHTTPStatusCode205ResetContent = 205, + k_EHTTPStatusCode206PartialContent = 206, + k_EHTTPStatusCode300MultipleChoices = 300, + k_EHTTPStatusCode301MovedPermanently = 301, + k_EHTTPStatusCode302Found = 302, + k_EHTTPStatusCode303SeeOther = 303, + k_EHTTPStatusCode304NotModified = 304, + k_EHTTPStatusCode305UseProxy = 305, + k_EHTTPStatusCode307TemporaryRedirect = 307, + k_EHTTPStatusCode400BadRequest = 400, + k_EHTTPStatusCode401Unauthorized = 401, + k_EHTTPStatusCode402PaymentRequired = 402, + k_EHTTPStatusCode403Forbidden = 403, + k_EHTTPStatusCode404NotFound = 404, + k_EHTTPStatusCode405MethodNotAllowed = 405, + k_EHTTPStatusCode406NotAcceptable = 406, + k_EHTTPStatusCode407ProxyAuthRequired = 407, + k_EHTTPStatusCode408RequestTimeout = 408, + k_EHTTPStatusCode409Conflict = 409, + k_EHTTPStatusCode410Gone = 410, + k_EHTTPStatusCode411LengthRequired = 411, + k_EHTTPStatusCode412PreconditionFailed = 412, + k_EHTTPStatusCode413RequestEntityTooLarge = 413, + k_EHTTPStatusCode414RequestURITooLong = 414, + k_EHTTPStatusCode415UnsupportedMediaType = 415, + k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416, + k_EHTTPStatusCode417ExpectationFailed = 417, + k_EHTTPStatusCode4xxUnknown = 418, + k_EHTTPStatusCode429TooManyRequests = 429, + k_EHTTPStatusCode500InternalServerError = 500, + k_EHTTPStatusCode501NotImplemented = 501, + k_EHTTPStatusCode502BadGateway = 502, + k_EHTTPStatusCode503ServiceUnavailable = 503, + k_EHTTPStatusCode504GatewayTimeout = 504, + k_EHTTPStatusCode505HTTPVersionNotSupported = 505, + k_EHTTPStatusCode5xxUnknown = 599, +} +public enum ESteamControllerPad +{ + k_ESteamControllerPad_Left = 0, + k_ESteamControllerPad_Right = 1, +} +public enum EControllerSource +{ + k_EControllerSource_None = 0, + k_EControllerSource_LeftTrackpad = 1, + k_EControllerSource_RightTrackpad = 2, + k_EControllerSource_Joystick = 3, + k_EControllerSource_ABXY = 4, + k_EControllerSource_Switch = 5, + k_EControllerSource_LeftTrigger = 6, + k_EControllerSource_RightTrigger = 7, + k_EControllerSource_Gyro = 8, +} +public enum EControllerSourceMode +{ + k_EControllerSourceMode_None = 0, + k_EControllerSourceMode_Dpad = 1, + k_EControllerSourceMode_Buttons = 2, + k_EControllerSourceMode_FourButtons = 3, + k_EControllerSourceMode_AbsoluteMouse = 4, + k_EControllerSourceMode_RelativeMouse = 5, + k_EControllerSourceMode_JoystickMove = 6, + k_EControllerSourceMode_JoystickCamera = 7, + k_EControllerSourceMode_ScrollWheel = 8, + k_EControllerSourceMode_Trigger = 9, + k_EControllerSourceMode_TouchMenu = 10, +} +public enum EControllerActionOrigin +{ + k_EControllerActionOrigin_None = 0, + k_EControllerActionOrigin_A = 1, + k_EControllerActionOrigin_B = 2, + k_EControllerActionOrigin_X = 3, + k_EControllerActionOrigin_Y = 4, + k_EControllerActionOrigin_LeftBumper = 5, + k_EControllerActionOrigin_RightBumper = 6, + k_EControllerActionOrigin_LeftGrip = 7, + k_EControllerActionOrigin_RightGrip = 8, + k_EControllerActionOrigin_Start = 9, + k_EControllerActionOrigin_Back = 10, + k_EControllerActionOrigin_LeftPad_Touch = 11, + k_EControllerActionOrigin_LeftPad_Swipe = 12, + k_EControllerActionOrigin_LeftPad_Click = 13, + k_EControllerActionOrigin_LeftPad_DPadNorth = 14, + k_EControllerActionOrigin_LeftPad_DPadSouth = 15, + k_EControllerActionOrigin_LeftPad_DPadWest = 16, + k_EControllerActionOrigin_LeftPad_DPadEast = 17, + k_EControllerActionOrigin_RightPad_Touch = 18, + k_EControllerActionOrigin_RightPad_Swipe = 19, + k_EControllerActionOrigin_RightPad_Click = 20, + k_EControllerActionOrigin_RightPad_DPadNorth = 21, + k_EControllerActionOrigin_RightPad_DPadSouth = 22, + k_EControllerActionOrigin_RightPad_DPadWest = 23, + k_EControllerActionOrigin_RightPad_DPadEast = 24, + k_EControllerActionOrigin_LeftTrigger_Pull = 25, + k_EControllerActionOrigin_LeftTrigger_Click = 26, + k_EControllerActionOrigin_RightTrigger_Pull = 27, + k_EControllerActionOrigin_RightTrigger_Click = 28, + k_EControllerActionOrigin_LeftStick_Move = 29, + k_EControllerActionOrigin_LeftStick_Click = 30, + k_EControllerActionOrigin_LeftStick_DPadNorth = 31, + k_EControllerActionOrigin_LeftStick_DPadSouth = 32, + k_EControllerActionOrigin_LeftStick_DPadWest = 33, + k_EControllerActionOrigin_LeftStick_DPadEast = 34, + k_EControllerActionOrigin_Gyro_Move = 35, + k_EControllerActionOrigin_Gyro_Pitch = 36, + k_EControllerActionOrigin_Gyro_Yaw = 37, + k_EControllerActionOrigin_Gyro_Roll = 38, + k_EControllerActionOrigin_Count = 39, +} +public enum EUGCMatchingUGCType +{ + k_EUGCMatchingUGCType_Items = 0, + k_EUGCMatchingUGCType_Items_Mtx = 1, + k_EUGCMatchingUGCType_Items_ReadyToUse = 2, + k_EUGCMatchingUGCType_Collections = 3, + k_EUGCMatchingUGCType_Artwork = 4, + k_EUGCMatchingUGCType_Videos = 5, + k_EUGCMatchingUGCType_Screenshots = 6, + k_EUGCMatchingUGCType_AllGuides = 7, + k_EUGCMatchingUGCType_WebGuides = 8, + k_EUGCMatchingUGCType_IntegratedGuides = 9, + k_EUGCMatchingUGCType_UsableInGame = 10, + k_EUGCMatchingUGCType_ControllerBindings = 11, + k_EUGCMatchingUGCType_GameManagedItems = 12, + k_EUGCMatchingUGCType_All = -1, +} +public enum EUserUGCList +{ + k_EUserUGCList_Published = 0, + k_EUserUGCList_VotedOn = 1, + k_EUserUGCList_VotedUp = 2, + k_EUserUGCList_VotedDown = 3, + k_EUserUGCList_WillVoteLater = 4, + k_EUserUGCList_Favorited = 5, + k_EUserUGCList_Subscribed = 6, + k_EUserUGCList_UsedOrPlayed = 7, + k_EUserUGCList_Followed = 8, +} +public enum EUserUGCListSortOrder +{ + k_EUserUGCListSortOrder_CreationOrderDesc = 0, + k_EUserUGCListSortOrder_CreationOrderAsc = 1, + k_EUserUGCListSortOrder_TitleAsc = 2, + k_EUserUGCListSortOrder_LastUpdatedDesc = 3, + k_EUserUGCListSortOrder_SubscriptionDateDesc = 4, + k_EUserUGCListSortOrder_VoteScoreDesc = 5, + k_EUserUGCListSortOrder_ForModeration = 6, +} +public enum EUGCQuery +{ + k_EUGCQuery_RankedByVote = 0, + k_EUGCQuery_RankedByPublicationDate = 1, + k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate = 2, + k_EUGCQuery_RankedByTrend = 3, + k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate = 4, + k_EUGCQuery_CreatedByFriendsRankedByPublicationDate = 5, + k_EUGCQuery_RankedByNumTimesReported = 6, + k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate = 7, + k_EUGCQuery_NotYetRated = 8, + k_EUGCQuery_RankedByTotalVotesAsc = 9, + k_EUGCQuery_RankedByVotesUp = 10, + k_EUGCQuery_RankedByTextSearch = 11, + k_EUGCQuery_RankedByTotalUniqueSubscriptions = 12, +} +public enum EItemUpdateStatus +{ + k_EItemUpdateStatusInvalid = 0, + k_EItemUpdateStatusPreparingConfig = 1, + k_EItemUpdateStatusPreparingContent = 2, + k_EItemUpdateStatusUploadingContent = 3, + k_EItemUpdateStatusUploadingPreviewFile = 4, + k_EItemUpdateStatusCommittingChanges = 5, +} +public enum EItemState +{ + k_EItemStateNone = 0, + k_EItemStateSubscribed = 1, + k_EItemStateLegacyItem = 2, + k_EItemStateInstalled = 4, + k_EItemStateNeedsUpdate = 8, + k_EItemStateDownloading = 16, + k_EItemStateDownloadPending = 32, +} +public enum EItemStatistic +{ + k_EItemStatistic_NumSubscriptions = 0, + k_EItemStatistic_NumFavorites = 1, + k_EItemStatistic_NumFollowers = 2, + k_EItemStatistic_NumUniqueSubscriptions = 3, + k_EItemStatistic_NumUniqueFavorites = 4, + k_EItemStatistic_NumUniqueFollowers = 5, + k_EItemStatistic_NumUniqueWebsiteViews = 6, + k_EItemStatistic_ReportScore = 7, +} +public enum EHTMLMouseButton +{ + eHTMLMouseButton_Left = 0, + eHTMLMouseButton_Right = 1, + eHTMLMouseButton_Middle = 2, +} +public enum EMouseCursor +{ + dc_user = 0, + dc_none = 1, + dc_arrow = 2, + dc_ibeam = 3, + dc_hourglass = 4, + dc_waitarrow = 5, + dc_crosshair = 6, + dc_up = 7, + dc_sizenw = 8, + dc_sizese = 9, + dc_sizene = 10, + dc_sizesw = 11, + dc_sizew = 12, + dc_sizee = 13, + dc_sizen = 14, + dc_sizes = 15, + dc_sizewe = 16, + dc_sizens = 17, + dc_sizeall = 18, + dc_no = 19, + dc_hand = 20, + dc_blank = 21, + dc_middle_pan = 22, + dc_north_pan = 23, + dc_north_east_pan = 24, + dc_east_pan = 25, + dc_south_east_pan = 26, + dc_south_pan = 27, + dc_south_west_pan = 28, + dc_west_pan = 29, + dc_north_west_pan = 30, + dc_alias = 31, + dc_cell = 32, + dc_colresize = 33, + dc_copycur = 34, + dc_verticaltext = 35, + dc_rowresize = 36, + dc_zoomin = 37, + dc_zoomout = 38, + dc_help = 39, + dc_custom = 40, + dc_last = 41, +} +public enum EHTMLKeyModifiers +{ + k_eHTMLKeyModifier_None = 0, + k_eHTMLKeyModifier_AltDown = 1, + k_eHTMLKeyModifier_CtrlDown = 2, + k_eHTMLKeyModifier_ShiftDown = 4, +} +public enum ESteamItemFlags +{ + k_ESteamItemNoTrade = 1, + k_ESteamItemRemoved = 256, + k_ESteamItemConsumed = 512, +} +[StructLayout(LayoutKind.Sequential)] public struct CSteamID +{ + public SteamID_t m_steamid; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamID_t +{ + public SteamIDComponent_t m_comp; + public ulong m_unAll64Bits; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamIDComponent_t +{ + public uint m_unAccountID; + public uint m_unAccountInstance; + public uint m_EAccountType; + public EUniverse m_EUniverse; +} +[StructLayout(LayoutKind.Sequential)] public struct GameID_t +{ + public uint m_nAppID; + public uint m_nType; + public uint m_nModID; +} +[StructLayout(LayoutKind.Sequential)] public struct ValvePackingSentinel_t +{ + public uint m_u32; + public ulong m_u64; + public char m_u16; + public double m_d; +} +[StructLayout(LayoutKind.Sequential)] public struct CallbackMsg_t +{ + public uint m_hSteamUser; + public int m_iCallback; + public IntPtr m_pubParam; + public int m_cubParam; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamServerConnectFailure_t +{ + public EResult m_eResult; + public bool m_bStillRetrying; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamServersDisconnected_t +{ + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct ClientGameServerDeny_t +{ + public uint m_uAppID; + public uint m_unGameServerIP; + public char m_usGameServerPort; + public char m_bSecure; + public uint m_uReason; +} +[StructLayout(LayoutKind.Sequential)] public struct ValidateAuthTicketResponse_t +{ + public ulong m_SteamID; + public EAuthSessionResponse m_eAuthSessionResponse; + public ulong m_OwnerSteamID; +} +[StructLayout(LayoutKind.Sequential)] public struct MicroTxnAuthorizationResponse_t +{ + public uint m_unAppID; + public ulong m_ulOrderID; + public byte m_bAuthorized; +} +[StructLayout(LayoutKind.Sequential)] public struct EncryptedAppTicketResponse_t +{ + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct GetAuthSessionTicketResponse_t +{ + public uint m_hAuthTicket; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct GameWebCallback_t +{ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public char[] m_szURL; //char[256] +} +[StructLayout(LayoutKind.Sequential)] public struct StoreAuthURLResponse_t +{ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512, ArraySubType = UnmanagedType.I1)] + public char[] m_szURL; //char[512] +} +[StructLayout(LayoutKind.Sequential)] public struct FriendGameInfo_t +{ + public ulong m_gameID; + public uint m_unGameIP; + public char m_usGamePort; + public char m_usQueryPort; + public ulong m_steamIDLobby; +} +[StructLayout(LayoutKind.Sequential)] public struct FriendSessionStateInfo_t +{ + public uint m_uiOnlineSessionInstances; + public byte m_uiPublishedToFriendsSessionInstance; +} +[StructLayout(LayoutKind.Sequential)] public struct PersonaStateChange_t +{ + public ulong m_ulSteamID; + public int m_nChangeFlags; +} +[StructLayout(LayoutKind.Sequential)] public struct GameOverlayActivated_t +{ + public byte m_bActive; +} +[StructLayout(LayoutKind.Sequential)] public struct GameServerChangeRequested_t +{ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchServer; //char[64] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchPassword; //char[64] +} +[StructLayout(LayoutKind.Sequential)] public struct GameLobbyJoinRequested_t +{ + public ulong m_steamIDLobby; + public ulong m_steamIDFriend; +} +[StructLayout(LayoutKind.Sequential)] public struct AvatarImageLoaded_t +{ + public ulong m_steamID; + public int m_iImage; + public int m_iWide; + public int m_iTall; +} +[StructLayout(LayoutKind.Sequential)] public struct ClanOfficerListResponse_t +{ + public ulong m_steamIDClan; + public int m_cOfficers; + public byte m_bSuccess; +} +[StructLayout(LayoutKind.Sequential)] public struct FriendRichPresenceUpdate_t +{ + public ulong m_steamIDFriend; + public uint m_nAppID; +} +[StructLayout(LayoutKind.Sequential)] public struct GameRichPresenceJoinRequested_t +{ + public ulong m_steamIDFriend; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchConnect; //char[256] +} +[StructLayout(LayoutKind.Sequential)] public struct GameConnectedClanChatMsg_t +{ + public ulong m_steamIDClanChat; + public ulong m_steamIDUser; + public int m_iMessageID; +} +[StructLayout(LayoutKind.Sequential)] public struct GameConnectedChatJoin_t +{ + public ulong m_steamIDClanChat; + public ulong m_steamIDUser; +} +[StructLayout(LayoutKind.Sequential)] public struct GameConnectedChatLeave_t +{ + public ulong m_steamIDClanChat; + public ulong m_steamIDUser; + public bool m_bKicked; + public bool m_bDropped; +} +[StructLayout(LayoutKind.Sequential)] public struct DownloadClanActivityCountsResult_t +{ + public bool m_bSuccess; +} +[StructLayout(LayoutKind.Sequential)] public struct JoinClanChatRoomCompletionResult_t +{ + public ulong m_steamIDClanChat; + public EChatRoomEnterResponse m_eChatRoomEnterResponse; +} +[StructLayout(LayoutKind.Sequential)] public struct GameConnectedFriendChatMsg_t +{ + public ulong m_steamIDUser; + public int m_iMessageID; +} +[StructLayout(LayoutKind.Sequential)] public struct FriendsGetFollowerCount_t +{ + public EResult m_eResult; + public ulong m_steamID; + public int m_nCount; +} +[StructLayout(LayoutKind.Sequential)] public struct FriendsIsFollowing_t +{ + public EResult m_eResult; + public ulong m_steamID; + public bool m_bIsFollowing; +} +[StructLayout(LayoutKind.Sequential)] public struct FriendsEnumerateFollowingList_t +{ + public EResult m_eResult; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] + public CSteamID[] m_rgSteamID; //CSteamID[50] + public int m_nResultsReturned; + public int m_nTotalResultCount; +} +[StructLayout(LayoutKind.Sequential)] public struct SetPersonaNameResponse_t +{ + public bool m_bSuccess; + public bool m_bLocalSuccess; + public EResult m_result; +} +[StructLayout(LayoutKind.Sequential)] public struct LowBatteryPower_t +{ + public byte m_nMinutesBatteryLeft; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamAPICallCompleted_t +{ + public ulong m_hAsyncCall; +} +[StructLayout(LayoutKind.Sequential)] public struct CheckFileSignature_t +{ + public ECheckFileSignature m_eCheckFileSignature; +} +[StructLayout(LayoutKind.Sequential)] public struct GamepadTextInputDismissed_t +{ + public bool m_bSubmitted; + public uint m_unSubmittedText; +} +[StructLayout(LayoutKind.Sequential)] public struct MatchMakingKeyValuePair_t +{ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public char[] m_szKey; //char[256] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public char[] m_szValue; //char[256] +} +[StructLayout(LayoutKind.Sequential)] public struct servernetadr_t +{ + public char m_usConnectionPort; + public char m_usQueryPort; + public uint m_unIP; +} +[StructLayout(LayoutKind.Sequential)] public struct gameserveritem_t +{ + public servernetadr_t m_NetAdr; + public int m_nPing; + public bool m_bHadSuccessfulResponse; + public bool m_bDoNotRefresh; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public char[] m_szGameDir; //char[32] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public char[] m_szMap; //char[32] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public char[] m_szGameDescription; //char[64] + public uint m_nAppID; + public int m_nPlayers; + public int m_nMaxPlayers; + public int m_nBotPlayers; + public bool m_bPassword; + public bool m_bSecure; + public uint m_ulTimeLastPlayed; + public int m_nServerVersion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public char[] m_szServerName; //char[64] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public char[] m_szGameTags; //char[128] + public ulong m_steamID; +} +[StructLayout(LayoutKind.Sequential)] public struct FavoritesListChanged_t +{ + public uint m_nIP; + public uint m_nQueryPort; + public uint m_nConnPort; + public uint m_nAppID; + public uint m_nFlags; + public bool m_bAdd; + public uint m_unAccountId; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyInvite_t +{ + public ulong m_ulSteamIDUser; + public ulong m_ulSteamIDLobby; + public ulong m_ulGameID; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyEnter_t +{ + public ulong m_ulSteamIDLobby; + public uint m_rgfChatPermissions; + public bool m_bLocked; + public uint m_EChatRoomEnterResponse; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyDataUpdate_t +{ + public ulong m_ulSteamIDLobby; + public ulong m_ulSteamIDMember; + public byte m_bSuccess; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyChatUpdate_t +{ + public ulong m_ulSteamIDLobby; + public ulong m_ulSteamIDUserChanged; + public ulong m_ulSteamIDMakingChange; + public uint m_rgfChatMemberStateChange; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyChatMsg_t +{ + public ulong m_ulSteamIDLobby; + public ulong m_ulSteamIDUser; + public byte m_eChatEntryType; + public uint m_iChatID; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyGameCreated_t +{ + public ulong m_ulSteamIDLobby; + public ulong m_ulSteamIDGameServer; + public uint m_unIP; + public char m_usPort; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyMatchList_t +{ + public uint m_nLobbiesMatching; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyKicked_t +{ + public ulong m_ulSteamIDLobby; + public ulong m_ulSteamIDAdmin; + public byte m_bKickedDueToDisconnect; +} +[StructLayout(LayoutKind.Sequential)] public struct LobbyCreated_t +{ + public EResult m_eResult; + public ulong m_ulSteamIDLobby; +} +[StructLayout(LayoutKind.Sequential)] public struct PSNGameBootInviteResult_t +{ + public bool m_bGameBootInviteExists; + public ulong m_steamIDLobby; +} +[StructLayout(LayoutKind.Sequential)] public struct FavoritesListAccountsUpdated_t +{ + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamParamStringArray_t +{ + public string m_ppStrings; + public int m_nNumStrings; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageAppSyncedClient_t +{ + public uint m_nAppID; + public EResult m_eResult; + public int m_unNumDownloads; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageAppSyncedServer_t +{ + public uint m_nAppID; + public EResult m_eResult; + public int m_unNumUploads; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageAppSyncProgress_t +{ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchCurrentFile; //char[260] + public uint m_nAppID; + public uint m_uBytesTransferredThisChunk; + public double m_dAppPercentComplete; + public bool m_bUploading; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageAppSyncStatusCheck_t +{ + public uint m_nAppID; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageConflictResolution_t +{ + public uint m_nAppID; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageFileShareResult_t +{ + public EResult m_eResult; + public ulong m_hFile; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchFilename; //char[260] +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStoragePublishFileResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; + public bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageDeletePublishedFileResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageEnumerateUserPublishedFilesResult_t +{ + public EResult m_eResult; + public int m_nResultsReturned; + public int m_nTotalResultCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] + public ulong[] m_rgPublishedFileId; //ulong[50] +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageSubscribePublishedFileResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageEnumerateUserSubscribedFilesResult_t +{ + public EResult m_eResult; + public int m_nResultsReturned; + public int m_nTotalResultCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] + public ulong[] m_rgPublishedFileId; //ulong[50] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U4)] + public uint[] m_rgRTimeSubscribed; //uint[50] +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageUnsubscribePublishedFileResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageUpdatePublishedFileResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; + public bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageDownloadUGCResult_t +{ + public EResult m_eResult; + public ulong m_hFile; + public uint m_nAppID; + public int m_nSizeInBytes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260, ArraySubType = UnmanagedType.I1)] + public char[] m_pchFileName; //char[260] + public ulong m_ulSteamIDOwner; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageGetPublishedFileDetailsResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; + public uint m_nCreatorAppID; + public uint m_nConsumerAppID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 129, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchTitle; //char[129] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8000, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchDescription; //char[8000] + public ulong m_hFile; + public ulong m_hPreviewFile; + public ulong m_ulSteamIDOwner; + public uint m_rtimeCreated; + public uint m_rtimeUpdated; + public ERemoteStoragePublishedFileVisibility m_eVisibility; + public bool m_bBanned; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1025, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchTags; //char[1025] + public bool m_bTagsTruncated; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260, ArraySubType = UnmanagedType.I1)] + public char[] m_pchFileName; //char[260] + public int m_nFileSize; + public int m_nPreviewFileSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchURL; //char[256] + public EWorkshopFileType m_eFileType; + public bool m_bAcceptedForUse; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageEnumerateWorkshopFilesResult_t +{ + public EResult m_eResult; + public int m_nResultsReturned; + public int m_nTotalResultCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] + public ulong[] m_rgPublishedFileId; //ulong[50] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.R4)] + public float[] m_rgScore; //float[50] + public uint m_nAppId; + public uint m_unStartIndex; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageGetPublishedItemVoteDetailsResult_t +{ + public EResult m_eResult; + public ulong m_unPublishedFileId; + public int m_nVotesFor; + public int m_nVotesAgainst; + public int m_nReports; + public float m_fScore; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStoragePublishedFileSubscribed_t +{ + public ulong m_nPublishedFileId; + public uint m_nAppID; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStoragePublishedFileUnsubscribed_t +{ + public ulong m_nPublishedFileId; + public uint m_nAppID; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStoragePublishedFileDeleted_t +{ + public ulong m_nPublishedFileId; + public uint m_nAppID; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageUpdateUserPublishedItemVoteResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageUserVoteDetails_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; + public EWorkshopVote m_eVote; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t +{ + public EResult m_eResult; + public int m_nResultsReturned; + public int m_nTotalResultCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] + public ulong[] m_rgPublishedFileId; //ulong[50] +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageSetUserPublishedFileActionResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; + public EWorkshopFileAction m_eAction; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t +{ + public EResult m_eResult; + public EWorkshopFileAction m_eAction; + public int m_nResultsReturned; + public int m_nTotalResultCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] + public ulong[] m_rgPublishedFileId; //ulong[50] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U4)] + public uint[] m_rgRTimeUpdated; //uint[50] +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStoragePublishFileProgress_t +{ + public double m_dPercentFile; + public bool m_bPreview; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStoragePublishedFileUpdated_t +{ + public ulong m_nPublishedFileId; + public uint m_nAppID; + public ulong m_hFile; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageFileWriteAsyncComplete_t +{ + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageFileReadAsyncComplete_t +{ + public ulong m_hFileReadAsync; + public EResult m_eResult; + public uint m_nOffset; + public uint m_cubRead; +} +[StructLayout(LayoutKind.Sequential)] public struct LeaderboardEntry_t +{ + public ulong m_steamIDUser; + public int m_nGlobalRank; + public int m_nScore; + public int m_cDetails; + public ulong m_hUGC; +} +[StructLayout(LayoutKind.Sequential)] public struct UserStatsReceived_t +{ + public ulong m_nGameID; + public EResult m_eResult; + public ulong m_steamIDUser; +} +[StructLayout(LayoutKind.Sequential)] public struct UserStatsStored_t +{ + public ulong m_nGameID; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct UserAchievementStored_t +{ + public ulong m_nGameID; + public bool m_bGroupAchievement; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchAchievementName; //char[128] + public uint m_nCurProgress; + public uint m_nMaxProgress; +} +[StructLayout(LayoutKind.Sequential)] public struct LeaderboardFindResult_t +{ + public ulong m_hSteamLeaderboard; + public byte m_bLeaderboardFound; +} +[StructLayout(LayoutKind.Sequential)] public struct LeaderboardScoresDownloaded_t +{ + public ulong m_hSteamLeaderboard; + public ulong m_hSteamLeaderboardEntries; + public int m_cEntryCount; +} +[StructLayout(LayoutKind.Sequential)] public struct LeaderboardScoreUploaded_t +{ + public byte m_bSuccess; + public ulong m_hSteamLeaderboard; + public int m_nScore; + public byte m_bScoreChanged; + public int m_nGlobalRankNew; + public int m_nGlobalRankPrevious; +} +[StructLayout(LayoutKind.Sequential)] public struct NumberOfCurrentPlayers_t +{ + public byte m_bSuccess; + public int m_cPlayers; +} +[StructLayout(LayoutKind.Sequential)] public struct UserStatsUnloaded_t +{ + public ulong m_steamIDUser; +} +[StructLayout(LayoutKind.Sequential)] public struct UserAchievementIconFetched_t +{ + public ulong m_nGameID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchAchievementName; //char[128] + public bool m_bAchieved; + public int m_nIconHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct GlobalAchievementPercentagesReady_t +{ + public ulong m_nGameID; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct LeaderboardUGCSet_t +{ + public EResult m_eResult; + public ulong m_hSteamLeaderboard; +} +[StructLayout(LayoutKind.Sequential)] public struct PS3TrophiesInstalled_t +{ + public ulong m_nGameID; + public EResult m_eResult; + public ulong m_ulRequiredDiskSpace; +} +[StructLayout(LayoutKind.Sequential)] public struct GlobalStatsReceived_t +{ + public ulong m_nGameID; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct DlcInstalled_t +{ + public uint m_nAppID; +} +[StructLayout(LayoutKind.Sequential)] public struct RegisterActivationCodeResponse_t +{ + public ERegisterActivationCodeResult m_eResult; + public uint m_unPackageRegistered; +} +[StructLayout(LayoutKind.Sequential)] public struct AppProofOfPurchaseKeyResponse_t +{ + public EResult m_eResult; + public uint m_nAppID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchKey; //char[64] +} +[StructLayout(LayoutKind.Sequential)] public struct P2PSessionState_t +{ + public byte m_bConnectionActive; + public byte m_bConnecting; + public byte m_eP2PSessionError; + public byte m_bUsingRelay; + public int m_nBytesQueuedForSend; + public int m_nPacketsQueuedForSend; + public uint m_nRemoteIP; + public char m_nRemotePort; +} +[StructLayout(LayoutKind.Sequential)] public struct P2PSessionRequest_t +{ + public ulong m_steamIDRemote; +} +[StructLayout(LayoutKind.Sequential)] public struct P2PSessionConnectFail_t +{ + public ulong m_steamIDRemote; + public byte m_eP2PSessionError; +} +[StructLayout(LayoutKind.Sequential)] public struct SocketStatusCallback_t +{ + public uint m_hSocket; + public uint m_hListenSocket; + public ulong m_steamIDRemote; + public int m_eSNetSocketState; +} +[StructLayout(LayoutKind.Sequential)] public struct ScreenshotReady_t +{ + public uint m_hLocal; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct VolumeHasChanged_t +{ + public float m_flNewVolume; +} +[StructLayout(LayoutKind.Sequential)] public struct MusicPlayerWantsShuffled_t +{ + public bool m_bShuffled; +} +[StructLayout(LayoutKind.Sequential)] public struct MusicPlayerWantsLooped_t +{ + public bool m_bLooped; +} +[StructLayout(LayoutKind.Sequential)] public struct MusicPlayerWantsVolume_t +{ + public float m_flNewVolume; +} +[StructLayout(LayoutKind.Sequential)] public struct MusicPlayerSelectsQueueEntry_t +{ + public int nID; +} +[StructLayout(LayoutKind.Sequential)] public struct MusicPlayerSelectsPlaylistEntry_t +{ + public int nID; +} +[StructLayout(LayoutKind.Sequential)] public struct MusicPlayerWantsPlayingRepeatStatus_t +{ + public int m_nPlayingRepeatStatus; +} +[StructLayout(LayoutKind.Sequential)] public struct HTTPRequestCompleted_t +{ + public uint m_hRequest; + public ulong m_ulContextValue; + public bool m_bRequestSuccessful; + public EHTTPStatusCode m_eStatusCode; + public uint m_unBodySize; +} +[StructLayout(LayoutKind.Sequential)] public struct HTTPRequestHeadersReceived_t +{ + public uint m_hRequest; + public ulong m_ulContextValue; +} +[StructLayout(LayoutKind.Sequential)] public struct HTTPRequestDataReceived_t +{ + public uint m_hRequest; + public ulong m_ulContextValue; + public uint m_cOffset; + public uint m_cBytesReceived; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamUnifiedMessagesSendMethodResult_t +{ + public ulong m_hHandle; + public ulong m_unContext; + public EResult m_eResult; + public uint m_unResponseSize; +} +[StructLayout(LayoutKind.Sequential)] public struct ControllerAnalogActionData_t +{ + public EControllerSourceMode eMode; + public float x; + public float y; + public bool bActive; +} +[StructLayout(LayoutKind.Sequential)] public struct ControllerDigitalActionData_t +{ + public bool bState; + public bool bActive; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamUGCDetails_t +{ + public ulong m_nPublishedFileId; + public EResult m_eResult; + public EWorkshopFileType m_eFileType; + public uint m_nCreatorAppID; + public uint m_nConsumerAppID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 129, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchTitle; //char[129] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8000, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchDescription; //char[8000] + public ulong m_ulSteamIDOwner; + public uint m_rtimeCreated; + public uint m_rtimeUpdated; + public uint m_rtimeAddedToUserList; + public ERemoteStoragePublishedFileVisibility m_eVisibility; + public bool m_bBanned; + public bool m_bAcceptedForUse; + public bool m_bTagsTruncated; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1025, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchTags; //char[1025] + public ulong m_hFile; + public ulong m_hPreviewFile; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260, ArraySubType = UnmanagedType.I1)] + public char[] m_pchFileName; //char[260] + public int m_nFileSize; + public int m_nPreviewFileSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchURL; //char[256] + public uint m_unVotesUp; + public uint m_unVotesDown; + public float m_flScore; + public uint m_unNumChildren; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamUGCQueryCompleted_t +{ + public ulong m_handle; + public EResult m_eResult; + public uint m_unNumResultsReturned; + public uint m_unTotalMatchingResults; + public bool m_bCachedData; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamUGCRequestUGCDetailsResult_t +{ + public SteamUGCDetails_t m_details; + public bool m_bCachedData; +} +[StructLayout(LayoutKind.Sequential)] public struct CreateItemResult_t +{ + public EResult m_eResult; + public ulong m_nPublishedFileId; + public bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +} +[StructLayout(LayoutKind.Sequential)] public struct SubmitItemUpdateResult_t +{ + public EResult m_eResult; + public bool m_bUserNeedsToAcceptWorkshopLegalAgreement; +} +[StructLayout(LayoutKind.Sequential)] public struct DownloadItemResult_t +{ + public uint m_unAppID; + public ulong m_nPublishedFileId; + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct UserFavoriteItemsListChanged_t +{ + public ulong m_nPublishedFileId; + public EResult m_eResult; + public bool m_bWasAddRequest; +} +[StructLayout(LayoutKind.Sequential)] public struct SetUserItemVoteResult_t +{ + public ulong m_nPublishedFileId; + public EResult m_eResult; + public bool m_bVoteUp; +} +[StructLayout(LayoutKind.Sequential)] public struct GetUserItemVoteResult_t +{ + public ulong m_nPublishedFileId; + public EResult m_eResult; + public bool m_bVotedUp; + public bool m_bVotedDown; + public bool m_bVoteSkipped; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamAppInstalled_t +{ + public uint m_nAppID; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamAppUninstalled_t +{ + public uint m_nAppID; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_BrowserReady_t +{ + public uint unBrowserHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_NeedsPaint_t +{ + public uint unBrowserHandle; + public string pBGRA; + public uint unWide; + public uint unTall; + public uint unUpdateX; + public uint unUpdateY; + public uint unUpdateWide; + public uint unUpdateTall; + public uint unScrollX; + public uint unScrollY; + public float flPageScale; + public uint unPageSerial; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_StartRequest_t +{ + public uint unBrowserHandle; + public string pchURL; + public string pchTarget; + public string pchPostData; + public bool bIsRedirect; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_CloseBrowser_t +{ + public uint unBrowserHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_URLChanged_t +{ + public uint unBrowserHandle; + public string pchURL; + public string pchPostData; + public bool bIsRedirect; + public string pchPageTitle; + public bool bNewNavigation; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_FinishedRequest_t +{ + public uint unBrowserHandle; + public string pchURL; + public string pchPageTitle; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_OpenLinkInNewTab_t +{ + public uint unBrowserHandle; + public string pchURL; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_ChangedTitle_t +{ + public uint unBrowserHandle; + public string pchTitle; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_SearchResults_t +{ + public uint unBrowserHandle; + public uint unResults; + public uint unCurrentMatch; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_CanGoBackAndForward_t +{ + public uint unBrowserHandle; + public bool bCanGoBack; + public bool bCanGoForward; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_HorizontalScroll_t +{ + public uint unBrowserHandle; + public uint unScrollMax; + public uint unScrollCurrent; + public float flPageScale; + public bool bVisible; + public uint unPageSize; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_VerticalScroll_t +{ + public uint unBrowserHandle; + public uint unScrollMax; + public uint unScrollCurrent; + public float flPageScale; + public bool bVisible; + public uint unPageSize; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_LinkAtPosition_t +{ + public uint unBrowserHandle; + public uint x; + public uint y; + public string pchURL; + public bool bInput; + public bool bLiveLink; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_JSAlert_t +{ + public uint unBrowserHandle; + public string pchMessage; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_JSConfirm_t +{ + public uint unBrowserHandle; + public string pchMessage; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_FileOpenDialog_t +{ + public uint unBrowserHandle; + public string pchTitle; + public string pchInitialFile; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_NewWindow_t +{ + public uint unBrowserHandle; + public string pchURL; + public uint unX; + public uint unY; + public uint unWide; + public uint unTall; + public uint unNewWindow_BrowserHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_SetCursor_t +{ + public uint unBrowserHandle; + public uint eMouseCursor; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_StatusText_t +{ + public uint unBrowserHandle; + public string pchMsg; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_ShowToolTip_t +{ + public uint unBrowserHandle; + public string pchMsg; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_UpdateToolTip_t +{ + public uint unBrowserHandle; + public string pchMsg; +} +[StructLayout(LayoutKind.Sequential)] public struct HTML_HideToolTip_t +{ + public uint unBrowserHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamItemDetails_t +{ + public ulong m_itemId; + public int m_iDefinition; + public char m_unQuantity; + public char m_unFlags; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamInventoryResultReady_t +{ + public int m_handle; + public EResult m_result; +} +[StructLayout(LayoutKind.Sequential)] public struct SteamInventoryFullUpdate_t +{ + public int m_handle; +} +[StructLayout(LayoutKind.Sequential)] public struct BroadcastUploadStop_t +{ + public EBroadcastUploadResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct GetVideoURLResult_t +{ + public EResult m_eResult; + public uint m_unVideoAppID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchURL; //char[256] +} +[StructLayout(LayoutKind.Sequential)] public struct CCallbackBase +{ + public byte m_nCallbackFlags; + public int m_iCallback; +} +[StructLayout(LayoutKind.Sequential)] public struct CCallResult +{ + public ulong m_hAPICall; + public IntPtr m_pObj; + public IntPtr m_Func; +} +[StructLayout(LayoutKind.Sequential)] public struct CCallback +{ + public IntPtr m_pObj; + public IntPtr m_Func; +} +[StructLayout(LayoutKind.Sequential)] public struct CSteamAPIContext +{ + public ISteamUser m_pSteamUser; + public ISteamFriends m_pSteamFriends; + public ISteamUtils m_pSteamUtils; + public ISteamMatchmaking m_pSteamMatchmaking; + public ISteamUserStats m_pSteamUserStats; + public ISteamApps m_pSteamApps; + public ISteamMatchmakingServers m_pSteamMatchmakingServers; + public ISteamNetworking m_pSteamNetworking; + public ISteamRemoteStorage m_pSteamRemoteStorage; + public ISteamScreenshots m_pSteamScreenshots; + public ISteamHTTP m_pSteamHTTP; + public ISteamUnifiedMessages m_pSteamUnifiedMessages; + public ISteamController m_pController; + public ISteamUGC m_pSteamUGC; + public ISteamAppList m_pSteamAppList; + public ISteamMusic m_pSteamMusic; + public ISteamMusicRemote m_pSteamMusicRemote; + public ISteamHTMLSurface m_pSteamHTMLSurface; + public ISteamInventory m_pSteamInventory; + public ISteamVideo m_pSteamVideo; +} +[StructLayout(LayoutKind.Sequential)] public struct GSClientApprove_t +{ + public ulong m_SteamID; + public ulong m_OwnerSteamID; +} +[StructLayout(LayoutKind.Sequential)] public struct GSClientDeny_t +{ + public ulong m_SteamID; + public EDenyReason m_eDenyReason; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public char[] m_rgchOptionalText; //char[128] +} +[StructLayout(LayoutKind.Sequential)] public struct GSClientKick_t +{ + public ulong m_SteamID; + public EDenyReason m_eDenyReason; +} +[StructLayout(LayoutKind.Sequential)] public struct GSClientAchievementStatus_t +{ + public ulong m_SteamID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public char[] m_pchAchievement; //char[128] + public bool m_bUnlocked; +} +[StructLayout(LayoutKind.Sequential)] public struct GSPolicyResponse_t +{ + public byte m_bSecure; +} +[StructLayout(LayoutKind.Sequential)] public struct GSGameplayStats_t +{ + public EResult m_eResult; + public int m_nRank; + public uint m_unTotalConnects; + public uint m_unTotalMinutesPlayed; +} +[StructLayout(LayoutKind.Sequential)] public struct GSClientGroupStatus_t +{ + public ulong m_SteamIDUser; + public ulong m_SteamIDGroup; + public bool m_bMember; + public bool m_bOfficer; +} +[StructLayout(LayoutKind.Sequential)] public struct GSReputation_t +{ + public EResult m_eResult; + public uint m_unReputationScore; + public bool m_bBanned; + public uint m_unBannedIP; + public char m_usBannedPort; + public ulong m_ulBannedGameID; + public uint m_unBanExpires; +} +[StructLayout(LayoutKind.Sequential)] public struct AssociateWithClanResult_t +{ + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct ComputeNewPlayerCompatibilityResult_t +{ + public EResult m_eResult; + public int m_cPlayersThatDontLikeCandidate; + public int m_cPlayersThatCandidateDoesntLike; + public int m_cClanPlayersThatDontLikeCandidate; + public ulong m_SteamIDCandidate; +} +[StructLayout(LayoutKind.Sequential)] public struct GSStatsReceived_t +{ + public EResult m_eResult; + public ulong m_steamIDUser; +} +[StructLayout(LayoutKind.Sequential)] public struct GSStatsStored_t +{ + public EResult m_eResult; + public ulong m_steamIDUser; +} +[StructLayout(LayoutKind.Sequential)] public struct GSStatsUnloaded_t +{ + public ulong m_steamIDUser; +} + +public class SteamAPI +{ +public static void Init(uint appId) +{ +SteamAPIInterop.SteamAPI_RestartAppIfNecessary (appId); +SteamAPIInterop.SteamAPI_Init (); +} + +public static void RunCallbacks() +{ +SteamAPIInterop.SteamAPI_RunCallbacks (); +} + +public static void RegisterCallback(IntPtr pCallback, int iCallback) +{ +SteamAPIInterop.SteamAPI_RegisterCallback (pCallback, iCallback); +} + +public static void UnregisterCallback(IntPtr pCallback) +{ +SteamAPIInterop.SteamAPI_UnregisterCallback (pCallback); +} + +public const int k_iSteamUserCallbacks = 100; +public const int k_iSteamGameServerCallbacks = 200; +public const int k_iSteamFriendsCallbacks = 300; +public const int k_iSteamBillingCallbacks = 400; +public const int k_iSteamMatchmakingCallbacks = 500; +public const int k_iSteamContentServerCallbacks = 600; +public const int k_iSteamUtilsCallbacks = 700; +public const int k_iClientFriendsCallbacks = 800; +public const int k_iClientUserCallbacks = 900; +public const int k_iSteamAppsCallbacks = 1000; +public const int k_iSteamUserStatsCallbacks = 1100; +public const int k_iSteamNetworkingCallbacks = 1200; +public const int k_iClientRemoteStorageCallbacks = 1300; +public const int k_iClientDepotBuilderCallbacks = 1400; +public const int k_iSteamGameServerItemsCallbacks = 1500; +public const int k_iClientUtilsCallbacks = 1600; +public const int k_iSteamGameCoordinatorCallbacks = 1700; +public const int k_iSteamGameServerStatsCallbacks = 1800; +public const int k_iSteam2AsyncCallbacks = 1900; +public const int k_iSteamGameStatsCallbacks = 2000; +public const int k_iClientHTTPCallbacks = 2100; +public const int k_iClientScreenshotsCallbacks = 2200; +public const int k_iSteamScreenshotsCallbacks = 2300; +public const int k_iClientAudioCallbacks = 2400; +public const int k_iClientUnifiedMessagesCallbacks = 2500; +public const int k_iSteamStreamLauncherCallbacks = 2600; +public const int k_iClientControllerCallbacks = 2700; +public const int k_iSteamControllerCallbacks = 2800; +public const int k_iClientParentalSettingsCallbacks = 2900; +public const int k_iClientDeviceAuthCallbacks = 3000; +public const int k_iClientNetworkDeviceManagerCallbacks = 3100; +public const int k_iClientMusicCallbacks = 3200; +public const int k_iClientRemoteClientManagerCallbacks = 3300; +public const int k_iClientUGCCallbacks = 3400; +public const int k_iSteamStreamClientCallbacks = 3500; +public const int k_IClientProductBuilderCallbacks = 3600; +public const int k_iClientShortcutsCallbacks = 3700; +public const int k_iClientRemoteControlManagerCallbacks = 3800; +public const int k_iSteamAppListCallbacks = 3900; +public const int k_iSteamMusicCallbacks = 4000; +public const int k_iSteamMusicRemoteCallbacks = 4100; +public const int k_iClientVRCallbacks = 4200; +public const int k_iClientReservedCallbacks = 4300; +public const int k_iSteamReservedCallbacks = 4400; +public const int k_iSteamHTMLSurfaceCallbacks = 4500; +public const int k_iClientVideoCallbacks = 4600; +public const int k_iClientInventoryCallbacks = 4700; +public const int k_cchPersonaNameMax = 128; +public const int k_cwchPersonaNameMax = 32; +public const int k_cchMaxRichPresenceKeys = 20; +public const int k_cchMaxRichPresenceKeyLength = 64; +public const int k_cchMaxRichPresenceValueLength = 256; +public const int k_cchStatNameMax = 128; +public const int k_cchLeaderboardNameMax = 128; +public const int k_cLeaderboardDetailsMax = 64; +public const const ClientUnifiedMessageHandle k_InvalidUnifiedMessageHandle = 0; +public const const SteamItemInstanceID_t k_SteamItemInstanceIDInvalid = 18446744073709551615; +public const const SteamInventoryResult_t k_SteamInventoryResultInvalid = -1; +public static ISteamClient SteamClient() +{ +return new CSteamClient(SteamAPIInterop.SteamClient()); +} + +public static ISteamUser SteamUser() +{ +return new CSteamUser(SteamAPIInterop.SteamUser()); +} + +public static ISteamFriends SteamFriends() +{ +return new CSteamFriends(SteamAPIInterop.SteamFriends()); +} + +public static ISteamUtils SteamUtils() +{ +return new CSteamUtils(SteamAPIInterop.SteamUtils()); +} + +public static ISteamMatchmaking SteamMatchmaking() +{ +return new CSteamMatchmaking(SteamAPIInterop.SteamMatchmaking()); +} + +public static ISteamMatchmakingServerListResponse SteamMatchmakingServerListResponse() +{ +return new CSteamMatchmakingServerListResponse(SteamAPIInterop.SteamMatchmakingServerListResponse()); +} + +public static ISteamMatchmakingPingResponse SteamMatchmakingPingResponse() +{ +return new CSteamMatchmakingPingResponse(SteamAPIInterop.SteamMatchmakingPingResponse()); +} + +public static ISteamMatchmakingPlayersResponse SteamMatchmakingPlayersResponse() +{ +return new CSteamMatchmakingPlayersResponse(SteamAPIInterop.SteamMatchmakingPlayersResponse()); +} + +public static ISteamMatchmakingRulesResponse SteamMatchmakingRulesResponse() +{ +return new CSteamMatchmakingRulesResponse(SteamAPIInterop.SteamMatchmakingRulesResponse()); +} + +public static ISteamMatchmakingServers SteamMatchmakingServers() +{ +return new CSteamMatchmakingServers(SteamAPIInterop.SteamMatchmakingServers()); +} + +public static ISteamRemoteStorage SteamRemoteStorage() +{ +return new CSteamRemoteStorage(SteamAPIInterop.SteamRemoteStorage()); +} + +public static ISteamUserStats SteamUserStats() +{ +return new CSteamUserStats(SteamAPIInterop.SteamUserStats()); +} + +public static ISteamApps SteamApps() +{ +return new CSteamApps(SteamAPIInterop.SteamApps()); +} + +public static ISteamNetworking SteamNetworking() +{ +return new CSteamNetworking(SteamAPIInterop.SteamNetworking()); +} + +public static ISteamScreenshots SteamScreenshots() +{ +return new CSteamScreenshots(SteamAPIInterop.SteamScreenshots()); +} + +public static ISteamMusic SteamMusic() +{ +return new CSteamMusic(SteamAPIInterop.SteamMusic()); +} + +public static ISteamMusicRemote SteamMusicRemote() +{ +return new CSteamMusicRemote(SteamAPIInterop.SteamMusicRemote()); +} + +public static ISteamHTTP SteamHTTP() +{ +return new CSteamHTTP(SteamAPIInterop.SteamHTTP()); +} + +public static ISteamUnifiedMessages SteamUnifiedMessages() +{ +return new CSteamUnifiedMessages(SteamAPIInterop.SteamUnifiedMessages()); +} + +public static ISteamController SteamController() +{ +return new CSteamController(SteamAPIInterop.SteamController()); +} + +public static ISteamUGC SteamUGC() +{ +return new CSteamUGC(SteamAPIInterop.SteamUGC()); +} + +public static ISteamAppList SteamAppList() +{ +return new CSteamAppList(SteamAPIInterop.SteamAppList()); +} + +public static ISteamHTMLSurface SteamHTMLSurface() +{ +return new CSteamHTMLSurface(SteamAPIInterop.SteamHTMLSurface()); +} + +public static ISteamInventory SteamInventory() +{ +return new CSteamInventory(SteamAPIInterop.SteamInventory()); +} + +public static ISteamVideo SteamVideo() +{ +return new CSteamVideo(SteamAPIInterop.SteamVideo()); +} + +public static ISteamGameServer SteamGameServer() +{ +return new CSteamGameServer(SteamAPIInterop.SteamGameServer()); +} + +public static ISteamGameServerStats SteamGameServerStats() +{ +return new CSteamGameServerStats(SteamAPIInterop.SteamGameServerStats()); +} + +} + + + +} + diff --git a/public/steam/steam_gameserver.h b/public/steam/steam_gameserver.h new file mode 100644 index 000000000..f58791f00 --- /dev/null +++ b/public/steam/steam_gameserver.h @@ -0,0 +1,191 @@ +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: +// +//============================================================================= + +#ifndef STEAM_GAMESERVER_H +#define STEAM_GAMESERVER_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steam_api.h" +#include "isteamgameserver.h" +#include "isteamgameserverstats.h" + +enum EServerMode +{ + eServerModeInvalid = 0, // DO NOT USE + eServerModeNoAuthentication = 1, // Don't authenticate user logins and don't list on the server list + eServerModeAuthentication = 2, // Authenticate users, list on the server list, don't run VAC on clients that connect + eServerModeAuthenticationAndSecure = 3, // Authenticate users, list on the server list and VAC protect clients +}; + +// Initialize ISteamGameServer interface object, and set server properties which may not be changed. +// +// After calling this function, you should set any additional server parameters, and then +// call ISteamGameServer::LogOnAnonymous() or ISteamGameServer::LogOn() +// +// - usSteamPort is the local port used to communicate with the steam servers. +// - usGamePort is the port that clients will connect to for gameplay. +// - usQueryPort is the port that will manage server browser related duties and info +// pings from clients. If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE for usQueryPort, then it +// will use "GameSocketShare" mode, which means that the game is responsible for sending and receiving +// UDP packets for the master server updater. See references to GameSocketShare in isteamgameserver.h. +// - The version string is usually in the form x.x.x.x, and is used by the master server to detect when the +// server is out of date. (Only servers with the latest version will be listed.) +#ifndef _PS3 + +#ifdef VERSION_SAFE_STEAM_API_INTERFACES +S_API bool SteamGameServer_InitSafe( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); +#else +S_API bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); +#endif + +#else + +#ifdef VERSION_SAFE_STEAM_API_INTERFACES +S_API bool SteamGameServer_InitSafe( const SteamPS3Params_t *ps3Params, uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); +#else +S_API bool SteamGameServer_Init( const SteamPS3Params_t *ps3Params, uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); +#endif + +#endif + +#ifndef VERSION_SAFE_STEAM_API_INTERFACES +S_API ISteamGameServer *SteamGameServer(); +S_API ISteamUtils *SteamGameServerUtils(); +S_API ISteamNetworking *SteamGameServerNetworking(); +S_API ISteamGameServerStats *SteamGameServerStats(); +S_API ISteamHTTP *SteamGameServerHTTP(); +S_API ISteamInventory *SteamGameServerInventory(); +S_API ISteamUGC *SteamGameServerUGC(); +#endif + +S_API void SteamGameServer_Shutdown(); +S_API void SteamGameServer_RunCallbacks(); + +S_API bool SteamGameServer_BSecure(); +S_API uint64 SteamGameServer_GetSteamID(); + + +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// These macros are similar to the STEAM_CALLBACK_* macros in steam_api.h, but only trigger for gameserver callbacks +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +#define STEAM_GAMESERVER_CALLBACK( thisclass, func, /*callback_type, [deprecated] var*/... ) \ + _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, GS, 3 ), ( this->SetGameserverFlag();, thisclass, func, __VA_ARGS__ ) ) + +#define STEAM_GAMESERVER_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \ + CCallbackManual< thisclass, callback_type, true > var; void func( callback_type *pParam ) + + + +#define _STEAM_CALLBACK_GS( _, thisclass, func, param, var ) \ + CCallback< thisclass, param, true > var; void func( param *pParam ) + +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// steamclient.dll private wrapper functions +// +// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +S_API HSteamPipe SteamGameServer_GetHSteamPipe(); + +#ifdef VERSION_SAFE_STEAM_API_INTERFACES +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// VERSION_SAFE_STEAM_API_INTERFACES uses CSteamAPIContext to provide interfaces to each module in a way that +// lets them each specify the interface versions they are compiled with. +// +// It's important that these stay inlined in the header so the calling module specifies the interface versions +// for whatever Steam API version it has. +//----------------------------------------------------------------------------------------------------------------------------------------------------------// + +S_API HSteamUser SteamGameServer_GetHSteamUser(); + +class CSteamGameServerAPIContext +{ +public: + CSteamGameServerAPIContext(); + void Clear(); + + bool Init(); + + ISteamGameServer *SteamGameServer() { return m_pSteamGameServer; } + ISteamUtils *SteamGameServerUtils() { return m_pSteamGameServerUtils; } + ISteamNetworking *SteamGameServerNetworking() { return m_pSteamGameServerNetworking; } + ISteamGameServerStats *SteamGameServerStats() { return m_pSteamGameServerStats; } + ISteamHTTP *SteamHTTP() { return m_pSteamHTTP; } + ISteamInventory *SteamInventory() { return m_pSteamInventory; } + ISteamUGC *SteamUGC() { return m_pSteamUGC; } + +private: + ISteamGameServer *m_pSteamGameServer; + ISteamUtils *m_pSteamGameServerUtils; + ISteamNetworking *m_pSteamGameServerNetworking; + ISteamGameServerStats *m_pSteamGameServerStats; + ISteamHTTP *m_pSteamHTTP; + ISteamInventory *m_pSteamInventory; + ISteamUGC *m_pSteamUGC; +}; + +inline CSteamGameServerAPIContext::CSteamGameServerAPIContext() +{ + Clear(); +} + +inline void CSteamGameServerAPIContext::Clear() +{ + m_pSteamGameServer = NULL; + m_pSteamGameServerUtils = NULL; + m_pSteamGameServerNetworking = NULL; + m_pSteamGameServerStats = NULL; + m_pSteamHTTP = NULL; + m_pSteamInventory = NULL; + m_pSteamUGC = NULL; +} + +S_API ISteamClient *g_pSteamClientGameServer; +// This function must be inlined so the module using steam_api.dll gets the version names they want. +inline bool CSteamGameServerAPIContext::Init() +{ + if ( !g_pSteamClientGameServer ) + return false; + + HSteamUser hSteamUser = SteamGameServer_GetHSteamUser(); + HSteamPipe hSteamPipe = SteamGameServer_GetHSteamPipe(); + + m_pSteamGameServer = g_pSteamClientGameServer->GetISteamGameServer( hSteamUser, hSteamPipe, STEAMGAMESERVER_INTERFACE_VERSION ); + if ( !m_pSteamGameServer ) + return false; + + m_pSteamGameServerUtils = g_pSteamClientGameServer->GetISteamUtils( hSteamPipe, STEAMUTILS_INTERFACE_VERSION ); + if ( !m_pSteamGameServerUtils ) + return false; + + m_pSteamGameServerNetworking = g_pSteamClientGameServer->GetISteamNetworking( hSteamUser, hSteamPipe, STEAMNETWORKING_INTERFACE_VERSION ); + if ( !m_pSteamGameServerNetworking ) + return false; + + m_pSteamGameServerStats = g_pSteamClientGameServer->GetISteamGameServerStats( hSteamUser, hSteamPipe, STEAMGAMESERVERSTATS_INTERFACE_VERSION ); + if ( !m_pSteamGameServerStats ) + return false; + + m_pSteamHTTP = g_pSteamClientGameServer->GetISteamHTTP( hSteamUser, hSteamPipe, STEAMHTTP_INTERFACE_VERSION ); + if ( !m_pSteamHTTP ) + return false; + + m_pSteamInventory = g_pSteamClientGameServer->GetISteamInventory( hSteamUser, hSteamPipe, STEAMINVENTORY_INTERFACE_VERSION ); + if ( !m_pSteamInventory ) + return false; + + m_pSteamUGC = g_pSteamClientGameServer->GetISteamUGC( hSteamUser, hSteamPipe, STEAMUGC_INTERFACE_VERSION ); + if ( !m_pSteamUGC ) + return false; + + return true; +} + +#endif // VERSION_SAFE_STEAM_API_INTERFACES + + +#endif // STEAM_GAMESERVER_H diff --git a/public/steam/steamclientpublic.h b/public/steam/steamclientpublic.h index d9e4db0cc..a90a13cbc 100644 --- a/public/steam/steamclientpublic.h +++ b/public/steam/steamclientpublic.h @@ -1,709 +1,1165 @@ -//========= Copyright © 1996-2004, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef STEAMCLIENTPUBLIC_H -#define STEAMCLIENTPUBLIC_H -#ifdef _WIN32 -#pragma once -#endif -//lint -save -e1931 -e1927 -e1924 -e613 -e726 - -// This header file defines the interface between the calling application and the code that -// knows how to communicate with the connection manager (CM) from the Steam service - -// This header file is intended to be portable; ideally this 1 header file plus a lib or dll -// is all you need to integrate the client library into some other tree. So please avoid -// including or requiring other header files if possible. This header should only describe the -// interface layer, no need to include anything about the implementation. - -#include "steamtypes.h" - - -// General result codes -enum EResult -{ - k_EResultOK = 1, // success - k_EResultFail = 2, // generic failure - k_EResultNoConnection = 3, // no/failed network connection -// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed - k_EResultInvalidPassword = 5, // password/ticket is invalid - k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere - k_EResultInvalidProtocolVer = 7, // protocol version is incorrect - k_EResultInvalidParam = 8, // a parameter is incorrect - k_EResultFileNotFound = 9, // file was not found - k_EResultBusy = 10, // called method busy - action not taken - k_EResultInvalidState = 11, // called object was in an invalid state - k_EResultInvalidName = 12, // name is invalid - k_EResultInvalidEmail = 13, // email is invalid - k_EResultDuplicateName = 14, // name is not unique - k_EResultAccessDenied = 15, // access is denied - k_EResultTimeout = 16, // operation timed out - k_EResultBanned = 17, // VAC2 banned - k_EResultAccountNotFound = 18, // account not found - k_EResultInvalidSteamID = 19, // steamID is invalid - k_EResultServiceUnavailable = 20, // The requested service is currently unavailable - k_EResultNotLoggedOn = 21, // The user is not logged on - k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party) - k_EResultEncryptionFailure = 23, // Encryption or Decryption failed - k_EResultInsufficientPrivilege = 24, // Insufficient privilege - k_EResultLimitExceeded = 25, // Too much of a good thing - k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes) - k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired - k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again - k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time - k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user - k_EResultIPNotFound = 31, // IP address not found - k_EResultPersistFailed = 32, // failed to write change to the data store - k_EResultLockingFailed = 33, // failed to acquire access lock for this operation - k_EResultLogonSessionReplaced = 34, - k_EResultConnectFailed = 35, - k_EResultHandshakeFailed = 36, - k_EResultIOFailure = 37, - k_EResultRemoteDisconnect = 38, - k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested -}; - -// Result codes to GSHandleClientDeny/Kick -typedef enum -{ - k_EDenyInvalidVersion = 1, - k_EDenyGeneric = 2, - k_EDenyNotLoggedOn = 3, - k_EDenyNoLicense = 4, - k_EDenyCheater = 5, - k_EDenyLoggedInElseWhere = 6, - k_EDenyUnknownText = 7, - k_EDenyIncompatibleAnticheat = 8, - k_EDenyMemoryCorruption = 9, - k_EDenyIncompatibleSoftware = 10, - k_EDenySteamConnectionLost = 11, - k_EDenySteamConnectionError = 12, - k_EDenySteamResponseTimedOut = 13, - k_EDenySteamValidationStalled = 14, -} EDenyReason; - -// Steam universes. Each universe is a self-contained Steam instance. -enum EUniverse -{ - k_EUniverseInvalid = 0, - k_EUniversePublic = 1, - k_EUniverseBeta = 2, - k_EUniverseInternal = 3, - k_EUniverseDev = 4, - k_EUniverseRC = 5, - - k_EUniverseMax -}; - -// Steam account types -enum EAccountType -{ - k_EAccountTypeInvalid = 0, - k_EAccountTypeIndividual = 1, // single user account - k_EAccountTypeMultiseat = 2, // multiseat (e.g. cybercafe) account - k_EAccountTypeGameServer = 3, // game server account - k_EAccountTypeAnonGameServer = 4, // anonymous game server account - k_EAccountTypePending = 5, // pending - k_EAccountTypeContentServer = 6, // content server - k_EAccountTypeClan = 7, - k_EAccountTypeChat = 8, - k_EAccountTypeP2PSuperSeeder = 9, // a fake steamid used by superpeers to seed content to users of Steam P2P stuff - - // Max of 16 items in this field - k_EAccountTypeMax -}; - - -//----------------------------------------------------------------------------- -// types of user game stats fields -// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE -//----------------------------------------------------------------------------- -enum ESteamUserStatType -{ - k_ESteamUserStatTypeINVALID = 0, - k_ESteamUserStatTypeINT = 1, - k_ESteamUserStatTypeFLOAT = 2, - // Read as FLOAT, set with count / session length - k_ESteamUserStatTypeAVGRATE = 3, - k_ESteamUserStatTypeACHIEVEMENTS = 4, - k_ESteamUserStatTypeGROUPACHIEVEMENTS = 5, -}; - - -//----------------------------------------------------------------------------- -// Purpose: Chat Entry Types (previously was only friend-to-friend message types) -//----------------------------------------------------------------------------- -enum EChatEntryType -{ - k_EChatEntryTypeChatMsg = 1, // Normal text message from another user - k_EChatEntryTypeTyping = 2, // Another user is typing (not used in multi-user chat) - k_EChatEntryTypeInviteGame = 3, // DEPRECATED Invite from other user into that users current game - k_EChatEntryTypeEmote = 4, // text emote message - // Above are previous FriendMsgType entries, now merged into more generic chat entry types -}; - - -//----------------------------------------------------------------------------- -// Purpose: Chat Room Enter Responses -//----------------------------------------------------------------------------- -enum EChatRoomEnterResponse -{ - k_EChatRoomEnterResponseSuccess = 1, // Success - k_EChatRoomEnterResponseDoesntExist = 2, // Chat doesn't exist (probably closed) - k_EChatRoomEnterResponseNotAllowed = 3, // General Denied - You don't have the permissions needed to join the chat - k_EChatRoomEnterResponseFull = 4, // Chat room has reached its maximum size - k_EChatRoomEnterResponseError = 5, // Unexpected Error - k_EChatRoomEnterResponseBanned = 6, // You are banned from this chat room and may not join -}; - - -typedef void (*PFNLegacyKeyRegistration)( const char *pchCDKey, const char *pchInstallPath ); -typedef bool (*PFNLegacyKeyInstalled)(); - - -#pragma pack( push, 1 ) - -// Steam ID structure (64 bits total) -class CSteamID -{ -public: - - //----------------------------------------------------------------------------- - // Purpose: Constructor - //----------------------------------------------------------------------------- - CSteamID() - { - m_unAccountID = 0; - m_EAccountType = k_EAccountTypeInvalid; - m_EUniverse = k_EUniverseInvalid; - m_unAccountInstance = 0; - } - - - //----------------------------------------------------------------------------- - // Purpose: Constructor - // Input : unAccountID - 32-bit account ID - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - CSteamID( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType ) - { - Set( unAccountID, eUniverse, eAccountType ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Constructor - // Input : unAccountID - 32-bit account ID - // unAccountInstance - instance - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType ) - { -#if defined(_SERVER) && defined(Assert) - Assert( ! ( ( k_EAccountTypeIndividual == eAccountType ) && ( 1 != unAccountInstance ) ) ); // enforce that for individual accounts, instance is always 1 -#endif // _SERVER - InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Constructor - // Input : ulSteamID - 64-bit representation of a Steam ID - // Note: Will not accept a uint32 or int32 as input, as that is a probable mistake. - // See the stubbed out overloads in the private: section for more info. - //----------------------------------------------------------------------------- - CSteamID( uint64 ulSteamID ) - { - SetFromUint64( ulSteamID ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Sets parameters for steam ID - // Input : unAccountID - 32-bit account ID - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - void Set( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType ) - { - m_unAccountID = unAccountID; - m_EUniverse = eUniverse; - m_EAccountType = eAccountType; - m_unAccountInstance = 1; - } - - - //----------------------------------------------------------------------------- - // Purpose: Sets parameters for steam ID - // Input : unAccountID - 32-bit account ID - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - void InstancedSet( uint32 unAccountID, uint32 unInstance, EUniverse eUniverse, EAccountType eAccountType ) - { - m_unAccountID = unAccountID; - m_EUniverse = eUniverse; - m_EAccountType = eAccountType; - m_unAccountInstance = unInstance; - } - - - //----------------------------------------------------------------------------- - // Purpose: Initializes a steam ID from its 52 bit parts and universe/type - // Input : ulIdentifier - 52 bits of goodness - //----------------------------------------------------------------------------- - void FullSet( uint64 ulIdentifier, EUniverse eUniverse, EAccountType eAccountType ) - { - m_unAccountID = ( ulIdentifier & 0xFFFFFFFF ); // account ID is low 32 bits - m_unAccountInstance = ( ( ulIdentifier >> 32 ) & 0xFFFFF ); // account instance is next 20 bits - m_EUniverse = eUniverse; - m_EAccountType = eAccountType; - } - - - //----------------------------------------------------------------------------- - // Purpose: Initializes a steam ID from its 64-bit representation - // Input : ulSteamID - 64-bit representation of a Steam ID - //----------------------------------------------------------------------------- - void SetFromUint64( uint64 ulSteamID ) - { - m_unAccountID = ( ulSteamID & 0xFFFFFFFF ); // account ID is low 32 bits - m_unAccountInstance = ( ( ulSteamID >> 32 ) & 0xFFFFF ); // account instance is next 20 bits - - m_EAccountType = ( EAccountType ) ( ( ulSteamID >> 52 ) & 0xF ); // type is next 4 bits - m_EUniverse = ( EUniverse ) ( ( ulSteamID >> 56 ) & 0xFF ); // universe is next 8 bits - } - - -#if defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H ) - //----------------------------------------------------------------------------- - // Purpose: Initializes a steam ID from a Steam2 ID structure - // Input: pTSteamGlobalUserID - Steam2 ID to convert - // eUniverse - universe this ID belongs to - //----------------------------------------------------------------------------- - void SetFromSteam2( TSteamGlobalUserID *pTSteamGlobalUserID, EUniverse eUniverse ) - { - m_unAccountID = pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits * 2 + - pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits; - m_EUniverse = eUniverse; // set the universe - m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual - m_unAccountInstance = 1; // individual accounts always have an account instance ID of 1 - } - - //----------------------------------------------------------------------------- - // Purpose: Fills out a Steam2 ID structure - // Input: pTSteamGlobalUserID - Steam2 ID to write to - //----------------------------------------------------------------------------- - void ConvertToSteam2( TSteamGlobalUserID *pTSteamGlobalUserID ) const - { - // only individual accounts have any meaning in Steam 2, only they can be mapped - // Assert( m_EAccountType == k_EAccountTypeIndividual ); - - pTSteamGlobalUserID->m_SteamInstanceID = 0; - pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits = m_unAccountID % 2; - pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits = m_unAccountID / 2; - } -#endif // defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H ) - - //----------------------------------------------------------------------------- - // Purpose: Converts steam ID to its 64-bit representation - // Output : 64-bit representation of a Steam ID - //----------------------------------------------------------------------------- - uint64 ConvertToUint64() const - { - return (uint64) ( ( ( (uint64) m_EUniverse ) << 56 ) + ( ( (uint64) m_EAccountType ) << 52 ) + - ( ( (uint64) m_unAccountInstance ) << 32 ) + m_unAccountID ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Converts the static parts of a steam ID to a 64-bit representation. - // For multiseat accounts, all instances of that account will have the - // same static account key, so they can be grouped together by the static - // account key. - // Output : 64-bit static account key - //----------------------------------------------------------------------------- - uint64 GetStaticAccountKey() const - { - // note we do NOT include the account instance (which is a dynamic property) in the static account key - return (uint64) ( ( ( (uint64) m_EUniverse ) << 56 ) + ((uint64) m_EAccountType << 52 ) + m_unAccountID ); - } - - - //----------------------------------------------------------------------------- - // Purpose: create an anonymous game server login to be filled in by the AM - //----------------------------------------------------------------------------- - void CreateBlankAnonLogon( EUniverse eUniverse ) - { - m_unAccountID = 0; - m_EAccountType = k_EAccountTypeAnonGameServer; - m_EUniverse = eUniverse; - m_unAccountInstance = 0; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this an anonymous game server login that will be filled in? - //----------------------------------------------------------------------------- - bool BBlankAnonAccount() const - { - return m_unAccountID == 0 && - m_EAccountType == k_EAccountTypeAnonGameServer && - m_unAccountInstance == 0; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this a game server account id? - //----------------------------------------------------------------------------- - bool BGameServerAccount() const - { - return m_EAccountType == k_EAccountTypeGameServer || m_EAccountType == k_EAccountTypeAnonGameServer; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this a content server account id? - //----------------------------------------------------------------------------- - bool BContentServerAccount() const - { - return m_EAccountType == k_EAccountTypeContentServer; - } - - - //----------------------------------------------------------------------------- - // Purpose: Is this a clan account id? - //----------------------------------------------------------------------------- - bool BClanAccount() const - { - return m_EAccountType == k_EAccountTypeClan; - } - - - //----------------------------------------------------------------------------- - // Purpose: Is this a chat account id? - //----------------------------------------------------------------------------- - bool BChatAccount() const - { - return m_EAccountType == k_EAccountTypeChat; - } - - - //----------------------------------------------------------------------------- - // Purpose: Is this an individual user account id? - //----------------------------------------------------------------------------- - bool BIndividualAccount() const - { - return m_EAccountType == k_EAccountTypeIndividual; - } - - - // simple accessors - void SetAccountID( uint32 unAccountID ) { m_unAccountID = unAccountID; } - uint32 GetAccountID() const { return m_unAccountID; } - uint32 GetUnAccountInstance() const { return m_unAccountInstance; } - EAccountType GetEAccountType() const { return ( EAccountType ) m_EAccountType; } - EUniverse GetEUniverse() const { return m_EUniverse; } - void SetEUniverse( EUniverse eUniverse ) { m_EUniverse = eUniverse; } - bool IsValid() const { return ( m_EAccountType != k_EAccountTypeInvalid && m_EUniverse != k_EUniverseInvalid ); } - - // this set of functions is hidden, will be moved out of class - explicit CSteamID( const char *pchSteamID, EUniverse eDefaultUniverse = k_EUniverseInvalid ); - const char * Render() const; // renders this steam ID to string - static const char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string - - void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse ); - bool SetFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse ); - - bool operator==( const CSteamID &val ) const - { - return ( ( val.m_unAccountID == m_unAccountID ) && ( val.m_unAccountInstance == m_unAccountInstance ) - && ( val.m_EAccountType == m_EAccountType ) && ( val.m_EUniverse == m_EUniverse ) ); - } - - bool operator!=( const CSteamID &val ) const { return !operator==( val ); } - bool operator<( const CSteamID &val ) const { return ConvertToUint64() < val.ConvertToUint64(); } - - // DEBUG function - bool BValidExternalSteamID() const; - -private: - // These are defined here to prevent accidental implicit conversion of a u32AccountID to a CSteamID. - // If you get a compiler error about an ambiguous constructor/function then it may be because you're - // passing a 32-bit int to a function that takes a CSteamID. You should explicitly create the SteamID - // using the correct Universe and account Type/Instance values. - CSteamID( uint32 ); - CSteamID( int32 ); - -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable:4201) // nameless union is nonstandard - // 64 bits total - union - { - struct - { -#endif - uint32 m_unAccountID : 32; // unique account identifier - unsigned int m_unAccountInstance : 20; // dynamic instance ID (used for multiseat type accounts only) - unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference - EUniverse m_EUniverse : 8; // universe this account belongs to -#ifdef _WIN32 - }; - - uint64 m_unAll64Bits; - }; -#pragma warning(pop) // no more anonymous unions until next time -#endif -}; - -const int k_unSteamAccountIDMask = 0xFFFFFFFF; -const int k_unSteamAccountInstanceMask = 0x000FFFFF; - - -// Special flags for Chat accounts - they go in the top 8 bits -// of the steam ID's "instance", leaving 12 for the actual instances -enum EChatSteamIDInstanceFlags -{ - k_EChatAccountInstanceMask = 0x00000FFF, // top 8 bits are flags - - k_EChatInstanceFlagClan = ( k_unSteamAccountInstanceMask + 1 ) >> 1, // top bit - k_EChatInstanceFlagLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 2, // next one down, etc - - // Max of 8 flags -}; - - -// generic invalid CSteamID -const CSteamID k_steamIDNil; - -// This steamID comes from a user game connection to an out of date GS that hasnt implemented the protocol -// to provide its steamID -const CSteamID k_steamIDOutofDateGS( 0, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ); -// This steamID comes from a user game connection to an sv_lan GS -const CSteamID k_steamIDLanModeGS( 0, 0, k_EUniversePublic, k_EAccountTypeInvalid ); -// This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized -// its steam3 component and started logging on. -const CSteamID k_steamIDNotInitYetGS( 1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ); - - -#ifdef STEAM -// Returns the matching chat steamID, with the default instance of 0 -// If the steamID passed in is already of type k_EAccountTypeChat it will be returned with the same instance -CSteamID ChatIDFromSteamID( CSteamID &steamID ); -// Returns the matching clan steamID, with the default instance of 0 -// If the steamID passed in is already of type k_EAccountTypeClan it will be returned with the same instance -CSteamID ClanIDFromSteamID( CSteamID &steamID ); -// Asserts steamID type before conversion -CSteamID ChatIDFromClanID( CSteamID &steamIDClan ); -// Asserts steamID type before conversion -CSteamID ClanIDFromChatID( CSteamID &steamIDChat ); - -#endif // _STEAM - - -//----------------------------------------------------------------------------- -// Purpose: encapsulates an appID/modID pair -//----------------------------------------------------------------------------- -class CGameID -{ -public: - CGameID() - { - m_ulGameID = 0; - } - - explicit CGameID( uint64 ulGameID ) - { - m_ulGameID = ulGameID; - } - - explicit CGameID( int32 nAppID ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - } - - explicit CGameID( uint32 nAppID ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - } - - CGameID( uint32 nAppID, uint32 nModID ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - m_gameID.m_nModID = nModID; - m_gameID.m_nType = k_EGameIDTypeGameMod; - } - - // Hidden functions used only by Steam - explicit CGameID( const char *pchGameID ); - char * Render() const; // renders this Game ID to string - static char * Render( uint64 ulGameID ); // static method to render a uint64 representation of a Game ID to a string - - // must include checksum_crc.h first to get this functionality -#if defined( CHECKSUM_CRC_H ) - CGameID( uint32 nAppID, const char *pchModPath ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - m_gameID.m_nType = k_EGameIDTypeGameMod; - - char rgchModDir[MAX_PATH]; - Q_FileBase( pchModPath, rgchModDir, sizeof( rgchModDir ) ); - CRC32_t crc32; - CRC32_Init( &crc32 ); - CRC32_ProcessBuffer( &crc32, rgchModDir, Q_strlen( rgchModDir ) ); - CRC32_Final( &crc32 ); - - // set the high-bit on the mod-id - // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique - // replacement for appID's - m_gameID.m_nModID = crc32 | (0x80000000); - } - - CGameID( const char *pchExePath, const char *pchAppName ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = 0; - m_gameID.m_nType = k_EGameIDTypeShortcut; - - CRC32_t crc32; - CRC32_Init( &crc32 ); - CRC32_ProcessBuffer( &crc32, pchExePath, Q_strlen( pchExePath ) ); - CRC32_ProcessBuffer( &crc32, pchAppName, Q_strlen( pchAppName ) ); - CRC32_Final( &crc32 ); - - // set the high-bit on the mod-id - // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique - // replacement for appID's - m_gameID.m_nModID = crc32 | (0x80000000); - } -#endif - - void SetAsShortcut() - { - m_gameID.m_nAppID = 0; - m_gameID.m_nType = k_EGameIDTypeShortcut; - } - - void SetAsP2PFile() - { - m_gameID.m_nAppID = 0; - m_gameID.m_nType = k_EGameIDTypeP2P; - } - - uint64 ToUint64() const - { - return m_ulGameID; - } - - uint64 *GetUint64Ptr() - { - return &m_ulGameID; - } - - bool IsMod() const - { - return ( m_gameID.m_nType == k_EGameIDTypeGameMod ); - } - - bool IsShortcut() const - { - return ( m_gameID.m_nType == k_EGameIDTypeShortcut ); - } - - bool IsP2PFile() const - { - return ( m_gameID.m_nType == k_EGameIDTypeP2P ); - } - - bool IsSteamApp() const - { - return ( m_gameID.m_nType == k_EGameIDTypeApp ); - } - - - - uint32 ModID() const - { - return m_gameID.m_nModID; - } - - uint32 AppID() const - { - return m_gameID.m_nAppID; - } - - bool operator == ( const CGameID &rhs ) const - { - return m_ulGameID == rhs.m_ulGameID; - } - - bool operator != ( const CGameID &rhs ) const - { - return !(*this == rhs); - } - - bool operator < ( const CGameID &rhs ) const - { - return ( m_ulGameID < rhs.m_ulGameID ); - } - - bool IsValid() const - { - return ( m_ulGameID != 0 ); - } - - void Reset() - { - m_ulGameID = 0; - } - - - -private: - enum EGameIDType - { - k_EGameIDTypeApp = 0, - k_EGameIDTypeGameMod = 1, - k_EGameIDTypeShortcut = 2, - k_EGameIDTypeP2P = 3, - }; - - struct GameID_t - { - unsigned int m_nAppID : 24; - unsigned int m_nType : 8; - unsigned int m_nModID : 32; - }; - - union - { - uint64 m_ulGameID; - GameID_t m_gameID; - }; -}; - -#pragma pack( pop ) - -const int k_cchGameExtraInfoMax = 64; - - -// Max number of credit cards stored for one account -const int k_nMaxNumCardsPerAccount = 1; - - -//----------------------------------------------------------------------------- -// Constants used for query ports. -//----------------------------------------------------------------------------- - -#define QUERY_PORT_NOT_INITIALIZED 0xFFFF // We haven't asked the GS for this query port's actual value yet. -#define QUERY_PORT_ERROR 0xFFFE // We were unable to get the query port for this server. - -#endif // STEAMCLIENTPUBLIC_H +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +//============================================================================= + +#ifndef STEAMCLIENTPUBLIC_H +#define STEAMCLIENTPUBLIC_H +#ifdef _WIN32 +#pragma once +#endif +//lint -save -e1931 -e1927 -e1924 -e613 -e726 + +// This header file defines the interface between the calling application and the code that +// knows how to communicate with the connection manager (CM) from the Steam service + +// This header file is intended to be portable; ideally this 1 header file plus a lib or dll +// is all you need to integrate the client library into some other tree. So please avoid +// including or requiring other header files if possible. This header should only describe the +// interface layer, no need to include anything about the implementation. + +#include "steamtypes.h" +#include "steamuniverse.h" + +// General result codes +enum EResult +{ + k_EResultOK = 1, // success + k_EResultFail = 2, // generic failure + k_EResultNoConnection = 3, // no/failed network connection +// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed + k_EResultInvalidPassword = 5, // password/ticket is invalid + k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere + k_EResultInvalidProtocolVer = 7, // protocol version is incorrect + k_EResultInvalidParam = 8, // a parameter is incorrect + k_EResultFileNotFound = 9, // file was not found + k_EResultBusy = 10, // called method busy - action not taken + k_EResultInvalidState = 11, // called object was in an invalid state + k_EResultInvalidName = 12, // name is invalid + k_EResultInvalidEmail = 13, // email is invalid + k_EResultDuplicateName = 14, // name is not unique + k_EResultAccessDenied = 15, // access is denied + k_EResultTimeout = 16, // operation timed out + k_EResultBanned = 17, // VAC2 banned + k_EResultAccountNotFound = 18, // account not found + k_EResultInvalidSteamID = 19, // steamID is invalid + k_EResultServiceUnavailable = 20, // The requested service is currently unavailable + k_EResultNotLoggedOn = 21, // The user is not logged on + k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party) + k_EResultEncryptionFailure = 23, // Encryption or Decryption failed + k_EResultInsufficientPrivilege = 24, // Insufficient privilege + k_EResultLimitExceeded = 25, // Too much of a good thing + k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes) + k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired + k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again + k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time + k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user + k_EResultIPNotFound = 31, // IP address not found + k_EResultPersistFailed = 32, // failed to write change to the data store + k_EResultLockingFailed = 33, // failed to acquire access lock for this operation + k_EResultLogonSessionReplaced = 34, + k_EResultConnectFailed = 35, + k_EResultHandshakeFailed = 36, + k_EResultIOFailure = 37, + k_EResultRemoteDisconnect = 38, + k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested + k_EResultBlocked = 40, // a user didn't allow it + k_EResultIgnored = 41, // target is ignoring sender + k_EResultNoMatch = 42, // nothing matching the request found + k_EResultAccountDisabled = 43, + k_EResultServiceReadOnly = 44, // this service is not accepting content changes right now + k_EResultAccountNotFeatured = 45, // account doesn't have value, so this feature isn't available + k_EResultAdministratorOK = 46, // allowed to take this action, but only because requester is admin + k_EResultContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol. + k_EResultTryAnotherCM = 48, // The current CM can't service the user making a request, user should try another. + k_EResultPasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed. + k_EResultAlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait + k_EResultSuspended = 51, // Long running operation (content download) suspended/paused + k_EResultCancelled = 52, // Operation canceled (typically by user: content download) + k_EResultDataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable + k_EResultDiskFull = 54, // Operation canceled - not enough disk space. + k_EResultRemoteCallFailed = 55, // an remote call or IPC call failed + k_EResultPasswordUnset = 56, // Password could not be verified as it's unset server side + k_EResultExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account + k_EResultPSNTicketInvalid = 58, // PSN ticket was invalid + k_EResultExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first + k_EResultRemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files + k_EResultIllegalPassword = 61, // The requested new password is not legal + k_EResultSameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer ) + k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure + k_EResultCannotUseOldPassword = 64, // The requested new password is not legal + k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid + k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent + k_EResultHardwareNotCapableOfIPT = 67, // + k_EResultIPTInitError = 68, // + k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user + k_EResultFacebookQueryError = 70, // Facebook query returned an error + k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired + k_EResultIPLoginRestrictionFailed = 72, + k_EResultAccountLockedDown = 73, + k_EResultAccountLogonDeniedVerifiedEmailRequired = 74, + k_EResultNoMatchingURL = 75, + k_EResultBadResponse = 76, // parse failure, missing field, etc. + k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password + k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range + k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen + k_EResultDisabled = 80, // The requested service has been configured to be unavailable + k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid ! + k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action + k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted + k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent + k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login + k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted + k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker + k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch + k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match + k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners + k_EResultNotModified = 91, // data not modified + k_EResultNoMobileDevice = 92, // the account does not have a mobile device associated with it + k_EResultTimeNotSynced = 93, // the time presented is out of range or tolerance + k_EResultSmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.) + k_EResultAccountLimitExceeded = 95, // Too many accounts access this resource + k_EResultAccountActivityLimitExceeded = 96, // Too many changes to this account + k_EResultPhoneActivityLimitExceeded = 97, // Too many changes to this phone + k_EResultRefundToWallet = 98, // Cannot refund to payment method, must use wallet + k_EResultEmailSendFailure = 99, // Cannot send an email + k_EResultNotSettled = 100, // Can't perform operation till payment has settled + k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha +}; + +// Error codes for use with the voice functions +enum EVoiceResult +{ + k_EVoiceResultOK = 0, + k_EVoiceResultNotInitialized = 1, + k_EVoiceResultNotRecording = 2, + k_EVoiceResultNoData = 3, + k_EVoiceResultBufferTooSmall = 4, + k_EVoiceResultDataCorrupted = 5, + k_EVoiceResultRestricted = 6, + k_EVoiceResultUnsupportedCodec = 7, + k_EVoiceResultReceiverOutOfDate = 8, + k_EVoiceResultReceiverDidNotAnswer = 9, + +}; + +// Result codes to GSHandleClientDeny/Kick +enum EDenyReason +{ + k_EDenyInvalid = 0, + k_EDenyInvalidVersion = 1, + k_EDenyGeneric = 2, + k_EDenyNotLoggedOn = 3, + k_EDenyNoLicense = 4, + k_EDenyCheater = 5, + k_EDenyLoggedInElseWhere = 6, + k_EDenyUnknownText = 7, + k_EDenyIncompatibleAnticheat = 8, + k_EDenyMemoryCorruption = 9, + k_EDenyIncompatibleSoftware = 10, + k_EDenySteamConnectionLost = 11, + k_EDenySteamConnectionError = 12, + k_EDenySteamResponseTimedOut = 13, + k_EDenySteamValidationStalled = 14, + k_EDenySteamOwnerLeftGuestUser = 15, +}; + +// return type of GetAuthSessionTicket +typedef uint32 HAuthTicket; +const HAuthTicket k_HAuthTicketInvalid = 0; + +// results from BeginAuthSession +enum EBeginAuthSessionResult +{ + k_EBeginAuthSessionResultOK = 0, // Ticket is valid for this game and this steamID. + k_EBeginAuthSessionResultInvalidTicket = 1, // Ticket is not valid. + k_EBeginAuthSessionResultDuplicateRequest = 2, // A ticket has already been submitted for this steamID + k_EBeginAuthSessionResultInvalidVersion = 3, // Ticket is from an incompatible interface version + k_EBeginAuthSessionResultGameMismatch = 4, // Ticket is not for this game + k_EBeginAuthSessionResultExpiredTicket = 5, // Ticket has expired +}; + +// Callback values for callback ValidateAuthTicketResponse_t which is a response to BeginAuthSession +enum EAuthSessionResponse +{ + k_EAuthSessionResponseOK = 0, // Steam has verified the user is online, the ticket is valid and ticket has not been reused. + k_EAuthSessionResponseUserNotConnectedToSteam = 1, // The user in question is not connected to steam + k_EAuthSessionResponseNoLicenseOrExpired = 2, // The license has expired. + k_EAuthSessionResponseVACBanned = 3, // The user is VAC banned for this game. + k_EAuthSessionResponseLoggedInElseWhere = 4, // The user account has logged in elsewhere and the session containing the game instance has been disconnected. + k_EAuthSessionResponseVACCheckTimedOut = 5, // VAC has been unable to perform anti-cheat checks on this user + k_EAuthSessionResponseAuthTicketCanceled = 6, // The ticket has been canceled by the issuer + k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid. + k_EAuthSessionResponseAuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam. + k_EAuthSessionResponsePublisherIssuedBan = 9, // The user is banned for this game. The ban came via the web api and not VAC +}; + +// results from UserHasLicenseForApp +enum EUserHasLicenseForAppResult +{ + k_EUserHasLicenseResultHasLicense = 0, // User has a license for specified app + k_EUserHasLicenseResultDoesNotHaveLicense = 1, // User does not have a license for the specified app + k_EUserHasLicenseResultNoAuth = 2, // User has not been authenticated +}; + + +// Steam account types +enum EAccountType +{ + k_EAccountTypeInvalid = 0, + k_EAccountTypeIndividual = 1, // single user account + k_EAccountTypeMultiseat = 2, // multiseat (e.g. cybercafe) account + k_EAccountTypeGameServer = 3, // game server account + k_EAccountTypeAnonGameServer = 4, // anonymous game server account + k_EAccountTypePending = 5, // pending + k_EAccountTypeContentServer = 6, // content server + k_EAccountTypeClan = 7, + k_EAccountTypeChat = 8, + k_EAccountTypeConsoleUser = 9, // Fake SteamID for local PSN account on PS3 or Live account on 360, etc. + k_EAccountTypeAnonUser = 10, + + // Max of 16 items in this field + k_EAccountTypeMax +}; + + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +enum EAppReleaseState +{ + k_EAppReleaseState_Unknown = 0, // unknown, required appinfo or license info is missing + k_EAppReleaseState_Unavailable = 1, // even if user 'just' owns it, can see game at all + k_EAppReleaseState_Prerelease = 2, // can be purchased and is visible in games list, nothing else. Common appInfo section released + k_EAppReleaseState_PreloadOnly = 3, // owners can preload app, not play it. AppInfo fully released. + k_EAppReleaseState_Released = 4, // owners can download and play app. +}; + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +enum EAppOwnershipFlags +{ + k_EAppOwnershipFlags_None = 0x0000, // unknown + k_EAppOwnershipFlags_OwnsLicense = 0x0001, // owns license for this game + k_EAppOwnershipFlags_FreeLicense = 0x0002, // not paid for game + k_EAppOwnershipFlags_RegionRestricted = 0x0004, // owns app, but not allowed to play in current region + k_EAppOwnershipFlags_LowViolence = 0x0008, // only low violence version + k_EAppOwnershipFlags_InvalidPlatform = 0x0010, // app not supported on current platform + k_EAppOwnershipFlags_SharedLicense = 0x0020, // license was granted by authorized local device + k_EAppOwnershipFlags_FreeWeekend = 0x0040, // owned by a free weekend licenses + k_EAppOwnershipFlags_RetailLicense = 0x0080, // has a retail license for game, (CD-Key etc) + k_EAppOwnershipFlags_LicenseLocked = 0x0100, // shared license is locked (in use) by other user + k_EAppOwnershipFlags_LicensePending = 0x0200, // owns app, but transaction is still pending. Can't install or play + k_EAppOwnershipFlags_LicenseExpired = 0x0400, // doesn't own app anymore since license expired + k_EAppOwnershipFlags_LicensePermanent = 0x0800, // permanent license, not borrowed, or guest or freeweekend etc + k_EAppOwnershipFlags_LicenseRecurring = 0x1000, // Recurring license, user is charged periodically + k_EAppOwnershipFlags_LicenseCanceled = 0x2000, // Mark as canceled, but might be still active if recurring + k_EAppOwnershipFlags_AutoGrant = 0x4000, // Ownership is based on any kind of autogrant license + k_EAppOwnershipFlags_PendingGift = 0x8000, // user has pending gift to redeem +}; + + +//----------------------------------------------------------------------------- +// Purpose: designed as flags to allow filters masks +//----------------------------------------------------------------------------- +enum EAppType +{ + k_EAppType_Invalid = 0x000, // unknown / invalid + k_EAppType_Game = 0x001, // playable game, default type + k_EAppType_Application = 0x002, // software application + k_EAppType_Tool = 0x004, // SDKs, editors & dedicated servers + k_EAppType_Demo = 0x008, // game demo + k_EAppType_Media_DEPRECATED = 0x010, // legacy - was used for game trailers, which are now just videos on the web + k_EAppType_DLC = 0x020, // down loadable content + k_EAppType_Guide = 0x040, // game guide, PDF etc + k_EAppType_Driver = 0x080, // hardware driver updater (ATI, Razor etc) + k_EAppType_Config = 0x100, // hidden app used to config Steam features (backpack, sales, etc) + k_EAppType_Hardware = 0x200, // a hardware device (Steam Machine, Steam Controller, Steam Link, etc.) + // 0x400 is up for grabs here + k_EAppType_Video = 0x800, // A video component of either a Film or TVSeries (may be the feature, an episode, preview, making-of, etc) + k_EAppType_Plugin = 0x1000, // Plug-in types for other Apps + k_EAppType_Music = 0x2000, // Music files + + k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only + k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace +}; + + + +//----------------------------------------------------------------------------- +// types of user game stats fields +// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE +//----------------------------------------------------------------------------- +enum ESteamUserStatType +{ + k_ESteamUserStatTypeINVALID = 0, + k_ESteamUserStatTypeINT = 1, + k_ESteamUserStatTypeFLOAT = 2, + // Read as FLOAT, set with count / session length + k_ESteamUserStatTypeAVGRATE = 3, + k_ESteamUserStatTypeACHIEVEMENTS = 4, + k_ESteamUserStatTypeGROUPACHIEVEMENTS = 5, + + // max, for sanity checks + k_ESteamUserStatTypeMAX +}; + + +//----------------------------------------------------------------------------- +// Purpose: Chat Entry Types (previously was only friend-to-friend message types) +//----------------------------------------------------------------------------- +enum EChatEntryType +{ + k_EChatEntryTypeInvalid = 0, + k_EChatEntryTypeChatMsg = 1, // Normal text message from another user + k_EChatEntryTypeTyping = 2, // Another user is typing (not used in multi-user chat) + k_EChatEntryTypeInviteGame = 3, // Invite from other user into that users current game + k_EChatEntryTypeEmote = 4, // text emote message (deprecated, should be treated as ChatMsg) + //k_EChatEntryTypeLobbyGameStart = 5, // lobby game is starting (dead - listen for LobbyGameCreated_t callback instead) + k_EChatEntryTypeLeftConversation = 6, // user has left the conversation ( closed chat window ) + // Above are previous FriendMsgType entries, now merged into more generic chat entry types + k_EChatEntryTypeEntered = 7, // user has entered the conversation (used in multi-user chat and group chat) + k_EChatEntryTypeWasKicked = 8, // user was kicked (data: 64-bit steamid of actor performing the kick) + k_EChatEntryTypeWasBanned = 9, // user was banned (data: 64-bit steamid of actor performing the ban) + k_EChatEntryTypeDisconnected = 10, // user disconnected + k_EChatEntryTypeHistoricalChat = 11, // a chat message from user's chat history or offilne message + k_EChatEntryTypeReserved1 = 12, + k_EChatEntryTypeReserved2 = 13, + k_EChatEntryTypeLinkBlocked = 14, // a link was removed by the chat filter. +}; + + +//----------------------------------------------------------------------------- +// Purpose: Chat Room Enter Responses +//----------------------------------------------------------------------------- +enum EChatRoomEnterResponse +{ + k_EChatRoomEnterResponseSuccess = 1, // Success + k_EChatRoomEnterResponseDoesntExist = 2, // Chat doesn't exist (probably closed) + k_EChatRoomEnterResponseNotAllowed = 3, // General Denied - You don't have the permissions needed to join the chat + k_EChatRoomEnterResponseFull = 4, // Chat room has reached its maximum size + k_EChatRoomEnterResponseError = 5, // Unexpected Error + k_EChatRoomEnterResponseBanned = 6, // You are banned from this chat room and may not join + k_EChatRoomEnterResponseLimited = 7, // Joining this chat is not allowed because you are a limited user (no value on account) + k_EChatRoomEnterResponseClanDisabled = 8, // Attempt to join a clan chat when the clan is locked or disabled + k_EChatRoomEnterResponseCommunityBan = 9, // Attempt to join a chat when the user has a community lock on their account + k_EChatRoomEnterResponseMemberBlockedYou = 10, // Join failed - some member in the chat has blocked you from joining + k_EChatRoomEnterResponseYouBlockedMember = 11, // Join failed - you have blocked some member already in the chat + // k_EChatRoomEnterResponseNoRankingDataLobby = 12, // No longer used + // k_EChatRoomEnterResponseNoRankingDataUser = 13, // No longer used + // k_EChatRoomEnterResponseRankOutOfRange = 14, // No longer used +}; + + +typedef void (*PFNLegacyKeyRegistration)( const char *pchCDKey, const char *pchInstallPath ); +typedef bool (*PFNLegacyKeyInstalled)(); + +const unsigned int k_unSteamAccountIDMask = 0xFFFFFFFF; +const unsigned int k_unSteamAccountInstanceMask = 0x000FFFFF; +// we allow 3 simultaneous user account instances right now, 1= desktop, 2 = console, 4 = web, 0 = all +const unsigned int k_unSteamUserDesktopInstance = 1; +const unsigned int k_unSteamUserConsoleInstance = 2; +const unsigned int k_unSteamUserWebInstance = 4; + +// Special flags for Chat accounts - they go in the top 8 bits +// of the steam ID's "instance", leaving 12 for the actual instances +enum EChatSteamIDInstanceFlags +{ + k_EChatAccountInstanceMask = 0x00000FFF, // top 8 bits are flags + + k_EChatInstanceFlagClan = ( k_unSteamAccountInstanceMask + 1 ) >> 1, // top bit + k_EChatInstanceFlagLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 2, // next one down, etc + k_EChatInstanceFlagMMSLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 3, // next one down, etc + + // Max of 8 flags +}; + + +//----------------------------------------------------------------------------- +// Purpose: Marketing message flags that change how a client should handle them +//----------------------------------------------------------------------------- +enum EMarketingMessageFlags +{ + k_EMarketingMessageFlagsNone = 0, + k_EMarketingMessageFlagsHighPriority = 1 << 0, + k_EMarketingMessageFlagsPlatformWindows = 1 << 1, + k_EMarketingMessageFlagsPlatformMac = 1 << 2, + k_EMarketingMessageFlagsPlatformLinux = 1 << 3, + + //aggregate flags + k_EMarketingMessageFlagsPlatformRestrictions = + k_EMarketingMessageFlagsPlatformWindows | + k_EMarketingMessageFlagsPlatformMac | + k_EMarketingMessageFlagsPlatformLinux, +}; + + + +//----------------------------------------------------------------------------- +// Purpose: Possible positions to tell the overlay to show notifications in +//----------------------------------------------------------------------------- +enum ENotificationPosition +{ + k_EPositionTopLeft = 0, + k_EPositionTopRight = 1, + k_EPositionBottomLeft = 2, + k_EPositionBottomRight = 3, +}; + + +//----------------------------------------------------------------------------- +// Purpose: Broadcast upload result details +//----------------------------------------------------------------------------- +enum EBroadcastUploadResult +{ + k_EBroadcastUploadResultNone = 0, // broadcast state unknown + k_EBroadcastUploadResultOK = 1, // broadcast was good, no problems + k_EBroadcastUploadResultInitFailed = 2, // broadcast init failed + k_EBroadcastUploadResultFrameFailed = 3, // broadcast frame upload failed + k_EBroadcastUploadResultTimeout = 4, // broadcast upload timed out + k_EBroadcastUploadResultBandwidthExceeded = 5, // broadcast send too much data + k_EBroadcastUploadResultLowFPS = 6, // broadcast FPS too low + k_EBroadcastUploadResultMissingKeyFrames = 7, // broadcast sending not enough key frames + k_EBroadcastUploadResultNoConnection = 8, // broadcast client failed to connect to relay + k_EBroadcastUploadResultRelayFailed = 9, // relay dropped the upload + k_EBroadcastUploadResultSettingsChanged = 10, // the client changed broadcast settings + k_EBroadcastUploadResultMissingAudio = 11, // client failed to send audio data + k_EBroadcastUploadResultTooFarBehind = 12, // clients was too slow uploading + k_EBroadcastUploadResultTranscodeBehind = 13, // server failed to keep up with transcode +}; + + +//----------------------------------------------------------------------------- +// Purpose: codes for well defined launch options +//----------------------------------------------------------------------------- +enum ELaunchOptionType +{ + k_ELaunchOptionType_None = 0, // unknown what launch option does + k_ELaunchOptionType_Default = 1, // runs the game, app, whatever in default mode + k_ELaunchOptionType_SafeMode = 2, // runs the game in safe mode + k_ELaunchOptionType_Multiplayer = 3, // runs the game in multiplayer mode + k_ELaunchOptionType_Config = 4, // runs config tool for this game + k_ELaunchOptionType_VR = 5, // runs game in VR mode + k_ELaunchOptionType_Server = 6, // runs dedicated server for this game + k_ELaunchOptionType_Editor = 7, // runs game editor + k_ELaunchOptionType_Manual = 8, // shows game manual + k_ELaunchOptionType_Benchmark = 9, // runs game benchmark + k_ELaunchOptionType_Option1 = 10, // generic run option, uses description field for game name + k_ELaunchOptionType_Option2 = 11, // generic run option, uses description field for game name + k_ELaunchOptionType_Option3 = 12, // generic run option, uses description field for game name + + + k_ELaunchOptionType_Dialog = 1000, // show launch options dialog +}; + + +#pragma pack( push, 1 ) + +#define CSTEAMID_DEFINED + +// Steam ID structure (64 bits total) +class CSteamID +{ +public: + + //----------------------------------------------------------------------------- + // Purpose: Constructor + //----------------------------------------------------------------------------- + CSteamID() + { + m_steamid.m_comp.m_unAccountID = 0; + m_steamid.m_comp.m_EAccountType = k_EAccountTypeInvalid; + m_steamid.m_comp.m_EUniverse = k_EUniverseInvalid; + m_steamid.m_comp.m_unAccountInstance = 0; + } + + + //----------------------------------------------------------------------------- + // Purpose: Constructor + // Input : unAccountID - 32-bit account ID + // eUniverse - Universe this account belongs to + // eAccountType - Type of account + //----------------------------------------------------------------------------- + CSteamID( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType ) + { + Set( unAccountID, eUniverse, eAccountType ); + } + + + //----------------------------------------------------------------------------- + // Purpose: Constructor + // Input : unAccountID - 32-bit account ID + // unAccountInstance - instance + // eUniverse - Universe this account belongs to + // eAccountType - Type of account + //----------------------------------------------------------------------------- + CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType ) + { +#if defined(_SERVER) && defined(Assert) + Assert( ! ( ( k_EAccountTypeIndividual == eAccountType ) && ( unAccountInstance > k_unSteamUserWebInstance ) ) ); // enforce that for individual accounts, instance is always 1 +#endif // _SERVER + InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType ); + } + + + //----------------------------------------------------------------------------- + // Purpose: Constructor + // Input : ulSteamID - 64-bit representation of a Steam ID + // Note: Will not accept a uint32 or int32 as input, as that is a probable mistake. + // See the stubbed out overloads in the private: section for more info. + //----------------------------------------------------------------------------- + CSteamID( uint64 ulSteamID ) + { + SetFromUint64( ulSteamID ); + } +#ifdef INT64_DIFFERENT_FROM_INT64_T + CSteamID( uint64_t ulSteamID ) + { + SetFromUint64( (uint64)ulSteamID ); + } +#endif + + + //----------------------------------------------------------------------------- + // Purpose: Sets parameters for steam ID + // Input : unAccountID - 32-bit account ID + // eUniverse - Universe this account belongs to + // eAccountType - Type of account + //----------------------------------------------------------------------------- + void Set( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType ) + { + m_steamid.m_comp.m_unAccountID = unAccountID; + m_steamid.m_comp.m_EUniverse = eUniverse; + m_steamid.m_comp.m_EAccountType = eAccountType; + + if ( eAccountType == k_EAccountTypeClan || eAccountType == k_EAccountTypeGameServer ) + { + m_steamid.m_comp.m_unAccountInstance = 0; + } + else + { + // by default we pick the desktop instance + m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance; + } + } + + + //----------------------------------------------------------------------------- + // Purpose: Sets parameters for steam ID + // Input : unAccountID - 32-bit account ID + // eUniverse - Universe this account belongs to + // eAccountType - Type of account + //----------------------------------------------------------------------------- + void InstancedSet( uint32 unAccountID, uint32 unInstance, EUniverse eUniverse, EAccountType eAccountType ) + { + m_steamid.m_comp.m_unAccountID = unAccountID; + m_steamid.m_comp.m_EUniverse = eUniverse; + m_steamid.m_comp.m_EAccountType = eAccountType; + m_steamid.m_comp.m_unAccountInstance = unInstance; + } + + + //----------------------------------------------------------------------------- + // Purpose: Initializes a steam ID from its 52 bit parts and universe/type + // Input : ulIdentifier - 52 bits of goodness + //----------------------------------------------------------------------------- + void FullSet( uint64 ulIdentifier, EUniverse eUniverse, EAccountType eAccountType ) + { + m_steamid.m_comp.m_unAccountID = ( ulIdentifier & k_unSteamAccountIDMask ); // account ID is low 32 bits + m_steamid.m_comp.m_unAccountInstance = ( ( ulIdentifier >> 32 ) & k_unSteamAccountInstanceMask ); // account instance is next 20 bits + m_steamid.m_comp.m_EUniverse = eUniverse; + m_steamid.m_comp.m_EAccountType = eAccountType; + } + + + //----------------------------------------------------------------------------- + // Purpose: Initializes a steam ID from its 64-bit representation + // Input : ulSteamID - 64-bit representation of a Steam ID + //----------------------------------------------------------------------------- + void SetFromUint64( uint64 ulSteamID ) + { + m_steamid.m_unAll64Bits = ulSteamID; + } + + + //----------------------------------------------------------------------------- + // Purpose: Clear all fields, leaving an invalid ID. + //----------------------------------------------------------------------------- + void Clear() + { + m_steamid.m_comp.m_unAccountID = 0; + m_steamid.m_comp.m_EAccountType = k_EAccountTypeInvalid; + m_steamid.m_comp.m_EUniverse = k_EUniverseInvalid; + m_steamid.m_comp.m_unAccountInstance = 0; + } + + +#if defined( INCLUDED_STEAM2_USERID_STRUCTS ) + //----------------------------------------------------------------------------- + // Purpose: Initializes a steam ID from a Steam2 ID structure + // Input: pTSteamGlobalUserID - Steam2 ID to convert + // eUniverse - universe this ID belongs to + //----------------------------------------------------------------------------- + void SetFromSteam2( TSteamGlobalUserID *pTSteamGlobalUserID, EUniverse eUniverse ) + { + m_steamid.m_comp.m_unAccountID = pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits * 2 + + pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits; + m_steamid.m_comp.m_EUniverse = eUniverse; // set the universe + m_steamid.m_comp.m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual + m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance; // Steam2 only knew desktop instances + } + + //----------------------------------------------------------------------------- + // Purpose: Fills out a Steam2 ID structure + // Input: pTSteamGlobalUserID - Steam2 ID to write to + //----------------------------------------------------------------------------- + void ConvertToSteam2( TSteamGlobalUserID *pTSteamGlobalUserID ) const + { + // only individual accounts have any meaning in Steam 2, only they can be mapped + // Assert( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual ); + + pTSteamGlobalUserID->m_SteamInstanceID = 0; + pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits = m_steamid.m_comp.m_unAccountID % 2; + pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits = m_steamid.m_comp.m_unAccountID / 2; + } +#endif // defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H ) + + //----------------------------------------------------------------------------- + // Purpose: Converts steam ID to its 64-bit representation + // Output : 64-bit representation of a Steam ID + //----------------------------------------------------------------------------- + uint64 ConvertToUint64() const + { + return m_steamid.m_unAll64Bits; + } + + + //----------------------------------------------------------------------------- + // Purpose: Converts the static parts of a steam ID to a 64-bit representation. + // For multiseat accounts, all instances of that account will have the + // same static account key, so they can be grouped together by the static + // account key. + // Output : 64-bit static account key + //----------------------------------------------------------------------------- + uint64 GetStaticAccountKey() const + { + // note we do NOT include the account instance (which is a dynamic property) in the static account key + return (uint64) ( ( ( (uint64) m_steamid.m_comp.m_EUniverse ) << 56 ) + ((uint64) m_steamid.m_comp.m_EAccountType << 52 ) + m_steamid.m_comp.m_unAccountID ); + } + + + //----------------------------------------------------------------------------- + // Purpose: create an anonymous game server login to be filled in by the AM + //----------------------------------------------------------------------------- + void CreateBlankAnonLogon( EUniverse eUniverse ) + { + m_steamid.m_comp.m_unAccountID = 0; + m_steamid.m_comp.m_EAccountType = k_EAccountTypeAnonGameServer; + m_steamid.m_comp.m_EUniverse = eUniverse; + m_steamid.m_comp.m_unAccountInstance = 0; + } + + + //----------------------------------------------------------------------------- + // Purpose: create an anonymous game server login to be filled in by the AM + //----------------------------------------------------------------------------- + void CreateBlankAnonUserLogon( EUniverse eUniverse ) + { + m_steamid.m_comp.m_unAccountID = 0; + m_steamid.m_comp.m_EAccountType = k_EAccountTypeAnonUser; + m_steamid.m_comp.m_EUniverse = eUniverse; + m_steamid.m_comp.m_unAccountInstance = 0; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this an anonymous game server login that will be filled in? + //----------------------------------------------------------------------------- + bool BBlankAnonAccount() const + { + return m_steamid.m_comp.m_unAccountID == 0 && BAnonAccount() && m_steamid.m_comp.m_unAccountInstance == 0; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this a game server account id? (Either persistent or anonymous) + //----------------------------------------------------------------------------- + bool BGameServerAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer || m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this a persistent (not anonymous) game server account id? + //----------------------------------------------------------------------------- + bool BPersistentGameServerAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this an anonymous game server account id? + //----------------------------------------------------------------------------- + bool BAnonGameServerAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this a content server account id? + //----------------------------------------------------------------------------- + bool BContentServerAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeContentServer; + } + + + //----------------------------------------------------------------------------- + // Purpose: Is this a clan account id? + //----------------------------------------------------------------------------- + bool BClanAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeClan; + } + + + //----------------------------------------------------------------------------- + // Purpose: Is this a chat account id? + //----------------------------------------------------------------------------- + bool BChatAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeChat; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this a chat account id? + //----------------------------------------------------------------------------- + bool IsLobby() const + { + return ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeChat ) + && ( m_steamid.m_comp.m_unAccountInstance & k_EChatInstanceFlagLobby ); + } + + + //----------------------------------------------------------------------------- + // Purpose: Is this an individual user account id? + //----------------------------------------------------------------------------- + bool BIndividualAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual || m_steamid.m_comp.m_EAccountType == k_EAccountTypeConsoleUser; + } + + + //----------------------------------------------------------------------------- + // Purpose: Is this an anonymous account? + //----------------------------------------------------------------------------- + bool BAnonAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonUser || m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this an anonymous user account? ( used to create an account or reset a password ) + //----------------------------------------------------------------------------- + bool BAnonUserAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonUser; + } + + //----------------------------------------------------------------------------- + // Purpose: Is this a faked up Steam ID for a PSN friend account? + //----------------------------------------------------------------------------- + bool BConsoleUserAccount() const + { + return m_steamid.m_comp.m_EAccountType == k_EAccountTypeConsoleUser; + } + + // simple accessors + void SetAccountID( uint32 unAccountID ) { m_steamid.m_comp.m_unAccountID = unAccountID; } + void SetAccountInstance( uint32 unInstance ){ m_steamid.m_comp.m_unAccountInstance = unInstance; } + void ClearIndividualInstance() { if ( BIndividualAccount() ) m_steamid.m_comp.m_unAccountInstance = 0; } + bool HasNoIndividualInstance() const { return BIndividualAccount() && (m_steamid.m_comp.m_unAccountInstance==0); } + AccountID_t GetAccountID() const { return m_steamid.m_comp.m_unAccountID; } + uint32 GetUnAccountInstance() const { return m_steamid.m_comp.m_unAccountInstance; } + EAccountType GetEAccountType() const { return ( EAccountType ) m_steamid.m_comp.m_EAccountType; } + EUniverse GetEUniverse() const { return m_steamid.m_comp.m_EUniverse; } + void SetEUniverse( EUniverse eUniverse ) { m_steamid.m_comp.m_EUniverse = eUniverse; } + bool IsValid() const; + + // this set of functions is hidden, will be moved out of class + explicit CSteamID( const char *pchSteamID, EUniverse eDefaultUniverse = k_EUniverseInvalid ); + const char * Render() const; // renders this steam ID to string + static const char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string + + void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse ); + // SetFromString allows many partially-correct strings, constraining how + // we might be able to change things in the future. + // SetFromStringStrict requires the exact string forms that we support + // and is preferred when the caller knows it's safe to be strict. + // Returns whether the string parsed correctly. + bool SetFromStringStrict( const char *pchSteamID, EUniverse eDefaultUniverse ); + bool SetFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse ); + + inline bool operator==( const CSteamID &val ) const { return m_steamid.m_unAll64Bits == val.m_steamid.m_unAll64Bits; } + inline bool operator!=( const CSteamID &val ) const { return !operator==( val ); } + inline bool operator<( const CSteamID &val ) const { return m_steamid.m_unAll64Bits < val.m_steamid.m_unAll64Bits; } + inline bool operator>( const CSteamID &val ) const { return m_steamid.m_unAll64Bits > val.m_steamid.m_unAll64Bits; } + + // DEBUG function + bool BValidExternalSteamID() const; + +private: + // These are defined here to prevent accidental implicit conversion of a u32AccountID to a CSteamID. + // If you get a compiler error about an ambiguous constructor/function then it may be because you're + // passing a 32-bit int to a function that takes a CSteamID. You should explicitly create the SteamID + // using the correct Universe and account Type/Instance values. + CSteamID( uint32 ); + CSteamID( int32 ); + + // 64 bits total + union SteamID_t + { + struct SteamIDComponent_t + { +#ifdef VALVE_BIG_ENDIAN + EUniverse m_EUniverse : 8; // universe this account belongs to + unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference + unsigned int m_unAccountInstance : 20; // dynamic instance ID + uint32 m_unAccountID : 32; // unique account identifier +#else + uint32 m_unAccountID : 32; // unique account identifier + unsigned int m_unAccountInstance : 20; // dynamic instance ID + unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference + EUniverse m_EUniverse : 8; // universe this account belongs to +#endif + } m_comp; + + uint64 m_unAll64Bits; + } m_steamid; +}; + +inline bool CSteamID::IsValid() const +{ + if ( m_steamid.m_comp.m_EAccountType <= k_EAccountTypeInvalid || m_steamid.m_comp.m_EAccountType >= k_EAccountTypeMax ) + return false; + + if ( m_steamid.m_comp.m_EUniverse <= k_EUniverseInvalid || m_steamid.m_comp.m_EUniverse >= k_EUniverseMax ) + return false; + + if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual ) + { + if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance > k_unSteamUserWebInstance ) + return false; + } + + if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeClan ) + { + if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance != 0 ) + return false; + } + + if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer ) + { + if ( m_steamid.m_comp.m_unAccountID == 0 ) + return false; + // Any limit on instances? We use them for local users and bots + } + return true; +} + +// generic invalid CSteamID +#define k_steamIDNil CSteamID() + +// This steamID comes from a user game connection to an out of date GS that hasnt implemented the protocol +// to provide its steamID +#define k_steamIDOutofDateGS CSteamID( 0, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) +// This steamID comes from a user game connection to an sv_lan GS +#define k_steamIDLanModeGS CSteamID( 0, 0, k_EUniversePublic, k_EAccountTypeInvalid ) +// This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized +// its steam3 component and started logging on. +#define k_steamIDNotInitYetGS CSteamID( 1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) +// This steamID can come from a user game connection to a GS that isn't using the steam authentication system but still +// wants to support the "Join Game" option in the friends list +#define k_steamIDNonSteamGS CSteamID( 2, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) + + +#ifdef STEAM +// Returns the matching chat steamID, with the default instance of 0 +// If the steamID passed in is already of type k_EAccountTypeChat it will be returned with the same instance +CSteamID ChatIDFromSteamID( const CSteamID &steamID ); +// Returns the matching clan steamID, with the default instance of 0 +// If the steamID passed in is already of type k_EAccountTypeClan it will be returned with the same instance +CSteamID ClanIDFromSteamID( const CSteamID &steamID ); +// Asserts steamID type before conversion +CSteamID ChatIDFromClanID( const CSteamID &steamIDClan ); +// Asserts steamID type before conversion +CSteamID ClanIDFromChatID( const CSteamID &steamIDChat ); + +#endif // _STEAM + + +//----------------------------------------------------------------------------- +// Purpose: encapsulates an appID/modID pair +//----------------------------------------------------------------------------- +class CGameID +{ +public: + + CGameID() + { + m_gameID.m_nType = k_EGameIDTypeApp; + m_gameID.m_nAppID = k_uAppIdInvalid; + m_gameID.m_nModID = 0; + } + + explicit CGameID( uint64 ulGameID ) + { + m_ulGameID = ulGameID; + } +#ifdef INT64_DIFFERENT_FROM_INT64_T + CGameID( uint64_t ulGameID ) + { + m_ulGameID = (uint64)ulGameID; + } +#endif + + explicit CGameID( int32 nAppID ) + { + m_ulGameID = 0; + m_gameID.m_nAppID = nAppID; + } + + explicit CGameID( uint32 nAppID ) + { + m_ulGameID = 0; + m_gameID.m_nAppID = nAppID; + } + + CGameID( uint32 nAppID, uint32 nModID ) + { + m_ulGameID = 0; + m_gameID.m_nAppID = nAppID; + m_gameID.m_nModID = nModID; + m_gameID.m_nType = k_EGameIDTypeGameMod; + } + + // Hidden functions used only by Steam + explicit CGameID( const char *pchGameID ); + const char *Render() const; // render this Game ID to string + static const char *Render( uint64 ulGameID ); // static method to render a uint64 representation of a Game ID to a string + + // must include checksum_crc.h first to get this functionality +#if defined( CHECKSUM_CRC_H ) + CGameID( uint32 nAppID, const char *pchModPath ) + { + m_ulGameID = 0; + m_gameID.m_nAppID = nAppID; + m_gameID.m_nType = k_EGameIDTypeGameMod; + + char rgchModDir[MAX_PATH]; + V_FileBase( pchModPath, rgchModDir, sizeof( rgchModDir ) ); + CRC32_t crc32; + CRC32_Init( &crc32 ); + CRC32_ProcessBuffer( &crc32, rgchModDir, V_strlen( rgchModDir ) ); + CRC32_Final( &crc32 ); + + // set the high-bit on the mod-id + // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique + // replacement for appID's + m_gameID.m_nModID = crc32 | (0x80000000); + } + + CGameID( const char *pchExePath, const char *pchAppName ) + { + m_ulGameID = 0; + m_gameID.m_nAppID = k_uAppIdInvalid; + m_gameID.m_nType = k_EGameIDTypeShortcut; + + CRC32_t crc32; + CRC32_Init( &crc32 ); + CRC32_ProcessBuffer( &crc32, pchExePath, V_strlen( pchExePath ) ); + CRC32_ProcessBuffer( &crc32, pchAppName, V_strlen( pchAppName ) ); + CRC32_Final( &crc32 ); + + // set the high-bit on the mod-id + // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique + // replacement for appID's + m_gameID.m_nModID = crc32 | (0x80000000); + } + +#if defined( VSTFILEID_H ) + + CGameID( VstFileID vstFileID ) + { + m_ulGameID = 0; + m_gameID.m_nAppID = k_uAppIdInvalid; + m_gameID.m_nType = k_EGameIDTypeP2P; + + CRC32_t crc32; + CRC32_Init( &crc32 ); + const char *pchFileId = vstFileID.Render(); + CRC32_ProcessBuffer( &crc32, pchFileId, V_strlen( pchFileId ) ); + CRC32_Final( &crc32 ); + + // set the high-bit on the mod-id + // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique + // replacement for appID's + m_gameID.m_nModID = crc32 | (0x80000000); + } + +#endif /* VSTFILEID_H */ + +#endif /* CHECKSUM_CRC_H */ + + + uint64 ToUint64() const + { + return m_ulGameID; + } + + uint64 *GetUint64Ptr() + { + return &m_ulGameID; + } + + void Set( uint64 ulGameID ) + { + m_ulGameID = ulGameID; + } + + bool IsMod() const + { + return ( m_gameID.m_nType == k_EGameIDTypeGameMod ); + } + + bool IsShortcut() const + { + return ( m_gameID.m_nType == k_EGameIDTypeShortcut ); + } + + bool IsP2PFile() const + { + return ( m_gameID.m_nType == k_EGameIDTypeP2P ); + } + + bool IsSteamApp() const + { + return ( m_gameID.m_nType == k_EGameIDTypeApp ); + } + + uint32 ModID() const + { + return m_gameID.m_nModID; + } + + uint32 AppID() const + { + return m_gameID.m_nAppID; + } + + bool operator == ( const CGameID &rhs ) const + { + return m_ulGameID == rhs.m_ulGameID; + } + + bool operator != ( const CGameID &rhs ) const + { + return !(*this == rhs); + } + + bool operator < ( const CGameID &rhs ) const + { + return ( m_ulGameID < rhs.m_ulGameID ); + } + + bool IsValid() const + { + // each type has it's own invalid fixed point: + switch( m_gameID.m_nType ) + { + case k_EGameIDTypeApp: + return m_gameID.m_nAppID != k_uAppIdInvalid; + + case k_EGameIDTypeGameMod: + return m_gameID.m_nAppID != k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000; + + case k_EGameIDTypeShortcut: + return (m_gameID.m_nModID & 0x80000000) != 0; + + case k_EGameIDTypeP2P: + return m_gameID.m_nAppID == k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000; + + default: +#if defined(Assert) + Assert(false); +#endif + return false; + } + + } + + void Reset() + { + m_ulGameID = 0; + } + + + +private: + + enum EGameIDType + { + k_EGameIDTypeApp = 0, + k_EGameIDTypeGameMod = 1, + k_EGameIDTypeShortcut = 2, + k_EGameIDTypeP2P = 3, + }; + + struct GameID_t + { +#ifdef VALVE_BIG_ENDIAN + unsigned int m_nModID : 32; + unsigned int m_nType : 8; + unsigned int m_nAppID : 24; +#else + unsigned int m_nAppID : 24; + unsigned int m_nType : 8; + unsigned int m_nModID : 32; +#endif + }; + + union + { + uint64 m_ulGameID; + GameID_t m_gameID; + }; +}; + +#pragma pack( pop ) + +const int k_cchGameExtraInfoMax = 64; + + +//----------------------------------------------------------------------------- +// Constants used for query ports. +//----------------------------------------------------------------------------- + +#define QUERY_PORT_NOT_INITIALIZED 0xFFFF // We haven't asked the GS for this query port's actual value yet. +#define QUERY_PORT_ERROR 0xFFFE // We were unable to get the query port for this server. + + +//----------------------------------------------------------------------------- +// Purpose: Passed as argument to SteamAPI_UseBreakpadCrashHandler to enable optional callback +// just before minidump file is captured after a crash has occurred. (Allows app to append additional comment data to the dump, etc.) +//----------------------------------------------------------------------------- +typedef void (*PFNPreMinidumpCallback)(void *context); + +//----------------------------------------------------------------------------- +// Purpose: Used by ICrashHandler interfaces to reference particular installed crash handlers +//----------------------------------------------------------------------------- +typedef void *BREAKPAD_HANDLE; +#define BREAKPAD_INVALID_HANDLE (BREAKPAD_HANDLE)0 + +#endif // STEAMCLIENTPUBLIC_H diff --git a/public/steam/steamencryptedappticket.h b/public/steam/steamencryptedappticket.h new file mode 100644 index 000000000..d85df5a96 --- /dev/null +++ b/public/steam/steamencryptedappticket.h @@ -0,0 +1,32 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: utilities to decode/decrypt a ticket from the +// ISteamUser::RequestEncryptedAppTicket, ISteamUser::GetEncryptedAppTicket API +// +// To use: declare CSteamEncryptedAppTicket, then call BDecryptTicket +// if BDecryptTicket returns true, other accessors are valid +// +//============================================================================= + +#include "steam_api.h" + +static const int k_nSteamEncryptedAppTicketSymmetricKeyLen = 32; + + +S_API bool SteamEncryptedAppTicket_BDecryptTicket( const uint8 *rgubTicketEncrypted, uint32 cubTicketEncrypted, + uint8 *rgubTicketDecrypted, uint32 *pcubTicketDecrypted, + const uint8 rgubKey[k_nSteamEncryptedAppTicketSymmetricKeyLen], int cubKey ); + +S_API bool SteamEncryptedAppTicket_BIsTicketForApp( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID ); + +S_API RTime32 SteamEncryptedAppTicket_GetTicketIssueTime( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted ); + +S_API void SteamEncryptedAppTicket_GetTicketSteamID( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, CSteamID *psteamID ); + +S_API AppId_t SteamEncryptedAppTicket_GetTicketAppID( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted ); + +S_API bool SteamEncryptedAppTicket_BUserOwnsAppInTicket( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID ); + +S_API bool SteamEncryptedAppTicket_BUserIsVacBanned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted ); + +S_API const uint8 *SteamEncryptedAppTicket_GetUserVariableData( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32 *pcubUserData ); \ No newline at end of file diff --git a/public/steam/steamhttpenums.h b/public/steam/steamhttpenums.h new file mode 100644 index 000000000..e15171f4e --- /dev/null +++ b/public/steam/steamhttpenums.h @@ -0,0 +1,97 @@ +//====== Copyright © 1996-2010, Valve Corporation, All rights reserved. ======= +// +// Purpose: HTTP related enums, stuff that is shared by both clients and servers, and our +// UI projects goes here. +// +//============================================================================= + +#ifndef STEAMHTTPENUMS_H +#define STEAMHTTPENUMS_H +#ifdef _WIN32 +#pragma once +#endif + +// HTTP related types + +// This enum is used in client API methods, do not re-number existing values. +enum EHTTPMethod +{ + k_EHTTPMethodInvalid = 0, + k_EHTTPMethodGET, + k_EHTTPMethodHEAD, + k_EHTTPMethodPOST, + k_EHTTPMethodPUT, + k_EHTTPMethodDELETE, + k_EHTTPMethodOPTIONS, + + // The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for + // a compliant general purpose server. We'll likely add more as we find uses for them. + + // k_EHTTPMethodTRACE, + // k_EHTTPMethodCONNECT +}; + + +// HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions +// of each of these. +enum EHTTPStatusCode +{ + // Invalid status code (this isn't defined in HTTP, used to indicate unset in our code) + k_EHTTPStatusCodeInvalid = 0, + + // Informational codes + k_EHTTPStatusCode100Continue = 100, + k_EHTTPStatusCode101SwitchingProtocols = 101, + + // Success codes + k_EHTTPStatusCode200OK = 200, + k_EHTTPStatusCode201Created = 201, + k_EHTTPStatusCode202Accepted = 202, + k_EHTTPStatusCode203NonAuthoritative = 203, + k_EHTTPStatusCode204NoContent = 204, + k_EHTTPStatusCode205ResetContent = 205, + k_EHTTPStatusCode206PartialContent = 206, + + // Redirection codes + k_EHTTPStatusCode300MultipleChoices = 300, + k_EHTTPStatusCode301MovedPermanently = 301, + k_EHTTPStatusCode302Found = 302, + k_EHTTPStatusCode303SeeOther = 303, + k_EHTTPStatusCode304NotModified = 304, + k_EHTTPStatusCode305UseProxy = 305, + //k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1) + k_EHTTPStatusCode307TemporaryRedirect = 307, + + // Error codes + k_EHTTPStatusCode400BadRequest = 400, + k_EHTTPStatusCode401Unauthorized = 401, // You probably want 403 or something else. 401 implies you're sending a WWW-Authenticate header and the client can sent an Authorization header in response. + k_EHTTPStatusCode402PaymentRequired = 402, // This is reserved for future HTTP specs, not really supported by clients + k_EHTTPStatusCode403Forbidden = 403, + k_EHTTPStatusCode404NotFound = 404, + k_EHTTPStatusCode405MethodNotAllowed = 405, + k_EHTTPStatusCode406NotAcceptable = 406, + k_EHTTPStatusCode407ProxyAuthRequired = 407, + k_EHTTPStatusCode408RequestTimeout = 408, + k_EHTTPStatusCode409Conflict = 409, + k_EHTTPStatusCode410Gone = 410, + k_EHTTPStatusCode411LengthRequired = 411, + k_EHTTPStatusCode412PreconditionFailed = 412, + k_EHTTPStatusCode413RequestEntityTooLarge = 413, + k_EHTTPStatusCode414RequestURITooLong = 414, + k_EHTTPStatusCode415UnsupportedMediaType = 415, + k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416, + k_EHTTPStatusCode417ExpectationFailed = 417, + k_EHTTPStatusCode4xxUnknown = 418, // 418 is reserved, so we'll use it to mean unknown + k_EHTTPStatusCode429TooManyRequests = 429, + + // Server error codes + k_EHTTPStatusCode500InternalServerError = 500, + k_EHTTPStatusCode501NotImplemented = 501, + k_EHTTPStatusCode502BadGateway = 502, + k_EHTTPStatusCode503ServiceUnavailable = 503, + k_EHTTPStatusCode504GatewayTimeout = 504, + k_EHTTPStatusCode505HTTPVersionNotSupported = 505, + k_EHTTPStatusCode5xxUnknown = 599, +}; + +#endif // STEAMHTTPENUMS_H \ No newline at end of file diff --git a/public/steam/steamps3params.h b/public/steam/steamps3params.h new file mode 100644 index 000000000..d6f2fd755 --- /dev/null +++ b/public/steam/steamps3params.h @@ -0,0 +1,112 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef STEAMPS3PARAMS_H +#define STEAMPS3PARAMS_H +#ifdef _WIN32 +#pragma once +#endif + +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// PlayStation 3 initialization parameters +// +// The following structure must be passed to when loading steam_api_ps3.prx +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +#define STEAM_PS3_PATH_MAX 1055 +#define STEAM_PS3_SERVICE_ID_MAX 32 +#define STEAM_PS3_COMMUNICATION_ID_MAX 10 +#define STEAM_PS3_COMMUNICATION_SIG_MAX 160 +#define STEAM_PS3_LANGUAGE_MAX 64 +#define STEAM_PS3_REGION_CODE_MAX 16 +#define STEAM_PS3_CURRENT_PARAMS_VER 2 +struct SteamPS3Params_t +{ + uint32 m_unVersion; // set to STEAM_PS3_CURRENT_PARAMS_VER + + void *pReserved; + uint32 m_nAppId; // set to your game's appid + + char m_rgchInstallationPath[ STEAM_PS3_PATH_MAX ]; // directory containing latest steam prx's and sdata. Can be read only (BDVD) + char m_rgchSystemCache[ STEAM_PS3_PATH_MAX ]; // temp working cache, not persistent + char m_rgchGameData[ STEAM_PS3_PATH_MAX ]; // persistent game data path for storing user data + char m_rgchNpServiceID[ STEAM_PS3_SERVICE_ID_MAX ]; + char m_rgchNpCommunicationID[ STEAM_PS3_COMMUNICATION_ID_MAX ]; + char m_rgchNpCommunicationSig[ STEAM_PS3_COMMUNICATION_SIG_MAX ]; + + // Language should be one of the following. must be zero terminated + // danish + // dutch + // english + // finnish + // french + // german + // italian + // korean + // norwegian + // polish + // portuguese + // russian + // schinese + // spanish + // swedish + // tchinese + char m_rgchSteamLanguage[ STEAM_PS3_LANGUAGE_MAX ]; + + // region codes are "SCEA", "SCEE", "SCEJ". must be zero terminated + char m_rgchRegionCode[ STEAM_PS3_REGION_CODE_MAX ]; + + // Should be SYS_TTYP3 through SYS_TTYP10, if it's 0 then Steam won't spawn a + // thread to read console input at all. Using this let's you use Steam console commands + // like: profile_on, profile_off, profile_dump, mem_stats, mem_validate. + unsigned int m_cSteamInputTTY; + + struct Ps3netInit_t + { + bool m_bNeedInit; + void *m_pMemory; + int m_nMemorySize; + int m_flags; + } m_sysNetInitInfo; + + struct Ps3jpgInit_t + { + bool m_bNeedInit; + } m_sysJpgInitInfo; + + struct Ps3pngInit_t + { + bool m_bNeedInit; + } m_sysPngInitInfo; + + struct Ps3sysutilUserInfo_t + { + bool m_bNeedInit; + } m_sysSysUtilUserInfo; + + bool m_bIncludeNewsPage; +}; + + +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// PlayStation 3 memory structure +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +#define STEAMPS3_MALLOC_INUSE 0x53D04A51 +#define STEAMPS3_MALLOC_SYSTEM 0x0D102C48 +#define STEAMPS3_MALLOC_OK 0xFFD04A51 +struct SteamPS3Memory_t +{ + bool m_bSingleAllocation; // If true, Steam will request one 6MB allocation and use the returned memory for all future allocations + // If false, Steam will make call malloc for each allocation + + // required function pointers + void* (*m_pfMalloc)(size_t); + void* (*m_pfRealloc)(void *, size_t); + void (*m_pfFree)(void *); + size_t (*m_pUsable_size)(void*); +}; + + +#endif // STEAMPS3PARAMS_H diff --git a/public/steam/steamtypes.h b/public/steam/steamtypes.h index 960a2710b..14d3e5a7a 100644 --- a/public/steam/steamtypes.h +++ b/public/steam/steamtypes.h @@ -1,75 +1,179 @@ -//========= Copyright © 1996-2004, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef STEAMTYPES_H -#define STEAMTYPES_H -#ifdef _WIN32 -#pragma once -#endif - -// Steam-specific types. Defined here so this header file can be included in other code bases. -#ifndef WCHARTYPES_H -typedef unsigned char uint8; -#endif - - -#if defined(__x86_64__) || defined(_WIN64) -#define X64BITS -#endif - -typedef unsigned char uint8; -typedef signed char int8; - -#if defined( _WIN32 ) - -typedef __int16 int16; -typedef unsigned __int16 uint16; -typedef __int32 int32; -typedef unsigned __int32 uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; - -#ifdef X64BITS -typedef __int64 intp; // intp is an integer that can accomodate a pointer -typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) -#else -typedef __int32 intp; -typedef unsigned __int32 uintp; -#endif - -#else // _WIN32 - -typedef short int16; -typedef unsigned short uint16; -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; -#ifdef X64BITS -typedef long long intp; -typedef unsigned long long uintp; -#else -typedef int intp; -typedef unsigned int uintp; -#endif - -#endif // else _WIN32 - -const int k_cubDigestSize = 20; // CryptoPP::SHA::DIGESTSIZE -const int k_cubSaltSize = 8; - -typedef uint8 SHADigest_t[ k_cubDigestSize ]; -typedef uint8 Salt_t[ k_cubSaltSize ]; - -typedef uint64 GID_t; // globally unique identifier - -// RTime32 -// We use this 32 bit time representing real world time. -// It offers 1 second resolution beginning on January 1, 1970 (Unix time) -typedef uint32 RTime32; - -#endif // STEAMTYPES_H +//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +//============================================================================= + +#ifndef STEAMTYPES_H +#define STEAMTYPES_H +#ifdef _WIN32 +#pragma once +#endif + +#define S_CALLTYPE __cdecl + +// Steam-specific types. Defined here so this header file can be included in other code bases. +#ifndef WCHARTYPES_H +typedef unsigned char uint8; +#endif + +#if defined( __GNUC__ ) && !defined(POSIX) + #if __GNUC__ < 4 + #error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)" + #endif + #define POSIX 1 +#endif + +#if defined(__x86_64__) || defined(_WIN64) +#define X64BITS +#endif + +// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code. +#if !defined(VALVE_BIG_ENDIAN) && defined(_PS3) +#define VALVE_BIG_ENDIAN +#endif + +typedef unsigned char uint8; +typedef signed char int8; + +#if defined( _WIN32 ) + +typedef __int16 int16; +typedef unsigned __int16 uint16; +typedef __int32 int32; +typedef unsigned __int32 uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; + +typedef int64 lint64; +typedef uint64 ulint64; + +#ifdef X64BITS +typedef __int64 intp; // intp is an integer that can accomodate a pointer +typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) +#else +typedef __int32 intp; +typedef unsigned __int32 uintp; +#endif + +#else // _WIN32 + +typedef short int16; +typedef unsigned short uint16; +typedef int int32; +typedef unsigned int uint32; +typedef long long int64; +typedef unsigned long long uint64; + +// [u]int64 are actually defined as 'long long' and gcc 64-bit +// doesn't automatically consider them the same as 'long int'. +// Changing the types for [u]int64 is complicated by +// there being many definitions, so we just +// define a 'long int' here and use it in places that would +// otherwise confuse the compiler. +typedef long int lint64; +typedef unsigned long int ulint64; + +#ifdef X64BITS +typedef long long intp; +typedef unsigned long long uintp; +#else +typedef int intp; +typedef unsigned int uintp; +#endif + +#endif // else _WIN32 + +#ifdef __clang__ +# define CLANG_ATTR(ATTR) __attribute__((annotate( ATTR ))) +#else +# define CLANG_ATTR(ATTR) +#endif + +#define METHOD_DESC(DESC) CLANG_ATTR( "desc:" #DESC ";" ) +#define IGNOREATTR() CLANG_ATTR( "ignore" ) +#define OUT_STRUCT() CLANG_ATTR( "out_struct: ;" ) +#define OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" ) +#define OUT_ARRAY_COUNT(COUNTER, DESC) CLANG_ATTR( "out_array_count:" #COUNTER ";desc:" #DESC ) +#define ARRAY_COUNT(COUNTER) CLANG_ATTR( "array_count:" #COUNTER ";" ) +#define ARRAY_COUNT_D(COUNTER, DESC) CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC ) +#define BUFFER_COUNT(COUNTER) CLANG_ATTR( "buffer_count:" #COUNTER ";" ) +#define OUT_BUFFER_COUNT(COUNTER) CLANG_ATTR( "out_buffer_count:" #COUNTER ";" ) +#define OUT_STRING_COUNT(COUNTER) CLANG_ATTR( "out_string_count:" #COUNTER ";" ) +#define DESC(DESC) CLANG_ATTR("desc:" #DESC ";") + + +const int k_cubSaltSize = 8; +typedef uint8 Salt_t[ k_cubSaltSize ]; + +//----------------------------------------------------------------------------- +// GID (GlobalID) stuff +// This is a globally unique identifier. It's guaranteed to be unique across all +// racks and servers for as long as a given universe persists. +//----------------------------------------------------------------------------- +// NOTE: for GID parsing/rendering and other utils, see gid.h +typedef uint64 GID_t; + +const GID_t k_GIDNil = 0xffffffffffffffffull; + +// For convenience, we define a number of types that are just new names for GIDs +typedef uint64 JobID_t; // Each Job has a unique ID +typedef GID_t TxnID_t; // Each financial transaction has a unique ID + +const GID_t k_TxnIDNil = k_GIDNil; +const GID_t k_TxnIDUnknown = 0; + +const JobID_t k_JobIDNil = 0xffffffffffffffffull; + +// this is baked into client messages and interfaces as an int, +// make sure we never break this. +typedef uint32 PackageId_t; +const PackageId_t k_uPackageIdFreeSub = 0x0; +const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF; + +typedef uint32 BundleId_t; +const BundleId_t k_uBundleIdInvalid = 0; + +// this is baked into client messages and interfaces as an int, +// make sure we never break this. +typedef uint32 AppId_t; +const AppId_t k_uAppIdInvalid = 0x0; + +typedef uint64 AssetClassId_t; +const AssetClassId_t k_ulAssetClassIdInvalid = 0x0; + +typedef uint32 PhysicalItemId_t; +const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0; + + +// this is baked into client messages and interfaces as an int, +// make sure we never break this. AppIds and DepotIDs also presently +// share the same namespace, but since we'd like to change that in the future +// I've defined it separately here. +typedef uint32 DepotId_t; +const DepotId_t k_uDepotIdInvalid = 0x0; + +// RTime32 +// We use this 32 bit time representing real world time. +// It offers 1 second resolution beginning on January 1, 1970 (Unix time) +typedef uint32 RTime32; + +typedef uint32 CellID_t; +const CellID_t k_uCellIDInvalid = 0xFFFFFFFF; + +// handle to a Steam API call +typedef uint64 SteamAPICall_t; +const SteamAPICall_t k_uAPICallInvalid = 0x0; + +typedef uint32 AccountID_t; + +typedef uint32 PartnerId_t; +const PartnerId_t k_uPartnerIdInvalid = 0; + +// ID for a depot content manifest +typedef uint64 ManifestId_t; +const ManifestId_t k_uManifestIdInvalid = 0; + + + +#endif // STEAMTYPES_H diff --git a/public/steam/steamuniverse.h b/public/steam/steamuniverse.h new file mode 100644 index 000000000..dd384dcc4 --- /dev/null +++ b/public/steam/steamuniverse.h @@ -0,0 +1,27 @@ +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +//============================================================================= + +#ifndef STEAMUNIVERSE_H +#define STEAMUNIVERSE_H +#ifdef _WIN32 +#pragma once +#endif + + +// Steam universes. Each universe is a self-contained Steam instance. +enum EUniverse +{ + k_EUniverseInvalid = 0, + k_EUniversePublic = 1, + k_EUniverseBeta = 2, + k_EUniverseInternal = 3, + k_EUniverseDev = 4, + // k_EUniverseRC = 5, // no such universe anymore + k_EUniverseMax +}; + + +#endif // STEAMUNIVERSE_H diff --git a/public/steam/steamvr_flat.h b/public/steam/steamvr_flat.h new file mode 100644 index 000000000..a521ecb1a --- /dev/null +++ b/public/steam/steamvr_flat.h @@ -0,0 +1,33 @@ +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to user account information in Steam +// +//============================================================================= + +#ifndef STEAMVRFLAT_H +#define STEAMVRFLAT_H +#ifdef _WIN32 +#pragma once +#endif + + + +S_API void SteamAPI_IHmd_GetWindowBounds(intptr_t instancePtr, int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight); +S_API void SteamAPI_IHmd_GetRecommendedRenderTargetSize(intptr_t instancePtr, uint32_t * pnWidth, uint32_t * pnHeight); +S_API void SteamAPI_IHmd_GetEyeOutputViewport(intptr_t instancePtr, vr::Hmd_Eye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight); +S_API struct vr::HmdMatrix44_t SteamAPI_IHmd_GetProjectionMatrix(intptr_t instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType); +S_API void SteamAPI_IHmd_GetProjectionRaw(intptr_t instancePtr, vr::Hmd_Eye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom); +S_API struct vr::DistortionCoordinates_t SteamAPI_IHmd_ComputeDistortion(intptr_t instancePtr, vr::Hmd_Eye eEye, float fU, float fV); +S_API struct vr::HmdMatrix34_t SteamAPI_IHmd_GetHeadFromEyePose(intptr_t instancePtr, vr::Hmd_Eye eEye); +S_API bool SteamAPI_IHmd_GetViewMatrix(intptr_t instancePtr, float fSecondsFromNow, struct vr::HmdMatrix44_t * pMatLeftView, struct vr::HmdMatrix44_t * pMatRightView, vr::HmdTrackingResult * peResult); +S_API int32_t SteamAPI_IHmd_GetD3D9AdapterIndex(intptr_t instancePtr); +S_API void SteamAPI_IHmd_GetDXGIOutputInfo(intptr_t instancePtr, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex); +S_API void SteamAPI_IHmd_AttachToWindow(intptr_t instancePtr, void * hWnd); +S_API bool SteamAPI_IHmd_GetTrackerFromHeadPose(intptr_t instancePtr, float fPredictedSecondsFromNow, struct vr::HmdMatrix34_t * pmPose, vr::HmdTrackingResult * peResult); +S_API bool SteamAPI_IHmd_GetLastTrackerFromHeadPose(intptr_t instancePtr, struct vr::HmdMatrix34_t * pmPose); +S_API bool SteamAPI_IHmd_WillDriftInYaw(intptr_t instancePtr); +S_API void SteamAPI_IHmd_ZeroTracker(intptr_t instancePtr); +S_API struct vr::HmdMatrix34_t SteamAPI_IHmd_GetTrackerZeroPose(intptr_t instancePtr); +S_API uint32_t SteamAPI_IHmd_GetDriverId(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferLen); +S_API uint32_t SteamAPI_IHmd_GetDisplayId(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferLen); +#endif // STEAMVRFLAT_H diff --git a/public/steam/steamvr_interop.cs b/public/steam/steamvr_interop.cs new file mode 100644 index 000000000..15c5e9b07 --- /dev/null +++ b/public/steam/steamvr_interop.cs @@ -0,0 +1,285 @@ +//=== === Copyright 1996-2004, Valve Corporation, All rights reserved. ======= +// +// Purpose: +// +//============================================================================= + +using System; +using System.Runtime.InteropServices; + +namespace Valve.SteamVRInterop +{ + +class NativeEntrypoints +{ + + +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetWindowBounds")] +internal static extern void SteamAPI_IHmd_GetWindowBounds(IntPtr instancePtr, ref int32_t pnX, ref int32_t pnY, ref uint32_t pnWidth, ref uint32_t pnHeight); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetRecommendedRenderTargetSize")] +internal static extern void SteamAPI_IHmd_GetRecommendedRenderTargetSize(IntPtr instancePtr, ref uint32_t pnWidth, ref uint32_t pnHeight); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetEyeOutputViewport")] +internal static extern void SteamAPI_IHmd_GetEyeOutputViewport(IntPtr instancePtr, vr::Hmd_Eye eEye, ref uint32_t pnX, ref uint32_t pnY, ref uint32_t pnWidth, ref uint32_t pnHeight); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetProjectionMatrix")] +internal static extern vr::HmdMatrix44_t SteamAPI_IHmd_GetProjectionMatrix(IntPtr instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetProjectionRaw")] +internal static extern void SteamAPI_IHmd_GetProjectionRaw(IntPtr instancePtr, vr::Hmd_Eye eEye, ref float pfLeft, ref float pfRight, ref float pfTop, ref float pfBottom); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_ComputeDistortion")] +internal static extern vr::DistortionCoordinates_t SteamAPI_IHmd_ComputeDistortion(IntPtr instancePtr, vr::Hmd_Eye eEye, float fU, float fV); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetHeadFromEyePose")] +internal static extern vr::HmdMatrix34_t SteamAPI_IHmd_GetHeadFromEyePose(IntPtr instancePtr, vr::Hmd_Eye eEye); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetViewMatrix")] +internal static extern bool SteamAPI_IHmd_GetViewMatrix(IntPtr instancePtr, float fSecondsFromNow, ref vr::HmdMatrix44_t pMatLeftView, ref vr::HmdMatrix44_t pMatRightView, ref vr::HmdTrackingResult peResult); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetD3D9AdapterIndex")] +internal static extern int32_t SteamAPI_IHmd_GetD3D9AdapterIndex(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetDXGIOutputInfo")] +internal static extern void SteamAPI_IHmd_GetDXGIOutputInfo(IntPtr instancePtr, ref int32_t pnAdapterIndex, ref int32_t pnAdapterOutputIndex); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_AttachToWindow")] +internal static extern void SteamAPI_IHmd_AttachToWindow(IntPtr instancePtr, IntPtr hWnd); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetTrackerFromHeadPose")] +internal static extern bool SteamAPI_IHmd_GetTrackerFromHeadPose(IntPtr instancePtr, float fPredictedSecondsFromNow, ref vr::HmdMatrix34_t pmPose, ref vr::HmdTrackingResult peResult); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetLastTrackerFromHeadPose")] +internal static extern bool SteamAPI_IHmd_GetLastTrackerFromHeadPose(IntPtr instancePtr, ref vr::HmdMatrix34_t pmPose); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_WillDriftInYaw")] +internal static extern bool SteamAPI_IHmd_WillDriftInYaw(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_ZeroTracker")] +internal static extern void SteamAPI_IHmd_ZeroTracker(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetTrackerZeroPose")] +internal static extern vr::HmdMatrix34_t SteamAPI_IHmd_GetTrackerZeroPose(IntPtr instancePtr); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetDriverId")] +internal static extern uint32_t SteamAPI_IHmd_GetDriverId(IntPtr instancePtr, string pchBuffer, uint32_t unBufferLen); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetDisplayId")] +internal static extern uint32_t SteamAPI_IHmd_GetDisplayId(IntPtr instancePtr, string pchBuffer, uint32_t unBufferLen); + +} + + +public abstract class IHmd +{ +public abstract void GetWindowBounds(out int32_t pnX,out int32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight); +public abstract void GetRecommendedRenderTargetSize(out uint32_t pnWidth,out uint32_t pnHeight); +public abstract void GetEyeOutputViewport(vr::Hmd_Eye eEye,out uint32_t pnX,out uint32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight); +public abstract vr::HmdMatrix44_t GetProjectionMatrix(vr::Hmd_Eye eEye,float fNearZ,float fFarZ,vr::GraphicsAPIConvention eProjType); +public abstract void GetProjectionRaw(vr::Hmd_Eye eEye,out float pfLeft,out float pfRight,out float pfTop,out float pfBottom); +public abstract vr::DistortionCoordinates_t ComputeDistortion(vr::Hmd_Eye eEye,float fU,float fV); +public abstract vr::HmdMatrix34_t GetHeadFromEyePose(vr::Hmd_Eye eEye); +public abstract bool GetViewMatrix(float fSecondsFromNow,out vr::HmdMatrix44_t pMatLeftView,out vr::HmdMatrix44_t pMatRightView,out vr::HmdTrackingResult peResult); +public abstract int32_t GetD3D9AdapterIndex(); +public abstract void GetDXGIOutputInfo(out int32_t pnAdapterIndex,out int32_t pnAdapterOutputIndex); +public abstract void AttachToWindow(IntPtr hWnd); +public abstract bool GetTrackerFromHeadPose(float fPredictedSecondsFromNow,out vr::HmdMatrix34_t pmPose,out vr::HmdTrackingResult peResult); +public abstract bool GetLastTrackerFromHeadPose(out vr::HmdMatrix34_t pmPose); +public abstract bool WillDriftInYaw(); +public abstract void ZeroTracker(); +public abstract vr::HmdMatrix34_t GetTrackerZeroPose(); +public abstract uint32_t GetDriverId(string pchBuffer,uint32_t unBufferLen); +public abstract uint32_t GetDisplayId(string pchBuffer,uint32_t unBufferLen); +} + + +public class CHmd : IHmd +{ +public CHmd(IntPtr hmd) +{ + m_hmd = hmd; +} +IntPtr m_hmd; + +private void CheckIfUsable() +{ + if (m_hmd == IntPtr.Zero) + { + throw new Exception("Steam Pointer not configured"); + } +} +public override void GetWindowBounds(out int32_t pnX,out int32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_IHmd_GetWindowBounds(m_hmd,ref pnX,ref pnY,ref pnWidth,ref pnHeight); +} +public override void GetRecommendedRenderTargetSize(out uint32_t pnWidth,out uint32_t pnHeight) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_IHmd_GetRecommendedRenderTargetSize(m_hmd,ref pnWidth,ref pnHeight); +} +public override void GetEyeOutputViewport(vr::Hmd_Eye eEye,out uint32_t pnX,out uint32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_IHmd_GetEyeOutputViewport(m_hmd,eEye,ref pnX,ref pnY,ref pnWidth,ref pnHeight); +} +public override vr::HmdMatrix44_t GetProjectionMatrix(vr::Hmd_Eye eEye,float fNearZ,float fFarZ,vr::GraphicsAPIConvention eProjType) +{ + CheckIfUsable(); + vr::HmdMatrix44_t result = NativeEntrypoints.SteamAPI_IHmd_GetProjectionMatrix(m_hmd,eEye,fNearZ,fFarZ,eProjType); + return result; +} +public override void GetProjectionRaw(vr::Hmd_Eye eEye,out float pfLeft,out float pfRight,out float pfTop,out float pfBottom) +{ + CheckIfUsable(); + pfLeft = 0; + pfRight = 0; + pfTop = 0; + pfBottom = 0; + NativeEntrypoints.SteamAPI_IHmd_GetProjectionRaw(m_hmd,eEye,ref pfLeft,ref pfRight,ref pfTop,ref pfBottom); +} +public override vr::DistortionCoordinates_t ComputeDistortion(vr::Hmd_Eye eEye,float fU,float fV) +{ + CheckIfUsable(); + vr::DistortionCoordinates_t result = NativeEntrypoints.SteamAPI_IHmd_ComputeDistortion(m_hmd,eEye,fU,fV); + return result; +} +public override vr::HmdMatrix34_t GetHeadFromEyePose(vr::Hmd_Eye eEye) +{ + CheckIfUsable(); + vr::HmdMatrix34_t result = NativeEntrypoints.SteamAPI_IHmd_GetHeadFromEyePose(m_hmd,eEye); + return result; +} +public override bool GetViewMatrix(float fSecondsFromNow,out vr::HmdMatrix44_t pMatLeftView,out vr::HmdMatrix44_t pMatRightView,out vr::HmdTrackingResult peResult) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_IHmd_GetViewMatrix(m_hmd,fSecondsFromNow,ref pMatLeftView,ref pMatRightView,ref peResult); + return result; +} +public override int32_t GetD3D9AdapterIndex() +{ + CheckIfUsable(); + int32_t result = NativeEntrypoints.SteamAPI_IHmd_GetD3D9AdapterIndex(m_hmd); + return result; +} +public override void GetDXGIOutputInfo(out int32_t pnAdapterIndex,out int32_t pnAdapterOutputIndex) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_IHmd_GetDXGIOutputInfo(m_hmd,ref pnAdapterIndex,ref pnAdapterOutputIndex); +} +public override void AttachToWindow(IntPtr hWnd) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_IHmd_AttachToWindow(m_hmd,hWnd); +} +public override bool GetTrackerFromHeadPose(float fPredictedSecondsFromNow,out vr::HmdMatrix34_t pmPose,out vr::HmdTrackingResult peResult) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_IHmd_GetTrackerFromHeadPose(m_hmd,fPredictedSecondsFromNow,ref pmPose,ref peResult); + return result; +} +public override bool GetLastTrackerFromHeadPose(out vr::HmdMatrix34_t pmPose) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_IHmd_GetLastTrackerFromHeadPose(m_hmd,ref pmPose); + return result; +} +public override bool WillDriftInYaw() +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_IHmd_WillDriftInYaw(m_hmd); + return result; +} +public override void ZeroTracker() +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_IHmd_ZeroTracker(m_hmd); +} +public override vr::HmdMatrix34_t GetTrackerZeroPose() +{ + CheckIfUsable(); + vr::HmdMatrix34_t result = NativeEntrypoints.SteamAPI_IHmd_GetTrackerZeroPose(m_hmd); + return result; +} +public override uint32_t GetDriverId(string pchBuffer,uint32_t unBufferLen) +{ + CheckIfUsable(); + uint32_t result = NativeEntrypoints.SteamAPI_IHmd_GetDriverId(m_hmd,pchBuffer,unBufferLen); + return result; +} +public override uint32_t GetDisplayId(string pchBuffer,uint32_t unBufferLen) +{ + CheckIfUsable(); + uint32_t result = NativeEntrypoints.SteamAPI_IHmd_GetDisplayId(m_hmd,pchBuffer,unBufferLen); + return result; +} +} + + +public class SteamVRInterop +{ +[DllImportAttribute("Steam_api", EntryPoint = "VR_Init")] +internal static extern IntPtr VR_Init(out HmdError peError); +[DllImportAttribute("Steam_api", EntryPoint = "VR_Shutdown")] +internal static extern void VR_Shutdown(); +[DllImportAttribute("Steam_api", EntryPoint = "VR_IsHmdPresent")] +internal static extern bool VR_IsHmdPresent(); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_UnregisterCallback")] +internal static extern string VR_GetStringForHmdError(HmdError error); +[DllImportAttribute("Steam_api", EntryPoint = "Hmd")] +internal static extern IntPtr Hmd(); +} + + +public enum Hmd_Eye +{ + Eye_Left = 0, + Eye_Right = 1, +} +public enum GraphicsAPIConvention +{ + API_DirectX = 0, + API_OpenGL = 1, +} +public enum HmdTrackingResult +{ + TrackingResult_Uninitialized = 1, + TrackingResult_Calibrating_InProgress = 100, + TrackingResult_Calibrating_OutOfRange = 101, + TrackingResult_Running_OK = 200, + TrackingResult_Running_OutOfRange = 201, +} +public enum HmdError +{ + HmdError_None = 0, + HmdError_Init_InstallationNotFound = 100, + HmdError_Init_InstallationCorrupt = 101, + HmdError_Init_VRClientDLLNotFound = 102, + HmdError_Init_FileNotFound = 103, + HmdError_Init_FactoryNotFound = 104, + HmdError_Init_InterfaceNotFound = 105, + HmdError_Init_InvalidInterface = 106, + HmdError_Init_UserConfigDirectoryInvalid = 107, + HmdError_Init_HmdNotFound = 108, + HmdError_Init_NotInitialized = 109, + HmdError_Driver_Failed = 200, + HmdError_Driver_Unknown = 201, + HmdError_Driver_HmdUnknown = 202, + HmdError_Driver_NotLoaded = 203, + HmdError_IPC_ServerInitFailed = 300, + HmdError_IPC_ConnectFailed = 301, + HmdError_IPC_SharedStateInitFailed = 302, + HmdError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, +} +[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix34_t +{ + public float m; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix44_t +{ + public float m; +} +[StructLayout(LayoutKind.Sequential)] public struct DistortionCoordinates_t +{ + public float rfRed; + public float rfGreen; + public float rfBlue; +} + +public class SteamVR +{ +public static IHMD Init(out HmdError peError) +{ + return new CHMD(VR_Init(out peError)); +} + +} + + + +} + diff --git a/public/studio.cpp b/public/studio.cpp index f303fdb69..37b4ee9b2 100644 --- a/public/studio.cpp +++ b/public/studio.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -10,6 +10,8 @@ #include "datacache/idatacache.h" #include "datacache/imdlcache.h" #include "convar.h" +#include "tier1/utlmap.h" +#include "tier0/vprof.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -40,24 +42,24 @@ mstudioanimdesc_t &studiohdr_t::pAnimdesc( int i ) const // Purpose: //----------------------------------------------------------------------------- -mstudioanim_t *mstudioanimdesc_t::pAnimBlock( int block, int index ) const +byte *mstudioanimdesc_t::pAnimBlock( int block, int index ) const { if (block == -1) { - return (mstudioanim_t *)NULL; + return (byte *)NULL; } if (block == 0) { - return (mstudioanim_t *)(((byte *)this) + index); + return (((byte *)this) + index); } byte *pAnimBlock = pStudiohdr()->GetAnimBlock( block ); if ( pAnimBlock ) { - return (mstudioanim_t *)(pAnimBlock + index); + return pAnimBlock + index; } - return (mstudioanim_t *)NULL; + return (byte *)NULL; } //----------------------------------------------------------------------------- @@ -65,15 +67,15 @@ mstudioanim_t *mstudioanimdesc_t::pAnimBlock( int block, int index ) const //----------------------------------------------------------------------------- static ConVar mod_load_showstall( "mod_load_showstall", "0", 0, "1 - show hitches , 2 - show stalls" ); -mstudioanim_t *mstudioanimdesc_t::pAnim( int *piFrame ) const +byte *mstudioanimdesc_t::pAnim( int *piFrame ) const { float flStall; return pAnim( piFrame, flStall ); } -mstudioanim_t *mstudioanimdesc_t::pAnim( int *piFrame, float &flStall ) const +byte *mstudioanimdesc_t::pAnim( int *piFrame, float &flStall ) const { - mstudioanim_t *panim = NULL; + byte *panim = NULL; int block = animblock; int index = animindex; @@ -176,23 +178,27 @@ mstudioanim_t *mstudioanimdesc_t::pAnim( int *piFrame, float &flStall ) const mstudioikrule_t *mstudioanimdesc_t::pIKRule( int i ) const { - if (ikruleindex) + if (numikrules) { - return (mstudioikrule_t *)(((byte *)this) + ikruleindex) + i; - } - else if (animblockikruleindex) - { - if (animblock == 0) + if (ikruleindex) { - return (mstudioikrule_t *)(((byte *)this) + animblockikruleindex) + i; + return (mstudioikrule_t *)(((byte *)this) + ikruleindex) + i; } - else + else { - byte *pAnimBlocks = pStudiohdr()->GetAnimBlock( animblock ); - - if ( pAnimBlocks ) + if (animblock == 0) { - return (mstudioikrule_t *)(pAnimBlocks + animblockikruleindex) + i; + AssertOnce(0); // Should never happen + return (mstudioikrule_t *)(((byte *)this) + animblockikruleindex) + i; + } + else + { + byte *pAnimBlock = pStudiohdr()->GetAnimBlock( animblock ); + + if ( pAnimBlock ) + { + return (mstudioikrule_t *)(pAnimBlock + animblockikruleindex) + i; + } } } } @@ -211,11 +217,11 @@ mstudiolocalhierarchy_t *mstudioanimdesc_t::pHierarchy( int i ) const } else { - byte *pAnimBlocks = pStudiohdr()->GetAnimBlock( animblock ); + byte *pAnimBlock = pStudiohdr()->GetAnimBlock( animblock ); - if ( pAnimBlocks ) + if ( pAnimBlock ) { - return (mstudiolocalhierarchy_t *)(pAnimBlocks + localhierarchyindex) + i; + return (mstudiolocalhierarchy_t *)(pAnimBlock + localhierarchyindex) + i; } } } @@ -342,7 +348,7 @@ int studiohdr_t::GetNumPoseParameters( void ) const // Purpose: //----------------------------------------------------------------------------- -const mstudioposeparamdesc_t &studiohdr_t::pPoseParameter( int i ) const +const mstudioposeparamdesc_t &studiohdr_t::pPoseParameter( int i ) { if (numincludemodels == 0) { @@ -391,7 +397,7 @@ int studiohdr_t::GetSharedPoseParameter( int iSequence, int iLocalPose ) const // Purpose: //----------------------------------------------------------------------------- -int studiohdr_t::EntryNode( int iSequence ) const +int studiohdr_t::EntryNode( int iSequence ) { mstudioseqdesc_t &seqdesc = pSeqdesc( iSequence ); @@ -414,7 +420,7 @@ int studiohdr_t::EntryNode( int iSequence ) const //----------------------------------------------------------------------------- -int studiohdr_t::ExitNode( int iSequence ) const +int studiohdr_t::ExitNode( int iSequence ) { mstudioseqdesc_t &seqdesc = pSeqdesc( iSequence ); @@ -476,7 +482,7 @@ const mstudioattachment_t &studiohdr_t::pAttachment( int i ) const // Purpose: //----------------------------------------------------------------------------- -int studiohdr_t::GetAttachmentBone( int i ) const +int studiohdr_t::GetAttachmentBone( int i ) { const mstudioattachment_t &attachment = pAttachment( i ); @@ -516,7 +522,7 @@ void studiohdr_t::SetAttachmentBone( int iAttachment, int iBone ) // Purpose: //----------------------------------------------------------------------------- -const char *studiohdr_t::pszNodeName( int iNode ) const +char *studiohdr_t::pszNodeName( int iNode ) { if (numincludemodels == 0) { @@ -555,7 +561,7 @@ int studiohdr_t::GetTransition( int iFrom, int iTo ) const } -int studiohdr_t::GetActivityListVersion( void ) const +int studiohdr_t::GetActivityListVersion( void ) { if (numincludemodels == 0) { @@ -624,7 +630,7 @@ int studiohdr_t::GetNumIKAutoplayLocks( void ) const return pVModel->m_iklock.Count(); } -const mstudioiklock_t &studiohdr_t::pIKAutoplayLock( int i ) const +const mstudioiklock_t &studiohdr_t::pIKAutoplayLock( int i ) { if (numincludemodels == 0) { @@ -744,20 +750,9 @@ void CStudioHdr::Init( const studiohdr_t *pStudioHdr, IMDLCache *mdlcache ) m_nFrameUnlockCounter = *m_pFrameUnlockCounter - 1; } - if (m_pStudioHdr->numincludemodels == 0) - { -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE -#else - m_ActivityToSequence.Initialize(this); -#endif - } - else + if (m_pStudioHdr->numincludemodels != 0) { ResetVModel( m_pStudioHdr->GetVirtualModel() ); -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE -#else - m_ActivityToSequence.Initialize(this); -#endif } m_boneFlags.EnsureCount( numbones() ); @@ -767,10 +762,14 @@ void CStudioHdr::Init( const studiohdr_t *pStudioHdr, IMDLCache *mdlcache ) m_boneFlags[i] = pBone( i )->flags; m_boneParent[i] = pBone( i )->parent; } + + m_pActivityToSequence = NULL; } void CStudioHdr::Term() { + CActivityToSequenceMapping::ReleaseMapping( m_pActivityToSequence ); + m_pActivityToSequence = NULL; } //----------------------------------------------------------------------------- @@ -799,9 +798,6 @@ const virtualmodel_t * CStudioHdr::ResetVModel( const virtualmodel_t *pVModel ) if (pVModel != NULL) { m_pVModel = (virtualmodel_t *)pVModel; - #if defined(_WIN32) && !defined(THREAD_PROFILER) - Assert( !pVModel->m_Lock.GetOwnerId() ); - #endif m_pStudioHdrCache.SetCount( m_pVModel->m_group.Count() ); int i; @@ -819,7 +815,7 @@ const virtualmodel_t * CStudioHdr::ResetVModel( const virtualmodel_t *pVModel ) } } -const studiohdr_t *CStudioHdr::GroupStudioHdr( int i ) const +const studiohdr_t *CStudioHdr::GroupStudioHdr( int i ) { if ( !this ) { @@ -840,7 +836,7 @@ const studiohdr_t *CStudioHdr::GroupStudioHdr( int i ) const if ( !m_pStudioHdrCache.IsValidIndex( i ) ) { const char *pszName = ( m_pStudioHdr ) ? m_pStudioHdr->pszName() : "<>"; - ExecuteNTimes( 5, Warning( "Invalid index passed to CStudioHdr(%s)::GroupStudioHdr(): %d, but max is %d [%d]\n", pszName, i, m_pStudioHdrCache.Count() ) ); + ExecuteNTimes( 5, Warning( "Invalid index passed to CStudioHdr(%s)::GroupStudioHdr(): %d [%d]\n", pszName, i, m_pStudioHdrCache.Count() ) ); DebuggerBreakIfDebugging(); return m_pStudioHdr; // return something known to probably exist, certainly things will be messed up, but hopefully not crash before the warning is noticed } @@ -849,9 +845,6 @@ const studiohdr_t *CStudioHdr::GroupStudioHdr( int i ) const if (pStudioHdr == NULL) { - #if defined(_WIN32) && !defined(THREAD_PROFILER) - Assert( !m_pVModel->m_Lock.GetOwnerId() ); - #endif virtualgroup_t *pGroup = &m_pVModel->m_group[ i ]; pStudioHdr = pGroup->GetStudioHdr(); m_pStudioHdrCache[ i ] = pStudioHdr; @@ -862,7 +855,7 @@ const studiohdr_t *CStudioHdr::GroupStudioHdr( int i ) const } -const studiohdr_t *CStudioHdr::pSeqStudioHdr( int sequence ) const +const studiohdr_t *CStudioHdr::pSeqStudioHdr( int sequence ) { if (m_pVModel == NULL) { @@ -875,7 +868,7 @@ const studiohdr_t *CStudioHdr::pSeqStudioHdr( int sequence ) const } -const studiohdr_t *CStudioHdr::pAnimStudioHdr( int animation ) const +const studiohdr_t *CStudioHdr::pAnimStudioHdr( int animation ) { if (m_pVModel == NULL) { @@ -889,7 +882,7 @@ const studiohdr_t *CStudioHdr::pAnimStudioHdr( int animation ) const -mstudioanimdesc_t &CStudioHdr::pAnimdesc( int i ) const +mstudioanimdesc_t &CStudioHdr::pAnimdesc( int i ) { if (m_pVModel == NULL) { @@ -919,7 +912,7 @@ int CStudioHdr::GetNumSeq( void ) const // Purpose: //----------------------------------------------------------------------------- -mstudioseqdesc_t &CStudioHdr::pSeqdesc( int i ) const +mstudioseqdesc_t &CStudioHdr::pSeqdesc( int i ) { Assert( i >= 0 && i < GetNumSeq() ); if ( i < 0 || i >= GetNumSeq() ) @@ -995,7 +988,7 @@ int CStudioHdr::GetNumPoseParameters( void ) const // Purpose: //----------------------------------------------------------------------------- -const mstudioposeparamdesc_t &CStudioHdr::pPoseParameter( int i ) const +const mstudioposeparamdesc_t &CStudioHdr::pPoseParameter( int i ) { if (m_pVModel == NULL) { @@ -1037,7 +1030,7 @@ int CStudioHdr::GetSharedPoseParameter( int iSequence, int iLocalPose ) const // Purpose: //----------------------------------------------------------------------------- -int CStudioHdr::EntryNode( int iSequence ) const +int CStudioHdr::EntryNode( int iSequence ) { mstudioseqdesc_t &seqdesc = pSeqdesc( iSequence ); @@ -1059,7 +1052,7 @@ int CStudioHdr::EntryNode( int iSequence ) const //----------------------------------------------------------------------------- -int CStudioHdr::ExitNode( int iSequence ) const +int CStudioHdr::ExitNode( int iSequence ) { mstudioseqdesc_t &seqdesc = pSeqdesc( iSequence ); @@ -1098,7 +1091,7 @@ int CStudioHdr::GetNumAttachments( void ) const // Purpose: //----------------------------------------------------------------------------- -const mstudioattachment_t &CStudioHdr::pAttachment( int i ) const +const mstudioattachment_t &CStudioHdr::pAttachment( int i ) { if (m_pVModel == NULL) { @@ -1116,7 +1109,7 @@ const mstudioattachment_t &CStudioHdr::pAttachment( int i ) const // Purpose: //----------------------------------------------------------------------------- -int CStudioHdr::GetAttachmentBone( int i ) const +int CStudioHdr::GetAttachmentBone( int i ) { if (m_pVModel == 0) { @@ -1153,7 +1146,7 @@ void CStudioHdr::SetAttachmentBone( int iAttachment, int iBone ) // Purpose: //----------------------------------------------------------------------------- -const char *CStudioHdr::pszNodeName( int iNode ) const +char *CStudioHdr::pszNodeName( int iNode ) { if (m_pVModel == NULL) { @@ -1194,7 +1187,7 @@ int CStudioHdr::GetTransition( int iFrom, int iTo ) const // Purpose: //----------------------------------------------------------------------------- -int CStudioHdr::GetActivityListVersion( void ) const +int CStudioHdr::GetActivityListVersion( void ) { if (m_pVModel == NULL) { @@ -1237,7 +1230,7 @@ void CStudioHdr::SetActivityListVersion( int version ) // Purpose: //----------------------------------------------------------------------------- -int CStudioHdr::GetEventListVersion( void ) const +int CStudioHdr::GetEventListVersion( void ) { if (m_pVModel == NULL) { @@ -1290,7 +1283,7 @@ int CStudioHdr::GetNumIKAutoplayLocks( void ) const return m_pVModel->m_iklock.Count(); } -const mstudioiklock_t &CStudioHdr::pIKAutoplayLock( int i ) const +const mstudioiklock_t &CStudioHdr::pIKAutoplayLock( int i ) { if (m_pVModel == NULL) { @@ -1360,15 +1353,11 @@ int CStudioHdr::RemapAnimBone( int iAnim, int iLocalBone ) const return iLocalBone; } -// JasonM hack -//ConVar flex_maxrule( "flex_maxrule", "0" ); - - //----------------------------------------------------------------------------- // Purpose: run the interpreted FAC's expressions, converting flex_controller // values into FAC weights //----------------------------------------------------------------------------- -void CStudioHdr::RunFlexRules( const float *src, float *dest ) +void CStudioHdr::RunFlexRulesOld( const float *src, float *dest ) { int i, j; @@ -1385,16 +1374,7 @@ void CStudioHdr::RunFlexRules( const float *src, float *dest ) mstudioflexrule_t *prule = pFlexRule( i ); mstudioflexop_t *pops = prule->iFlexOp( 0 ); -/* - // JasonM hack for flex perf testing... - int nFlexRulesToRun = 0; // 0 means run them all - const char *pszExpression = flex_maxrule.GetString(); - if ( pszExpression ) - { - nFlexRulesToRun = atoi(pszExpression); // 0 will be returned if not a numeric string - } - // end JasonM hack -//*/ + // debugoverlay->AddTextOverlay( GetAbsOrigin() + Vector( 0, 0, 64 ), i + 1, 0, "%2d:%d\n", i, prule->flex ); for (j = 0; j < prule->numops; j++) @@ -1576,71 +1556,315 @@ void CStudioHdr::RunFlexRules( const float *src, float *dest ) } dest[prule->flex] = stack[0]; -/* - // JasonM hack - if ( nFlexRulesToRun == 0) // 0 means run all rules correctly - { - dest[prule->flex] = stack[0]; - } - else // run only up to nFlexRulesToRun correctly...zero out the rest - { - if ( j < nFlexRulesToRun ) - dest[prule->flex] = stack[0]; - else - dest[prule->flex] = 0.0f; - } + } +} + +void CStudioHdr::RunFlexRulesNew( const float *src, float *dest ) +{ + // FIXME: this shouldn't be needed, flex without rules should be stripped in studiomdl + memset( dest, 0, sizeof( dest[0] ) * numflexdesc() ); + + for (int i = 0; i < numflexrules(); i++) + { + float stack[32]; + float *pSP = stack + ARRAYSIZE( stack ); + mstudioflexrule_t *prule = pFlexRule( i ); + + mstudioflexop_t *pops = prule->iFlexOp( 0 ); + + int nOps = prule->numops; + float flTOS = 0.; + if ( nOps ) + do + { + switch (pops->op) + { + case STUDIO_ADD: + flTOS += *(pSP++); + break; + + case STUDIO_SUB: + flTOS = *(pSP++) - flTOS; + break; + + case STUDIO_MUL: + flTOS *= *(pSP++); + break; + case STUDIO_DIV: + if (flTOS > 0.0001) + { + flTOS = *(pSP) / flTOS; + } + else + { + flTOS = 0.; + } + pSP++; + break; + + case STUDIO_NEG: + flTOS = -flTOS; + break; + + case STUDIO_MAX: + { + float flNos = *(pSP++); + flTOS = MAX( flTOS, flNos ); + break; + } + + case STUDIO_MIN: + { + float flNos = *(pSP++); + flTOS = MIN( flTOS, flNos); + break; + } + case STUDIO_CONST: + *(--pSP) = flTOS; + flTOS = pops->d.value; + break; + + case STUDIO_FETCH1: + { + *(--pSP ) = flTOS; + int m = pFlexcontroller( (LocalFlexController_t)pops->d.index)->localToGlobal; + flTOS = src[m]; + break; + } + + case STUDIO_FETCH2: + { + *(--pSP) = flTOS; + flTOS = dest[pops->d.index]; + break; + } + case STUDIO_COMBO: + { + // tos = prod( top m elements on stack) + int m = pops->d.index; + while( --m ) + { + flTOS *= *(pSP++); + } + break; + } + break; + + case STUDIO_DOMINATE: + { + // tos *= 1-prod( next top m elements on stack) + int m = pops->d.index; + float dv = *(pSP++); + while( --m ) + { + dv *= *(pSP++); + } + flTOS *= 1.0 - dv; + break; + } + break; + case STUDIO_2WAY_0: + { + int m = pFlexcontroller( (LocalFlexController_t)pops->d.index )->localToGlobal; + *(--pSP) = flTOS; + flTOS = RemapValClamped( src[m], -1.0f, 0.0f, 1.0f, 0.0f ); + } + break; + + case STUDIO_2WAY_1: + { + int m = pFlexcontroller( (LocalFlexController_t)pops->d.index )->localToGlobal; + *(--pSP) = flTOS; + flTOS = RemapValClamped( src[m], 0.0f, 1.0f, 0.0f, 1.0f ); + } + break; + + case STUDIO_NWAY: + { + LocalFlexController_t valueControllerIndex = static_cast< LocalFlexController_t >( (int) flTOS ); + int m = pFlexcontroller( valueControllerIndex )->localToGlobal; + float flValue = src[ m ]; + int v = pFlexcontroller( (LocalFlexController_t)pops->d.index )->localToGlobal; + + const Vector4D filterRamp( pSP[3], pSP[2], pSP[1], pSP[0] ); + + // Apply multicontrol remapping + if ( flValue <= filterRamp.x || flValue >= filterRamp.w ) + { + flValue = 0.0f; + } + else if ( flValue < filterRamp.y ) + { + flValue = RemapValClamped( flValue, filterRamp.x, filterRamp.y, 0.0f, 1.0f ); + } + else if ( flValue > filterRamp.z ) + { + flValue = RemapValClamped( flValue, filterRamp.z, filterRamp.w, 1.0f, 0.0f ); + } + else + { + flValue = 1.0f; + } + + pSP+= 4; + flTOS = flValue * src[ v ]; + } + break; + + case STUDIO_DME_LOWER_EYELID: + { + const mstudioflexcontroller_t *const pCloseLidV = + pFlexcontroller( (LocalFlexController_t)pops->d.index ); + const float flCloseLidV = + RemapValClamped( src[ pCloseLidV->localToGlobal ], pCloseLidV->min, pCloseLidV->max, 0.0f, 1.0f ); + + const mstudioflexcontroller_t *const pCloseLid = + pFlexcontroller( static_cast< LocalFlexController_t >( (int)flTOS ) ); + const float flCloseLid = + RemapValClamped( src[ pCloseLid->localToGlobal ], pCloseLid->min, pCloseLid->max, 0.0f, 1.0f ); + + int nBlinkIndex = static_cast< int >( pSP[0] ); + float flBlink = 0.0f; + if ( nBlinkIndex >= 0 ) + { + const mstudioflexcontroller_t *const pBlink = + pFlexcontroller( static_cast< LocalFlexController_t >( nBlinkIndex ) ); + flBlink = RemapValClamped( src[ pBlink->localToGlobal ], pBlink->min, pBlink->max, 0.0f, 1.0f ); + } + + int nEyeUpDownIndex = static_cast< int >( pSP[1] ); + float flEyeUpDown = 0.0f; + if ( nEyeUpDownIndex >= 0 ) + { + const mstudioflexcontroller_t *const pEyeUpDown = + pFlexcontroller( static_cast< LocalFlexController_t >( nEyeUpDownIndex ) ); + flEyeUpDown = RemapValClamped( src[ pEyeUpDown->localToGlobal ], pEyeUpDown->min, pEyeUpDown->max, -1.0f, 1.0f ); + } + + if ( flEyeUpDown > 0.0 ) + { + flTOS = ( 1.0f - flEyeUpDown ) * ( 1.0f - flCloseLidV ) * flCloseLid; + } + else + { + flTOS = ( 1.0f - flCloseLidV ) * flCloseLid; + } + pSP += 2; + } + break; + + case STUDIO_DME_UPPER_EYELID: + { + const mstudioflexcontroller_t *const pCloseLidV = pFlexcontroller( (LocalFlexController_t)pops->d.index ); + const float flCloseLidV = RemapValClamped( src[ pCloseLidV->localToGlobal ], pCloseLidV->min, pCloseLidV->max, 0.0f, 1.0f ); + + const mstudioflexcontroller_t *const pCloseLid = pFlexcontroller( static_cast< LocalFlexController_t >( (int)flTOS ) ); + const float flCloseLid = RemapValClamped( src[ pCloseLid->localToGlobal ], pCloseLid->min, pCloseLid->max, 0.0f, 1.0f ); + + int nBlinkIndex = static_cast< int >( pSP[0] ); + float flBlink = 0.0f; + if ( nBlinkIndex >= 0 ) + { + const mstudioflexcontroller_t *const pBlink = pFlexcontroller( static_cast< LocalFlexController_t >( nBlinkIndex ) ); + flBlink = RemapValClamped( src[ pBlink->localToGlobal ], pBlink->min, pBlink->max, 0.0f, 1.0f ); + } + + int nEyeUpDownIndex = static_cast< int >( pSP[1] ); + float flEyeUpDown = 0.0f; + if ( nEyeUpDownIndex >= 0 ) + { + const mstudioflexcontroller_t *const pEyeUpDown = pFlexcontroller( static_cast< LocalFlexController_t >( nEyeUpDownIndex ) ); + flEyeUpDown = RemapValClamped( src[ pEyeUpDown->localToGlobal ], pEyeUpDown->min, pEyeUpDown->max, -1.0f, 1.0f ); + } + + if ( flEyeUpDown < 0.0f ) + { + flTOS = ( 1.0f + flEyeUpDown ) * flCloseLidV * flCloseLid; + } + else + { + flTOS = flCloseLidV * flCloseLid; + } + pSP += 2; + } + break; + } + + pops++; + } while( --nOps ); + dest[prule->flex] = flTOS; + } +} + +#define USE_OLD_FLEX_RULES_INTERPRETER + +void CStudioHdr::RunFlexRules( const float *src, float *dest ) +{ +#ifndef USE_OLD_FLEX_RULES_INTERPRETER + RunFlexRulesNew( src, dest ); +#else + RunFlexRulesOld( src, dest ); +#endif - dest[prule->flex] = 1.0f; -//*/ - // end JasonM hack +#if defined(_DEBUG) && !defined(USE_OLD_FLEX_RULES_INTERPRETER) + float d1[ MAXSTUDIOFLEXDESC ]; + RunFlexRulesOld( src, d1 ); + for ( int i =0; i < numflexdesc(); i++) + { + if ( fabs( d1[i] - dest[i] ) > 0.001 ) + { + Warning("bad %d old =%f new=%f\n", i, dest[i], d1[i] ); + } } +#endif // _DEBUG } + //----------------------------------------------------------------------------- // CODE PERTAINING TO ACTIVITY->SEQUENCE MAPPING SUBCLASS //----------------------------------------------------------------------------- #define iabs(i) (( (i) >= 0 ) ? (i) : -(i) ) +CUtlSymbolTable g_ActivityModifiersTable; extern void SetActivityForSequence( CStudioHdr *pstudiohdr, int i ); -void CStudioHdr::CActivityToSequenceMapping::Initialize( CStudioHdr * __restrict pstudiohdr ) +void CStudioHdr::CActivityToSequenceMapping::Initialize( const CStudioHdr * __restrict pstudiohdr ) { + VPROF( "CStudioHdr::CActivityToSequenceMapping::Initialize" ); // Algorithm: walk through every sequence in the model, determine to which activity // it corresponds, and keep a count of sequences per activity. Once the total count // is available, allocate an array large enough to contain them all, update the // starting indices for every activity's section in the array, and go back through, // populating the array with its data. + m_pStudioHdr = pstudiohdr->m_pStudioHdr; + AssertMsg1( m_pSequenceTuples == NULL, "Tried to double-initialize sequence mapping for %s", pstudiohdr->pszName() ); if ( m_pSequenceTuples != NULL ) return; // don't double initialize. - SetValidationPair(pstudiohdr); + SetValidation(pstudiohdr); if ( ! pstudiohdr->SequencesAvailable() ) return; // nothing to do. -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE - m_bIsInitialized = true; -#endif - // Some studio headers have no activities at all. In those // cases we can avoid a lot of this effort. - bool bFoundOne = false; + bool bFoundOne = false; // for each sequence in the header... const int NumSeq = pstudiohdr->GetNumSeq(); for ( int i = 0 ; i < NumSeq ; ++i ) { - const mstudioseqdesc_t &seqdesc = pstudiohdr->pSeqdesc( i ); + const mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pstudiohdr)->pSeqdesc( i ); #if defined(SERVER_DLL) || defined(CLIENT_DLL) || defined(GAME_DLL) if (!(seqdesc.flags & STUDIO_ACTIVITY)) { // AssertMsg2( false, "Sequence %d on studiohdr %s didn't have its activity initialized!", i, pstudiohdr->pszName() ); - SetActivityForSequence( pstudiohdr, i ); + SetActivityForSequence( (CStudioHdr *)pstudiohdr, i ); } #endif @@ -1710,7 +1934,7 @@ void CStudioHdr::CActivityToSequenceMapping::Initialize( CStudioHdr * __restrict // our little table. for ( int i = 0 ; i < NumSeq ; ++i ) { - const mstudioseqdesc_t &seqdesc = pstudiohdr->pSeqdesc( i ); + const mstudioseqdesc_t &seqdesc = ((CStudioHdr *)pstudiohdr)->pSeqdesc( i ); if (seqdesc.activity >= 0) { const HashValueType &element = m_ActToSeqHash[m_ActToSeqHash.Find(HashValueType(seqdesc.activity, 0, 0, 0))]; @@ -1720,6 +1944,23 @@ void CStudioHdr::CActivityToSequenceMapping::Initialize( CStudioHdr * __restrict int tupleOffset = seqsPerAct[seqdesc.activity]; Assert( tupleOffset < element.count ); + if ( seqdesc.numactivitymodifiers > 0 ) + { + // add entries for this model's activity modifiers + (tupleList + element.startingIdx + tupleOffset)->pActivityModifiers = new CUtlSymbol[ seqdesc.numactivitymodifiers ]; + (tupleList + element.startingIdx + tupleOffset)->iNumActivityModifiers = seqdesc.numactivitymodifiers; + + for ( int k = 0; k < seqdesc.numactivitymodifiers; k++ ) + { + (tupleList + element.startingIdx + tupleOffset)->pActivityModifiers[ k ] = g_ActivityModifiersTable.AddString( seqdesc.pActivityModifier( k )->pszName() ); + } + } + else + { + (tupleList + element.startingIdx + tupleOffset)->pActivityModifiers = NULL; + (tupleList + element.startingIdx + tupleOffset)->iNumActivityModifiers = 0; + } + // You might be tempted to collapse this pointer math into a single pointer -- // don't! the tuple list is marked __restrict above. (tupleList + element.startingIdx + tupleOffset)->seqnum = i; // store sequence number @@ -1744,7 +1985,6 @@ void CStudioHdr::CActivityToSequenceMapping::Initialize( CStudioHdr * __restrict /// Force Initialize() to occur again, even if it has already occured. void CStudioHdr::CActivityToSequenceMapping::Reinitialize( CStudioHdr *pstudiohdr ) { - m_bIsInitialized = false; if (m_pSequenceTuples) { delete m_pSequenceTuples; @@ -1802,22 +2042,113 @@ int CStudioHdr::CActivityToSequenceMapping::NumSequencesForActivity( int forActi } } +static CStudioHdr::CActivityToSequenceMapping emptyMapping; + // double-check that the data I point to hasn't changed bool CStudioHdr::CActivityToSequenceMapping::ValidateAgainst( const CStudioHdr * RESTRICT pstudiohdr ) RESTRICT { - if (m_bIsInitialized) + return ( this == &emptyMapping || + ( m_pStudioHdr == pstudiohdr->m_pStudioHdr && m_expectedVModel == pstudiohdr->GetVirtualModel() ) ); +} + +void CStudioHdr::CActivityToSequenceMapping::SetValidation( const CStudioHdr *RESTRICT pstudiohdr ) RESTRICT +{ + m_expectedVModel = pstudiohdr->GetVirtualModel(); +} + +struct StudioHdrToActivityMapEntry_t +{ + long checksum; + char name[64]; + int nRefs; + CStudioHdr::CActivityToSequenceMapping *pMap; +}; + +CUtlMap g_StudioHdrToActivityMaps( DefLessFunc( const studiohdr_t * ) ); +CThreadFastMutex g_StudioHdrToActivityMapsLock; + +CStudioHdr::CActivityToSequenceMapping *CStudioHdr::CActivityToSequenceMapping::FindMapping( const CStudioHdr *pHdr ) +{ + VPROF( "CStudioHdr::CActivityToSequenceMapping::FindMapping" ); + + if ( !pHdr->SequencesAvailable() || pHdr->GetNumSeq() <= 1 ) { - return m_expectedPStudioHdr == pstudiohdr->GetRenderHdr() && - m_expectedVModel == pstudiohdr->GetVirtualModel(); + return &emptyMapping; } - else + + Assert( !pHdr->m_pActivityToSequence ); + + AUTO_LOCK( g_StudioHdrToActivityMapsLock ); + const studiohdr_t *pRealHdr = pHdr->m_pStudioHdr; + int i = g_StudioHdrToActivityMaps.Find( pRealHdr ); + if ( i != g_StudioHdrToActivityMaps.InvalidIndex() ) { - return true; // Allow an ordinary initialization to take place without printing a panicky assert. + if ( !IsX360() && ( g_StudioHdrToActivityMaps[i].checksum != pRealHdr->checksum || Q_strcmp( g_StudioHdrToActivityMaps[i].name, pRealHdr->name ) != 0 ) ) + { + AssertFatal( g_StudioHdrToActivityMaps[i].nRefs == 0 ); + delete g_StudioHdrToActivityMaps[i].pMap; + g_StudioHdrToActivityMaps.RemoveAt( i ); + } + else + { + Assert( g_StudioHdrToActivityMaps[i].checksum == pRealHdr->checksum && Q_strcmp( g_StudioHdrToActivityMaps[i].name, pRealHdr->name ) == 0 ); + g_StudioHdrToActivityMaps[i].nRefs++; + return g_StudioHdrToActivityMaps[i].pMap; + } } + + i = g_StudioHdrToActivityMaps.Insert( pRealHdr ); + + g_StudioHdrToActivityMaps[i].checksum = pRealHdr->checksum; + Q_strncpy( g_StudioHdrToActivityMaps[i].name, pRealHdr->name, 64 ); + g_StudioHdrToActivityMaps[i].nRefs = 1; + g_StudioHdrToActivityMaps[i].pMap = new CStudioHdr::CActivityToSequenceMapping; + g_StudioHdrToActivityMaps[i].pMap->Initialize( pHdr ); + + return g_StudioHdrToActivityMaps[i].pMap; } -void CStudioHdr::CActivityToSequenceMapping::SetValidationPair( const CStudioHdr *RESTRICT pstudiohdr ) RESTRICT +void CStudioHdr::CActivityToSequenceMapping::ReleaseMapping( CActivityToSequenceMapping *pMap ) { - m_expectedPStudioHdr = pstudiohdr->GetRenderHdr(); - m_expectedVModel = pstudiohdr->GetVirtualModel(); + if ( pMap && pMap != &emptyMapping) + { + VPROF( "CStudioHdr::CActivityToSequenceMapping::ReleaseMapping" ); + AUTO_LOCK( g_StudioHdrToActivityMapsLock ); + int i = g_StudioHdrToActivityMaps.Find( pMap->m_pStudioHdr ); + if ( i != g_StudioHdrToActivityMaps.InvalidIndex() ) + { + Assert( g_StudioHdrToActivityMaps[i].nRefs > 0 ); + g_StudioHdrToActivityMaps[i].nRefs--; + } + else + { + Assert( 0 ); + } + } +} + +void CStudioHdr::CActivityToSequenceMapping::ResetMappings() +{ + for ( int i = g_StudioHdrToActivityMaps.FirstInorder(); i != g_StudioHdrToActivityMaps.InvalidIndex(); i = g_StudioHdrToActivityMaps.NextInorder( i ) ) + { + if ( g_StudioHdrToActivityMaps[i].nRefs == 0 ) + { + delete g_StudioHdrToActivityMaps[i].pMap; + } + else + { + Msg( "****************************************************************\n" ); + Msg( "****************************************************************\n" ); + Msg( "************* DO NOT IGNORE ME *******************************\n" ); + Msg( "****************************************************************\n" ); + Msg( "****************************************************************\n" ); + Warning( "Studio activity sequence mapping leak! (%s, %d)\n", g_StudioHdrToActivityMaps[i].name, g_StudioHdrToActivityMaps[i].nRefs ); + Msg( "****************************************************************\n" ); + Msg( "****************************************************************\n" ); + Msg( "****************************************************************\n" ); + Msg( "****************************************************************\n" ); + Msg( "****************************************************************\n" ); + } + } + g_StudioHdrToActivityMaps.RemoveAll(); } diff --git a/public/studio.h b/public/studio.h index fd127aa0b..665e95584 100644 --- a/public/studio.h +++ b/public/studio.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -26,22 +26,12 @@ #include "datamap.h" #include "generichash.h" #include "localflexcontroller.h" - +#include "utlsymbol.h" #define STUDIO_ENABLE_PERF_COUNTERS #define STUDIO_SEQUENCE_ACTIVITY_LOOKUPS_ARE_SLOW 0 -// If this is set to 1, then the activity->sequence mapping inside -// the CStudioHdr will not be initialized until the first call to -// SelectWeightedSequence() or HaveSequenceForActivity(). If set -// to zero, the mapping will be initialized from CStudioHdr::Init() -// (itself called from the constructor). -// As of June 4 2007, this was set to 1 because physics, among other -// systems, extemporaneously declares CStudioHdrs inside local function -// scopes without querying their activity/sequence mapping at all. -#define STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE 1 - //----------------------------------------------------------------------------- // forward declarations //----------------------------------------------------------------------------- @@ -68,16 +58,18 @@ Studio models are position independent, so the cache manager can move them. ============================================================================== */ -#define STUDIO_VERSION 48 +#define STUDIO_VERSION 49 + +struct studiohdr_t; -#ifndef _XBOX +#ifdef _X360 +#define MAXSTUDIOTRIANGLES 65536 // +#define MAXSTUDIOVERTS 32768 // These numbers save memory in CCachedRenderData, but restrict usable model sizes on 360 +#define MAXSTUDIOFLEXVERTS 4096 // +#else #define MAXSTUDIOTRIANGLES 65536 // TODO: tune this #define MAXSTUDIOVERTS 65536 // TODO: tune this #define MAXSTUDIOFLEXVERTS 10000 // max number of verts that can be flexed per mesh. TODO: tune this -#else -#define MAXSTUDIOTRIANGLES 25000 -#define MAXSTUDIOVERTS 10000 -#define MAXSTUDIOFLEXVERTS 1000 #endif #define MAXSTUDIOSKINS 32 // total textures #define MAXSTUDIOBONES 128 // total bones actually used @@ -105,7 +97,9 @@ struct mstudiodata_t #define STUDIO_PROC_QUATINTERP 2 #define STUDIO_PROC_AIMATBONE 3 #define STUDIO_PROC_AIMATATTACH 4 -#define STUDIO_PROC_JIGGLE 5 +#define STUDIO_PROC_JIGGLE 5 +#define STUDIO_PROC_TWIST_MASTER 6 +#define STUDIO_PROC_TWIST_SLAVE 7 // Multiple twist bones are computed at once for the same parent/child combo so TWIST_NULL do nothing struct mstudioaxisinterpbone_t { @@ -227,6 +221,50 @@ struct mstudioaimatbone_t mstudioaimatbone_t(const mstudioaimatbone_t& vOther); }; + +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +struct mstudiotwistbonetarget_t +{ + DECLARE_BYTESWAP_DATADESC(); + + int m_nBone; + float m_flWeight; + Vector m_vBaseTranslate; + Quaternion m_qBaseRotation; + + mstudiotwistbonetarget_t() {} +private: + // No copy constructors allowed + mstudiotwistbonetarget_t( const mstudiotwistbonetarget_t &vOther ); +}; + + +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +struct mstudiotwistbone_t +{ + DECLARE_BYTESWAP_DATADESC(); + + bool m_bInverse; // False: Apply child rotation to twist targets True: Apply parent rotation to twist targets + Vector m_vUpVector; // In parent space, projected into plane defined by vector between parent & child + int m_nParentBone; + Quaternion m_qBaseInv; // The base rotation of the parent, used if m_bInverse is true + int m_nChildBone; + + int m_nTargetCount; + int m_nTargetIndex; + inline mstudiotwistbonetarget_t *pTarget( int i ) const { return ( mstudiotwistbonetarget_t * )( ( ( byte * )this) + m_nTargetIndex ) + i; } + + mstudiotwistbone_t() {} +private: + // No copy constructors allowed + mstudiotwistbone_t( const mstudiotwistbone_t &vOther ); +}; + + // bones struct mstudiobone_t { @@ -253,9 +291,11 @@ struct mstudiobone_t inline void *pProcedure( ) const { if (procindex == 0) return NULL; else return (void *)(((byte *)this) + procindex); }; int surfacepropidx; // index into string tablefor property name inline char * const pszSurfaceProp( void ) const { return ((char *)this) + surfacepropidx; } - int contents; // See BSPFlags.h for the contents flags + inline int GetSurfaceProp( void ) const { return surfacepropLookup; } - int unused[8]; // remove as appropriate + int contents; // See BSPFlags.h for the contents flags + int surfacepropLookup; // this index must be cached by the loader, not saved in the file + int unused[7]; // remove as appropriate mstudiobone_t(){} private: @@ -277,25 +317,25 @@ struct mstudiolinearbone_t inline int parent( int i ) const { Assert( i >= 0 && i < numbones); return *((int *)(((byte *)this) + parentindex) + i); }; int posindex; - inline Vector pos( int i ) const { Assert( i >= 0 && i < numbones); return *((Vector *)(((byte *)this) + posindex) + i); }; + inline const Vector &pos( int i ) const { Assert( i >= 0 && i < numbones); return *((Vector *)(((byte *)this) + posindex) + i); }; int quatindex; - inline Quaternion quat( int i ) const { Assert( i >= 0 && i < numbones); return *((Quaternion *)(((byte *)this) + quatindex) + i); }; + inline const Quaternion &quat( int i ) const { Assert( i >= 0 && i < numbones); return *((Quaternion *)(((byte *)this) + quatindex) + i); }; int rotindex; - inline RadianEuler rot( int i ) const { Assert( i >= 0 && i < numbones); return *((RadianEuler *)(((byte *)this) + rotindex) + i); }; + inline const RadianEuler &rot( int i ) const { Assert( i >= 0 && i < numbones); return *((RadianEuler *)(((byte *)this) + rotindex) + i); }; int posetoboneindex; - inline matrix3x4_t poseToBone( int i ) const { Assert( i >= 0 && i < numbones); return *((matrix3x4_t *)(((byte *)this) + posetoboneindex) + i); }; + inline const matrix3x4_t &poseToBone( int i ) const { Assert( i >= 0 && i < numbones); return *((matrix3x4_t *)(((byte *)this) + posetoboneindex) + i); }; int posscaleindex; - inline Vector posscale( int i ) const { Assert( i >= 0 && i < numbones); return *((Vector *)(((byte *)this) + posscaleindex) + i); }; + inline const Vector &posscale( int i ) const { Assert( i >= 0 && i < numbones); return *((Vector *)(((byte *)this) + posscaleindex) + i); }; int rotscaleindex; - inline Vector rotscale( int i ) const { Assert( i >= 0 && i < numbones); return *((Vector *)(((byte *)this) + rotscaleindex) + i); }; + inline const Vector &rotscale( int i ) const { Assert( i >= 0 && i < numbones); return *((Vector *)(((byte *)this) + rotscaleindex) + i); }; int qalignmentindex; - inline Quaternion qalignment( int i ) const { Assert( i >= 0 && i < numbones); return *((Quaternion *)(((byte *)this) + qalignmentindex) + i); }; + inline const Quaternion &qalignment( int i ) const { Assert( i >= 0 && i < numbones); return *((Quaternion *)(((byte *)this) + qalignmentindex) + i); }; int unused[6]; @@ -306,6 +346,63 @@ struct mstudiolinearbone_t }; +//----------------------------------------------------------------------------- +// The component of the bone used by mstudioboneflexdriver_t +//----------------------------------------------------------------------------- +enum StudioBoneFlexComponent_t +{ + STUDIO_BONE_FLEX_INVALID = -1, // Invalid + STUDIO_BONE_FLEX_TX = 0, // Translate X + STUDIO_BONE_FLEX_TY = 1, // Translate Y + STUDIO_BONE_FLEX_TZ = 2 // Translate Z +}; + + +//----------------------------------------------------------------------------- +// Component is one of Translate X, Y or Z [0,2] (StudioBoneFlexComponent_t) +//----------------------------------------------------------------------------- +struct mstudioboneflexdrivercontrol_t +{ + DECLARE_BYTESWAP_DATADESC(); + + int m_nBoneComponent; // Bone component that drives flex, StudioBoneFlexComponent_t + int m_nFlexControllerIndex; // Flex controller to drive + float m_flMin; // Min value of bone component mapped to 0 on flex controller + float m_flMax; // Max value of bone component mapped to 1 on flex controller + + mstudioboneflexdrivercontrol_t(){} +private: + // No copy constructors allowed + mstudioboneflexdrivercontrol_t( const mstudioboneflexdrivercontrol_t &vOther ); +}; + + +//----------------------------------------------------------------------------- +// Drive flex controllers from bone components +//----------------------------------------------------------------------------- +struct mstudioboneflexdriver_t +{ + DECLARE_BYTESWAP_DATADESC(); + + int m_nBoneIndex; // Bone to drive flex controller + int m_nControlCount; // Number of flex controllers being driven + int m_nControlIndex; // Index into data where controllers are (relative to this) + + inline mstudioboneflexdrivercontrol_t *pBoneFlexDriverControl( int i ) const + { + Assert( i >= 0 && i < m_nControlCount ); + return (mstudioboneflexdrivercontrol_t *)(((byte *)this) + m_nControlIndex) + i; + } + + int unused[3]; + + mstudioboneflexdriver_t(){} +private: + // No copy constructors allowed + mstudioboneflexdriver_t( const mstudioboneflexdriver_t &vOther ); +}; + + #define BONE_CALCULATE_MASK 0x1F #define BONE_PHYSICALLY_SIMULATED 0x01 // bone is physically simulated when physics are active #define BONE_PHYSICS_PROCEDURAL 0x02 // procedural when physics is active @@ -337,7 +434,8 @@ struct mstudiolinearbone_t #define BONE_FIXED_ALIGNMENT 0x00100000 // bone can't spin 360 degrees, all interpolation is normalized around a fixed orientation #define BONE_HAS_SAVEFRAME_POS 0x00200000 // Vector48 -#define BONE_HAS_SAVEFRAME_ROT 0x00400000 // Quaternion64 +#define BONE_HAS_SAVEFRAME_ROT64 0x00400000 // Quaternion64 +#define BONE_HAS_SAVEFRAME_ROT32 0x00800000 // Quaternion32 // bone controllers struct mstudiobonecontroller_t @@ -363,12 +461,12 @@ struct mstudiobbox_t int szhitboxnameindex; // offset to the name of the hitbox. int unused[8]; - const char* pszHitboxName() + const char* pszHitboxName() const { if( szhitboxnameindex == 0 ) return ""; - return ((char*)this) + szhitboxnameindex; + return ((const char*)this) + szhitboxnameindex; } mstudiobbox_t() {} @@ -395,6 +493,7 @@ struct mstudiomodelgrouplookup_t }; // events +// NOTE: If you modify this struct you MUST also modify mstudioevent_for_client_server_t in npcevent.h!!! struct mstudioevent_t { DECLARE_BYTESWAP_DATADESC(); @@ -509,6 +608,17 @@ struct mstudioikrule_t }; +struct mstudioikrulezeroframe_t +{ + short chain; + short slot; + float16 start; // beginning of influence + float16 peak; // start of full influence + float16 tail; // end of full influence + float16 end; // end of all influence +}; + + struct mstudioiklock_t { DECLARE_BYTESWAP_DATADESC(); @@ -567,16 +677,15 @@ struct mstudioanim_valueptr_t #define STUDIO_ANIM_DELTA 0x10 #define STUDIO_ANIM_RAWROT2 0x20 // Quaternion64 - -// per bone per animation DOF and weight pointers -struct mstudioanim_t +// per bone per animation DOF and weight pointers, RLE encoded +struct mstudio_rle_anim_t { DECLARE_BYTESWAP_DATADESC(); byte bone; byte flags; // weighing options // valid for animating data only - inline byte *pData( void ) const { return (((byte *)this) + sizeof( struct mstudioanim_t )); }; + inline byte *pData( void ) const { return (((byte *)this) + sizeof( struct mstudio_rle_anim_t )); }; inline mstudioanim_valueptr_t *pRotV( void ) const { return (mstudioanim_valueptr_t *)(pData()); }; inline mstudioanim_valueptr_t *pPosV( void ) const { return (mstudioanim_valueptr_t *)(pData()) + ((flags & STUDIO_ANIM_ANIMROT) != 0); }; @@ -585,10 +694,37 @@ struct mstudioanim_t inline Quaternion64 *pQuat64( void ) const { return (Quaternion64 *)(pData()); }; inline Vector48 *pPos( void ) const { return (Vector48 *)(pData() + ((flags & STUDIO_ANIM_RAWROT) != 0) * sizeof( *pQuat48() ) + ((flags & STUDIO_ANIM_RAWROT2) != 0) * sizeof( *pQuat64() ) ); }; + // points to next bone in the list short nextoffset; - inline mstudioanim_t *pNext( void ) const { if (nextoffset != 0) return (mstudioanim_t *)(((byte *)this) + nextoffset); else return NULL; }; + inline mstudio_rle_anim_t *pNext( void ) const { if (nextoffset != 0) return (mstudio_rle_anim_t *)(((byte *)this) + nextoffset); else return NULL; }; }; + +#define STUDIO_FRAME_RAWPOS 0x01 // Vector48 in constants +#define STUDIO_FRAME_RAWROT 0x02 // Quaternion48 in constants +#define STUDIO_FRAME_ANIMPOS 0x04 // Vector48 in framedata +#define STUDIO_FRAME_ANIMROT 0x08 // Quaternion48 in framedata +#define STUDIO_FRAME_FULLANIMPOS 0x10 // Vector in framedata + + +struct mstudio_frame_anim_t +{ + DECLARE_BYTESWAP_DATADESC(); + + inline byte *pBoneFlags( void ) const { return (((byte *)this) + sizeof( struct mstudio_frame_anim_t )); }; + + int constantsoffset; + inline byte *pConstantData( void ) const { return (((byte *)this) + constantsoffset); }; + + int frameoffset; + int framelength; + inline byte *pFrameData( int iFrame ) const { return (((byte *)this) + frameoffset + iFrame * framelength); }; + + int unused[3]; +}; + + + struct mstudiomovement_t { DECLARE_BYTESWAP_DATADESC(); @@ -606,8 +742,6 @@ struct mstudiomovement_t mstudiomovement_t(const mstudiomovement_t& vOther); }; -struct studiohdr_t; - // used for piecewise loading of animation data struct mstudioanimblock_t { @@ -642,16 +776,19 @@ struct mstudioanimdesc_t int movementindex; inline mstudiomovement_t * const pMovement( int i ) const { return (mstudiomovement_t *)(((byte *)this) + movementindex) + i; }; - int unused1[6]; // remove as appropriate (and zero if loading older versions) + int ikrulezeroframeindex; + mstudioikrulezeroframe_t *pIKRuleZeroFrame( int i ) const { if (ikrulezeroframeindex) return (mstudioikrulezeroframe_t *)(((byte *)this) + ikrulezeroframeindex) + i; else return NULL; }; + + int unused1[5]; // remove as appropriate (and zero if loading older versions) int animblock; int animindex; // non-zero when anim data isn't in sections - mstudioanim_t *pAnimBlock( int block, int index ) const; // returns pointer to a specific anim block (local or external) - mstudioanim_t *pAnim( int *piFrame, float &flStall ) const; // returns pointer to data and new frame index - mstudioanim_t *pAnim( int *piFrame ) const; // returns pointer to data and new frame index + byte *pAnimBlock( int block, int index ) const; // returns pointer to a specific anim block (local or external) + byte *pAnim( int *piFrame, float &flStall ) const; // returns pointer to data and new frame index + byte *pAnim( int *piFrame ) const; // returns pointer to data and new frame index int numikrules; - int ikruleindex; // non-zero when IK data is stored in the mdl + int ikruleindex; // non-zero when IK rule is stored in the mdl int animblockikruleindex; // non-zero when IK data is stored in animblock file mstudioikrule_t *pIKRule( int i ) const; @@ -691,6 +828,14 @@ struct mstudioautolayer_t float end; // end of all influence }; +struct mstudioactivitymodifier_t +{ + DECLARE_BYTESWAP_DATADESC(); + + int sznameindex; + inline char *pszName() { return (sznameindex) ? (char *)(((byte *)this) + sznameindex ) : NULL; } +}; + // sequence descriptions struct mstudioseqdesc_t { @@ -787,7 +932,11 @@ struct mstudioseqdesc_t int cycleposeindex; // index of pose parameter to use as cycle index - int unused[7]; // remove/add as appropriate (grow back to 8 ints on version change!) + int activitymodifierindex; + int numactivitymodifiers; + inline mstudioactivitymodifier_t *pActivityModifier( int i ) const { Assert( i >= 0 && i < numactivitymodifiers); return activitymodifierindex != 0 ? (mstudioactivitymodifier_t *)(((byte *)this) + activitymodifierindex) + i : NULL; }; + + int unused[5]; // remove/add as appropriate (grow back to 8 ints on version change!) mstudioseqdesc_t(){} private: @@ -895,33 +1044,6 @@ struct mstudioflexcontrollerui_t }; -// these are the on-disk format vertex anims -struct dstudiovertanim_t -{ - unsigned short index; - byte speed; // 255/max_length_in_flex - byte side; // 255/left_right - Vector48 delta; - Vector48 ndelta; - -private: - // No copy constructors allowed - dstudiovertanim_t(const dstudiovertanim_t& vOther); -}; - - -struct dstudiovertanim_wrinkle_t : public dstudiovertanim_t -{ - short wrinkledelta; // Encodes a range from -1 to 1. NOTE: -32768 == -32767 == -1.0f, 32767 = 1.0f - -private: - // No copy constructors allowed - dstudiovertanim_wrinkle_t( const dstudiovertanim_t& vOther ); -}; - -const float g_VertAnimFixedPointScale = 1.0f / 4096.0f; -const float g_VertAnimFixedPointScaleInv = 1.0f / g_VertAnimFixedPointScale; - // this is the memory image of vertex anims (16-bit fixed point) struct mstudiovertanim_t { @@ -931,7 +1053,6 @@ struct mstudiovertanim_t byte side; // 255/left_right protected: - // JasonM changing this type a lot, to prefer fixed point 16 bit... union { short delta[3]; @@ -945,21 +1066,31 @@ struct mstudiovertanim_t }; public: - inline Vector GetDeltaFixed() + inline void ConvertToFixed( float flVertAnimFixedPointScale ) + { + delta[0] = flDelta[0].GetFloat() / flVertAnimFixedPointScale; + delta[1] = flDelta[1].GetFloat() / flVertAnimFixedPointScale; + delta[2] = flDelta[2].GetFloat() / flVertAnimFixedPointScale; + ndelta[0] = flNDelta[0].GetFloat() / flVertAnimFixedPointScale; + ndelta[1] = flNDelta[1].GetFloat() / flVertAnimFixedPointScale; + ndelta[2] = flNDelta[2].GetFloat() / flVertAnimFixedPointScale; + } + + inline Vector GetDeltaFixed( float flVertAnimFixedPointScale ) { - return Vector( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale ); + return Vector( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale ); } - inline Vector GetNDeltaFixed() + inline Vector GetNDeltaFixed( float flVertAnimFixedPointScale ) { - return Vector( ndelta[0]*g_VertAnimFixedPointScale, ndelta[1]*g_VertAnimFixedPointScale, ndelta[2]*g_VertAnimFixedPointScale ); + return Vector( ndelta[0] * flVertAnimFixedPointScale, ndelta[1] * flVertAnimFixedPointScale, ndelta[2] * flVertAnimFixedPointScale ); } - inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn ) + inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn, float flVertAnimFixedPointScale ) { - vFillIn->Set( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale, 0.0f ); + vFillIn->Set( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale, 0.0f ); } - inline void GetNDeltaFixed4DAligned( Vector4DAligned *vFillIn ) + inline void GetNDeltaFixed4DAligned( Vector4DAligned *vFillIn, float flVertAnimFixedPointScale ) { - vFillIn->Set( ndelta[0]*g_VertAnimFixedPointScale, ndelta[1]*g_VertAnimFixedPointScale, ndelta[2]*g_VertAnimFixedPointScale, 0.0f ); + vFillIn->Set( ndelta[0] * flVertAnimFixedPointScale, ndelta[1] * flVertAnimFixedPointScale, ndelta[2] * flVertAnimFixedPointScale, 0.0f ); } inline Vector GetDeltaFloat() { @@ -969,17 +1100,17 @@ struct mstudiovertanim_t { return Vector (flNDelta[0].GetFloat(), flNDelta[1].GetFloat(), flNDelta[2].GetFloat()); } - inline void SetDeltaFixed( const Vector& vInput ) + inline void SetDeltaFixed( const Vector& vInput, float flVertAnimFixedPointScale ) { - delta[0] = static_cast(vInput.x * g_VertAnimFixedPointScaleInv); - delta[1] = static_cast(vInput.y * g_VertAnimFixedPointScaleInv); - delta[2] = static_cast(vInput.z * g_VertAnimFixedPointScaleInv); + delta[0] = vInput.x / flVertAnimFixedPointScale; + delta[1] = vInput.y / flVertAnimFixedPointScale; + delta[2] = vInput.z / flVertAnimFixedPointScale; } - inline void SetNDeltaFixed( const Vector& vInputNormal ) + inline void SetNDeltaFixed( const Vector& vInputNormal, float flVertAnimFixedPointScale ) { - ndelta[0] = static_cast(vInputNormal.x * g_VertAnimFixedPointScaleInv); - ndelta[1] = static_cast(vInputNormal.y * g_VertAnimFixedPointScaleInv); - ndelta[2] = static_cast(vInputNormal.z * g_VertAnimFixedPointScaleInv); + ndelta[0] = vInputNormal.x / flVertAnimFixedPointScale; + ndelta[1] = vInputNormal.y / flVertAnimFixedPointScale; + ndelta[2] = vInputNormal.z / flVertAnimFixedPointScale; } // Ick...can also force fp16 data into this structure for writing to file in legacy format... @@ -996,10 +1127,20 @@ struct mstudiovertanim_t flNDelta[2].SetFloat( vInputNormal.z ); } + class CSortByIndex + { + public: + bool operator()(const mstudiovertanim_t &left, const mstudiovertanim_t & right)const + { + return left.index < right.index; + } + }; + friend class CSortByIndex; + mstudiovertanim_t(){} -private: - // No copy constructors allowed - mstudiovertanim_t(const mstudiovertanim_t& vOther); +//private: +// No copy constructors allowed, but it's needed for std::sort() +// mstudiovertanim_t(const mstudiovertanim_t& vOther); }; @@ -1010,20 +1151,25 @@ struct mstudiovertanim_wrinkle_t : public mstudiovertanim_t short wrinkledelta; - inline void SetWrinkleFixed( float flWrinkle ) + inline void SetWrinkleFixed( float flWrinkle, float flVertAnimFixedPointScale ) { - int nWrinkleDeltaInt = static_cast(flWrinkle * g_VertAnimFixedPointScaleInv); + int nWrinkleDeltaInt = flWrinkle / flVertAnimFixedPointScale; wrinkledelta = clamp( nWrinkleDeltaInt, -32767, 32767 ); } - inline Vector4D GetDeltaFixed() + inline Vector4D GetDeltaFixed( float flVertAnimFixedPointScale ) { - return Vector4D( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale, wrinkledelta*g_VertAnimFixedPointScale ); + return Vector4D( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale, wrinkledelta * flVertAnimFixedPointScale ); } - inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn ) + inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn, float flVertAnimFixedPointScale ) { - vFillIn->Set( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale, wrinkledelta*g_VertAnimFixedPointScale ); + vFillIn->Set( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale, wrinkledelta * flVertAnimFixedPointScale ); + } + + inline float GetWrinkleDeltaFixed( float flVertAnimFixedPointScale ) + { + return wrinkledelta * flVertAnimFixedPointScale; } }; @@ -1034,6 +1180,7 @@ enum StudioVertAnimType_t STUDIO_VERT_ANIM_WRINKLE, }; + struct mstudioflex_t { DECLARE_BYTESWAP_DATADESC(); @@ -1057,6 +1204,7 @@ struct mstudioflex_t unsigned char vertanimtype; // See StudioVertAnimType_t unsigned char unusedchar[3]; int unused[6]; + }; @@ -1187,12 +1335,15 @@ struct mstudioikchain_t // FIXME: add unused entries }; - struct mstudioiface_t { - unsigned short a, b, c; // Indices to vertices -}; + mstudioiface_t() + { + a = b = c = d = 0xFFFF; + } + unsigned short a, b, c, d; // Indices to vertices (If d is 0xFFFF, this is a triangle, else it's a quad) +}; struct mstudiomodel_t; @@ -1437,26 +1588,26 @@ inline mstudiovertex_t *mstudio_meshvertexdata_t::Vertex( int i ) const // a group of studio model data enum studiomeshgroupflags_t { - MESHGROUP_IS_FLEXED = 0x1, MESHGROUP_IS_HWSKINNED = 0x2, MESHGROUP_IS_DELTA_FLEXED = 0x4 }; // ---------------------------------------------------------- -// runtime stuff +// Runtime stuff // ---------------------------------------------------------- struct studiomeshgroup_t { IMesh *m_pMesh; int m_NumStrips; - int m_Flags; // see studiomeshgroupflags_t + int m_Flags; // see studiomeshgroupflags_t OptimizedModel::StripHeader_t *m_pStripData; unsigned short *m_pGroupIndexToMeshIndex; int m_NumVertices; - int *m_pUniqueTris; // for performance measurements + int *m_pUniqueFaces; // for performance measurements unsigned short *m_pIndices; + unsigned short *m_pTopologyIndices; bool m_MeshNeedsRestore; short m_ColorMeshID; IMorph *m_pMorph; @@ -1750,17 +1901,36 @@ struct thinModelVertices_t UnpackNormal_UBYTE4( &packedNormal, pNormal->Base() ); } - void GetBoneWeights( int vertIndex, mstudioboneweight_t *pBoneWeights ) const + void GetBoneWeights( int vertIndex, mstudioboneweight_t * RESTRICT pBoneWeights ) const { Assert( pBoneWeights ); Assert( ( m_numBoneInfluences <= 1 ) || ( m_boneWeights != NULL ) ); Assert( ( m_numBoneInfluences <= 0 ) || ( m_boneIndices != NULL ) ); int numStoredWeights = MAX( 0, ( m_numBoneInfluences - 1 ) ); - float *pBaseWeight = m_boneWeights + vertIndex*numStoredWeights; - char *pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences; + float * RESTRICT pBaseWeight = m_boneWeights + vertIndex*numStoredWeights; + char * RESTRICT pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences; float sum = 0.0f; + // TODO: unroll this loop? It's only three. We could use a switch + // and code it explicitly for the various possible m_numBoneInfluences + // which would improve scheduling but bloat code. for (int i = 0;i < MAX_NUM_BONES_PER_VERT;i++) { + float weight; + if ( i < ( m_numBoneInfluences - 1 ) ) + { + weight = pBaseWeight[i]; + sum += weight; + } + else + { + weight = 1.0f - sum; + sum = 1.0f; + } + + pBoneWeights->weight[i] = weight; + pBoneWeights->bone[i] = ( i < m_numBoneInfluences ) ? pBaseIndex[i] : 0; + + /* if ( i < ( m_numBoneInfluences - 1 ) ) pBoneWeights->weight[i] = pBaseWeight[i]; else @@ -1768,6 +1938,7 @@ struct thinModelVertices_t sum += pBoneWeights->weight[i]; pBoneWeights->bone[i] = ( i < m_numBoneInfluences ) ? pBaseIndex[i] : 0; + */ } // Treat 'zero weights' as '100% binding to bone zero': @@ -1781,6 +1952,41 @@ struct thinModelVertices_t unsigned short *m_vecNormals; // Normals are compressed into 16 bits apiece (see PackNormal_UBYTE4() ) }; + +// ---------------------------------------------------------- +// Studio Model Stream Data File +// ---------------------------------------------------------- + +// little-endian "IDSS" +#define MODEL_STREAM_FILE_ID (('S'<<24)+('S'<<16)+('D'<<8)+'I') +#define MODEL_STREAM_FILE_VERSION 1 + +struct vertexStreamFileHeader_t +{ + DECLARE_BYTESWAP_DATADESC(); + int id; // MODEL_STREAM_FILE_ID + int version; // MODEL_STREAM_FILE_VERSION + long checksum; // same as studiohdr_t, ensures sync + long flags; // flags + int numVerts; // number of vertices + int uv2StreamStart; // offset from base to uv2 stream + int uv2ElementSize; // size of each uv2 element + int pad; // pad + +public: + + // Accessor to uv2 stream + const void *GetStreamUv2() const + { + if ( ( id == MODEL_STREAM_FILE_ID ) && ( uv2StreamStart != 0 ) ) + return ( void * ) ( uv2StreamStart + (byte *)this ); + else + return NULL; + } +}; + + + // ---------------------------------------------------------- // Studio Model Vertex Data File // Position independent flat data for cache manager @@ -1791,6 +1997,8 @@ struct thinModelVertices_t #define MODEL_VERTEX_FILE_VERSION 4 // this id (IDCV) is used once the vertex data has been compressed (see CMDLCache::CreateThinVertexes) #define MODEL_VERTEX_FILE_THIN_ID (('V'<<24)+('C'<<16)+('D'<<8)+'I') +// this id (IDDV) is used once the vertex data has been discarded (see CMDLCache::CreateNullVertexes) +#define MODEL_VERTEX_FILE_NULL_ID (('V'<<24)+('D'<<16)+('D'<<8)+'I') struct vertexFileHeader_t { @@ -1935,6 +2143,17 @@ struct vertexFileFixup_t // alpha textures should cast shadows in vrad on this model (ONLY prop_static!) #define STUDIOHDR_FLAGS_CAST_TEXTURE_SHADOWS ( 1 << 18 ) +// Model has a quad-only Catmull-Clark SubD cage +#define STUDIOHDR_FLAGS_SUBDIVISION_SURFACE ( 1 << 19 ) + +// flagged on load to indicate no animation events on this model +#define STUDIOHDR_FLAGS_NO_ANIM_EVENTS ( 1 << 20 ) + +// If flag is set then studiohdr_t.flVertAnimFixedPointScale contains the +// scale value for fixed point vert anim data, if not set then the +// scale value is the default of 1.0 / 4096.0. Regardless use +// studiohdr_t::VertAnimFixedPointScale() to always retrieve the scale value +#define STUDIOHDR_FLAGS_VERT_ANIM_FIXED_POINT_SCALE ( 1 << 21 ) // NOTE! Next time we up the .mdl file format, remove studiohdr2_t // and insert all fields in this structure into studiohdr_t. @@ -1956,7 +2175,14 @@ struct studiohdr2_t int linearboneindex; inline mstudiolinearbone_t *pLinearBones() const { return (linearboneindex) ? (mstudiolinearbone_t *)(((byte *)this) + linearboneindex) : NULL; } - int reserved[59]; + int sznameindex; + inline char *pszName() { return (sznameindex) ? (char *)(((byte *)this) + sznameindex ) : NULL; } + + int m_nBoneFlexDriverCount; + int m_nBoneFlexDriverIndex; + inline mstudioboneflexdriver_t *pBoneFlexDriver( int i ) const { Assert( i >= 0 && i < m_nBoneFlexDriverCount ); return (mstudioboneflexdriver_t *)(((byte *)this) + m_nBoneFlexDriverIndex) + i; } + + int reserved[56]; }; struct studiohdr_t @@ -1967,10 +2193,10 @@ struct studiohdr_t long checksum; // this has to be the same in the phy and vtx files to load! - inline const char * pszName( void ) const { return name; } + inline const char * pszName( void ) const { if (studiohdr2index && pStudioHdr2()->pszName()) return pStudioHdr2()->pszName(); else return name; } char name[64]; - int length; + int length; Vector eyeposition; // ideal eye position @@ -2048,10 +2274,10 @@ struct studiohdr_t //public: int GetSequenceActivity( int iSequence ); void SetSequenceActivity( int iSequence, int iActivity ); - int GetActivityListVersion( void ) const; + int GetActivityListVersion( void ); void SetActivityListVersion( int version ) const; - int GetEventListVersion( void ) const; - void SetEventListVersion( int version ) const; + int GetEventListVersion( void ); + void SetEventListVersion( int version ); // raw textures int numtextures; @@ -2082,7 +2308,7 @@ struct studiohdr_t //public: int GetNumAttachments( void ) const; const mstudioattachment_t &pAttachment( int i ) const; - int GetAttachmentBone( int i ) const; + int GetAttachmentBone( int i ); // used on my tools in hlmv, not persistant void SetAttachmentBone( int iAttachment, int iBone ); @@ -2095,9 +2321,9 @@ struct studiohdr_t inline byte *pLocalTransition( int i ) const { Assert( i >= 0 && i < (numlocalnodes * numlocalnodes)); return (byte *)(((byte *)this) + localnodeindex) + i; }; //public: - int EntryNode( int iSequence ) const; - int ExitNode( int iSequence ) const; - const char *pszNodeName( int iNode ) const; + int EntryNode( int iSequence ); + int ExitNode( int iSequence ); + char *pszNodeName( int iNode ); int GetTransition( int iFrom, int iTo ) const; int numflexdesc; @@ -2126,11 +2352,12 @@ struct studiohdr_t inline mstudioposeparamdesc_t *pLocalPoseParameter( int i ) const { Assert( i >= 0 && i < numlocalposeparameters); return (mstudioposeparamdesc_t *)(((byte *)this) + localposeparamindex) + i; }; //public: int GetNumPoseParameters( void ) const; - const mstudioposeparamdesc_t &pPoseParameter( int i ) const; + const mstudioposeparamdesc_t &pPoseParameter( int i ); int GetSharedPoseParameter( int iSequence, int iLocalPose ) const; int surfacepropindex; inline char * const pszSurfaceProp( void ) const { return ((char *)this) + surfacepropindex; } + inline int GetSurfaceProp() const { return surfacepropLookup; } // Key values int keyvalueindex; @@ -2142,7 +2369,7 @@ struct studiohdr_t inline mstudioiklock_t *pLocalIKAutoplayLock( int i ) const { Assert( i >= 0 && i < numlocalikautoplaylocks); return (mstudioiklock_t *)(((byte *)this) + localikautoplaylockindex) + i; }; int GetNumIKAutoplayLocks( void ) const; - const mstudioiklock_t &pIKAutoplayLock( int i ) const; + const mstudioiklock_t &pIKAutoplayLock( int i ); int CountAutoplaySequences() const; int CopyAutoplaySequences( unsigned short *pOut, int outCount ) const; int GetAutoplayList( unsigned short **pOut ) const; @@ -2203,7 +2430,10 @@ struct studiohdr_t int flexcontrolleruiindex; mstudioflexcontrollerui_t *pFlexControllerUI( int i ) const { Assert( i >= 0 && i < numflexcontrollerui); return (mstudioflexcontrollerui_t *)(((byte *)this) + flexcontrolleruiindex) + i; } - int unused3[2]; + float flVertAnimFixedPointScale; + inline float VertAnimFixedPointScale() const { return ( flags & STUDIOHDR_FLAGS_VERT_ANIM_FIXED_POINT_SCALE ) ? flVertAnimFixedPointScale : 1.0f / 4096.0f; } + + mutable int surfacepropLookup; // this index must be cached by the loader, not saved in the file // FIXME: Remove when we up the model version. Move all fields of studiohdr2_t into studiohdr_t. int studiohdr2index; @@ -2219,6 +2449,9 @@ struct studiohdr_t inline mstudiolinearbone_t *pLinearBones() const { return studiohdr2index ? pStudioHdr2()->pLinearBones() : NULL; } + inline int BoneFlexDriverCount() const { return studiohdr2index ? pStudioHdr2()->m_nBoneFlexDriverCount : 0; } + inline const mstudioboneflexdriver_t* BoneFlexDriver( int i ) const { Assert( i >= 0 && i < BoneFlexDriverCount() ); return studiohdr2index ? pStudioHdr2()->pBoneFlexDriver( i ) : NULL; } + // NOTE: No room to add stuff? Up the .mdl file format version // [and move all fields in studiohdr2_t into studiohdr_t and kill studiohdr2_t], // or add your stuff to studiohdr2_t. See NumSrcBoneTransforms/SrcBoneTransform for the pattern to use. @@ -2258,15 +2491,15 @@ class CStudioHdr inline bool IsReadyForAccess( void ) const { return (m_pStudioHdr != NULL); }; inline virtualmodel_t *GetVirtualModel( void ) const { return m_pVModel; }; inline const studiohdr_t *GetRenderHdr( void ) const { return m_pStudioHdr; }; - const studiohdr_t *pSeqStudioHdr( int sequence ) const; - const studiohdr_t *pAnimStudioHdr( int animation )const; + const studiohdr_t *pSeqStudioHdr( int sequence ); + const studiohdr_t *pAnimStudioHdr( int animation ); private: mutable const studiohdr_t *m_pStudioHdr; mutable virtualmodel_t *m_pVModel; const virtualmodel_t * ResetVModel( const virtualmodel_t *pVModel ) const; - const studiohdr_t *GroupStudioHdr( int group ) const; + const studiohdr_t *GroupStudioHdr( int group ); mutable CUtlVector< const studiohdr_t * > m_pStudioHdrCache; mutable int m_nFrameUnlockCounter; @@ -2281,36 +2514,36 @@ class CStudioHdr bool SequencesAvailable() const; int GetNumSeq( void ) const; - mstudioanimdesc_t &pAnimdesc( int i ) const; - mstudioseqdesc_t &pSeqdesc( int iSequence ) const; + mstudioanimdesc_t &pAnimdesc( int i ); + mstudioseqdesc_t &pSeqdesc( int iSequence ); int iRelativeAnim( int baseseq, int relanim ) const; // maps seq local anim reference to global anim index int iRelativeSeq( int baseseq, int relseq ) const; // maps seq local seq reference to global seq index int GetSequenceActivity( int iSequence ); void SetSequenceActivity( int iSequence, int iActivity ); - int GetActivityListVersion( void ) const; + int GetActivityListVersion( void ); void SetActivityListVersion( int version ); - int GetEventListVersion( void ) const; + int GetEventListVersion( void ); void SetEventListVersion( int version ); int GetNumAttachments( void ) const; - const mstudioattachment_t &pAttachment( int i ) const; - int GetAttachmentBone( int i ) const; + const mstudioattachment_t &pAttachment( int i ); + int GetAttachmentBone( int i ); // used on my tools in hlmv, not persistant void SetAttachmentBone( int iAttachment, int iBone ); - int EntryNode( int iSequence ) const; - int ExitNode( int iSequence ) const; - const char *pszNodeName( int iNode ) const; + int EntryNode( int iSequence ); + int ExitNode( int iSequence ); + char *pszNodeName( int iNode ); // FIXME: where should this one be? int GetTransition( int iFrom, int iTo ) const; int GetNumPoseParameters( void ) const; - const mstudioposeparamdesc_t &pPoseParameter( int i ) const; + const mstudioposeparamdesc_t &pPoseParameter( int i ); int GetSharedPoseParameter( int iSequence, int iLocalPose ) const; int GetNumIKAutoplayLocks( void ) const; - const mstudioiklock_t &pIKAutoplayLock( int i ) const; + const mstudioiklock_t &pIKAutoplayLock( int i ); inline int CountAutoplaySequences() const { return m_pStudioHdr->CountAutoplaySequences(); }; inline int CopyAutoplaySequences( unsigned short *pOut, int outCount ) const { return m_pStudioHdr->CopyAutoplaySequences( pOut, outCount ); }; @@ -2335,7 +2568,7 @@ class CStudioHdr inline int numflexcontrollerui() const{ return m_pStudioHdr->numflexcontrollerui; }; inline mstudioflexcontrollerui_t *pFlexcontrollerUI( int i ) const { return m_pStudioHdr->pFlexControllerUI( i ); }; - inline const char *name() const { return m_pStudioHdr->name; }; // deprecated -- remove after full xbox merge + inline const char *name() const { return m_pStudioHdr->pszName(); }; // deprecated -- remove after full xbox merge inline const char *pszName() const { return m_pStudioHdr->pszName(); }; inline int numbonecontrollers() const { return m_pStudioHdr->numbonecontrollers; }; @@ -2356,6 +2589,7 @@ class CStudioHdr inline int flags() const { return m_pStudioHdr->flags; }; inline char *const pszSurfaceProp( void ) const { return m_pStudioHdr->pszSurfaceProp(); }; + inline int GetSurfaceProp()const { return m_pStudioHdr->surfacepropLookup; } inline float mass() const { return m_pStudioHdr->mass; }; inline int contents() const { return m_pStudioHdr->contents; } @@ -2378,15 +2612,22 @@ class CStudioHdr inline mstudiolinearbone_t *pLinearBones() const { return m_pStudioHdr->pLinearBones(); } + inline int BoneFlexDriverCount() const { return m_pStudioHdr->BoneFlexDriverCount(); } + inline const mstudioboneflexdriver_t *BoneFlexDriver( int i ) const { return m_pStudioHdr->BoneFlexDriver( i ); } + public: int IsSequenceLooping( int iSequence ); float GetSequenceCycleRate( int iSequence ); void RunFlexRules( const float *src, float *dest ); + void RunFlexRulesOld( const float *src, float *dest ); + void RunFlexRulesNew( const float *src, float *dest ); public: inline int boneFlags( int iBone ) const { return m_boneFlags[ iBone ]; } + inline void setBoneFlags( int iBone, int flags ) { m_boneFlags[ iBone ] |= flags; } + inline void clearBoneFlags( int iBone, int flags ) { m_boneFlags[ iBone ] &= ~flags; } inline int boneParent( int iBone ) const { return m_boneParent[ iBone ]; } private: @@ -2394,6 +2635,7 @@ class CStudioHdr CUtlVector< int > m_boneParent; public: + // This class maps an activity to sequences allowed for that activity, accelerating the resolution // of SelectWeightedSequence(), especially on PowerPC. Iterating through every sequence // attached to a model turned out to be a very destructive cache access pattern on 360. @@ -2409,8 +2651,10 @@ class CStudioHdr // A tuple of a sequence and its corresponding weight. Lists of these correspond to activities. struct SequenceTuple { - short seqnum; - short weight; // the absolute value of the weight from the sequence header + short seqnum; + short weight; // the absolute value of the weight from the sequence header + CUtlSymbol *pActivityModifiers; // list of activity modifier symbols + int iNumActivityModifiers; }; // The type of the hash's stored data, a composite of both key and value @@ -2468,20 +2712,22 @@ class CStudioHdr typedef CUtlHash ActivityToValueIdxHash; + // These must be here because IFM does not compile/link studio.cpp (?!?) + // ctor CActivityToSequenceMapping( void ) - : m_pSequenceTuples(NULL), m_iSequenceTuplesCount(0), -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE - m_bIsInitialized(false), -#endif - m_ActToSeqHash(8,0,0), m_expectedPStudioHdr(NULL), m_expectedVModel(NULL) + : m_pSequenceTuples(NULL), m_iSequenceTuplesCount(0), m_ActToSeqHash(8,0,0), m_pStudioHdr(NULL), m_expectedVModel(NULL) {}; // dtor -- not virtual because this class has no inheritors ~CActivityToSequenceMapping() - { + { if ( m_pSequenceTuples != NULL ) { + if ( m_pSequenceTuples->pActivityModifiers != NULL ) + { + delete[] m_pSequenceTuples->pActivityModifiers; + } delete[] m_pSequenceTuples; } } @@ -2496,15 +2742,15 @@ class CStudioHdr /// The number of sequences available for an activity. int NumSequencesForActivity( int forActivity ); -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE - inline bool IsInitialized( void ) { return m_bIsInitialized; } -#endif + static CActivityToSequenceMapping *FindMapping( const CStudioHdr *pstudiohdr ); + static void ReleaseMapping( CActivityToSequenceMapping *pMap ); + static void ResetMappings(); private: /// Allocate my internal array. (It is freed in the destructor.) Also, /// build the hash of activities to sequences and populate m_pSequenceTuples. - void Initialize( CStudioHdr *pstudiohdr ); + void Initialize( const CStudioHdr *pstudiohdr ); /// Force Initialize() to occur again, even if it has already occured. void Reinitialize( CStudioHdr *pstudiohdr ); @@ -2512,12 +2758,12 @@ class CStudioHdr /// A more efficient version of the old SelectWeightedSequence() function in animation.cpp. int SelectWeightedSequence( CStudioHdr *pstudiohdr, int activity, int curSequence ); + // selects the sequence with the most matching modifiers + int SelectWeightedSequenceFromModifiers( CStudioHdr *pstudiohdr, int activity, CUtlSymbol *pActivityModifiers, int iModifierCount ); + // Actually a big array, into which the hash values index. SequenceTuple *m_pSequenceTuples; unsigned int m_iSequenceTuplesCount; // (size of the whole array) -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE - bool m_bIsInitialized; -#endif // we don't store an outer pointer because we can't initialize it at construction time // (warning c4355) -- there are ways around this but it's easier to just pass in a @@ -2527,51 +2773,60 @@ class CStudioHdr ActivityToValueIdxHash m_ActToSeqHash; + const studiohdr_t *m_pStudioHdr; + // we store these so we can know if the contents of the studiohdr have changed // from underneath our feet (this is an emergency data integrity check) - const void *m_expectedPStudioHdr; const void *m_expectedVModel; + // double-check that the data I point to hasn't changed bool ValidateAgainst( const CStudioHdr * RESTRICT pstudiohdr ); - void SetValidationPair( const CStudioHdr *RESTRICT pstudiohdr ); + void SetValidation( const CStudioHdr *RESTRICT pstudiohdr ); friend class CStudioHdr; }; - CActivityToSequenceMapping m_ActivityToSequence; + CActivityToSequenceMapping *m_pActivityToSequence; + + void InitActivityToSequence() + { + if ( !m_pActivityToSequence ) + { + m_pActivityToSequence = CActivityToSequenceMapping::FindMapping( this ); + } + } /// A more efficient version of the old SelectWeightedSequence() function in animation.cpp. /// Returns -1 on failure to find a sequence inline int SelectWeightedSequence( int activity, int curSequence ) { -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE - // We lazy-initialize the header on demand here, because CStudioHdr::Init() is - // called from the constructor, at which time the this pointer is illegitimate. - if ( !m_ActivityToSequence.IsInitialized() ) - { - m_ActivityToSequence.Initialize(this); - } -#endif - return m_ActivityToSequence.SelectWeightedSequence( this, activity, curSequence ); + InitActivityToSequence(); + return m_pActivityToSequence->SelectWeightedSequence( this, activity, curSequence ); + } + + inline int SelectWeightedSequenceFromModifiers( int activity, CUtlSymbol *pActivityModifiers, int iModifierCount ) + { + InitActivityToSequence(); + return m_pActivityToSequence->SelectWeightedSequenceFromModifiers( this, activity, pActivityModifiers, iModifierCount ); } /// True iff there is at least one sequence for the given activity. inline bool HaveSequenceForActivity( int activity ) { -#if STUDIO_SEQUENCE_ACTIVITY_LAZY_INITIALIZE - if ( !m_ActivityToSequence.IsInitialized() ) - { - m_ActivityToSequence.Initialize(this); - } -#endif - return (m_ActivityToSequence.NumSequencesForActivity( activity ) > 0); + InitActivityToSequence(); + return (m_pActivityToSequence->NumSequencesForActivity( activity ) > 0); } // Force this CStudioHdr's activity-to-sequence mapping to be reinitialized inline void ReinitializeSequenceMapping(void) { - m_ActivityToSequence.Reinitialize(this); + if ( m_pActivityToSequence ) + { + CActivityToSequenceMapping::ReleaseMapping( m_pActivityToSequence ); + m_pActivityToSequence = NULL; + } + m_pActivityToSequence = CActivityToSequenceMapping::FindMapping( this ); } #ifdef STUDIO_ENABLE_PERF_COUNTERS @@ -2840,15 +3095,18 @@ inline const mstudioflexcontroller_t *mstudioflexcontrollerui_t::pController( in #define STUDIO_AUTOPLAY 0x0008 // temporary flag that forces the sequence to always play #define STUDIO_POST 0x0010 // #define STUDIO_ALLZEROS 0x0020 // this animation/sequence has no real animation data -// 0x0040 +#define STUDIO_FRAMEANIM 0x0040 // animation is encoded as by frame x bone instead of RLE bone x frame #define STUDIO_CYCLEPOSE 0x0080 // cycle index is taken from a pose parameter index #define STUDIO_REALTIME 0x0100 // cycle index is taken from a real-time clock, not the animations cycle index #define STUDIO_LOCAL 0x0200 // sequence has a local context sequence #define STUDIO_HIDDEN 0x0400 // don't show in default selection views #define STUDIO_OVERRIDE 0x0800 // a forward declared sequence (empty) #define STUDIO_ACTIVITY 0x1000 // Has been updated at runtime to activity index -#define STUDIO_EVENT 0x2000 // Has been updated at runtime to event index +#define STUDIO_EVENT 0x2000 // Has been updated at runtime to event index on server #define STUDIO_WORLD 0x4000 // sequence blends in worldspace +#define STUDIO_NOFORCELOOP 0x8000 // do not force the animation loop +#define STUDIO_EVENT_CLIENT 0x10000 // Has been updated at runtime to event index on client + // autolayer flags // 0x0001 // 0x0002 @@ -2867,12 +3125,11 @@ inline const mstudioflexcontroller_t *mstudioflexcontrollerui_t::pController( in #define STUDIO_AL_POSE 0x4000 // layer blends using a pose parameter instead of parent cycle -// Insert this code anywhere that you need to allow for conversion from an old STUDIO_VERSION -// to a new one. +// Insert this code anywhere that you need to allow for conversion from an old STUDIO_VERSION to a new one. // If we only support the current version, this function should be empty. inline bool Studio_ConvertStudioHdrToNewVersion( studiohdr_t *pStudioHdr ) { - COMPILE_TIME_ASSERT( STUDIO_VERSION == 48 ); // put this to make sure this code is updated upon changing version. + COMPILE_TIME_ASSERT( STUDIO_VERSION == 49 ); // put this to make sure this code is updated upon changing version. int version = pStudioHdr->version; if ( version == STUDIO_VERSION ) @@ -2901,7 +3158,7 @@ inline bool Studio_ConvertStudioHdrToNewVersion( studiohdr_t *pStudioHdr ) if (version < 47) { - // used to contain zeroframe cache data + // now used to contain zeroframe cache data, make sure it's empty if (pStudioHdr->unused4 != 0) { pStudioHdr->unused4 = 0; @@ -2916,6 +3173,7 @@ inline bool Studio_ConvertStudioHdrToNewVersion( studiohdr_t *pStudioHdr ) } else if (version == 47) { + // clear out stale version of zeroframe cache data for (int i = 0; i < pStudioHdr->numlocalanim; i++) { mstudioanimdesc_t *pAnim = (mstudioanimdesc_t *)pStudioHdr->pLocalAnimdesc( i ); @@ -2928,6 +3186,19 @@ inline bool Studio_ConvertStudioHdrToNewVersion( studiohdr_t *pStudioHdr ) } } + if (version < 49) + { + // remove any frameanim flag settings that might be stale + for (int i = 0; i < pStudioHdr->numlocalanim; i++) + { + mstudioanimdesc_t *pAnim = (mstudioanimdesc_t *)pStudioHdr->pLocalAnimdesc( i ); + if (pAnim->flags & STUDIO_FRAMEANIM) + { + pAnim->flags &= ~STUDIO_FRAMEANIM; + bResult = false; + } + } + } // for now, just slam the version number since they're compatible pStudioHdr->version = STUDIO_VERSION; @@ -3088,4 +3359,5 @@ inline int Studio_LoadVertexes( const vertexFileHeader_t *pTempVvdHdr, vertexFil return target; } + #endif // STUDIO_H diff --git a/public/studio_virtualmodel.cpp b/public/studio_virtualmodel.cpp index 8f2c53f31..6469dea74 100644 --- a/public/studio_virtualmodel.cpp +++ b/public/studio_virtualmodel.cpp @@ -348,6 +348,15 @@ void virtualmodel_t::AppendBonemap( int group, const studiohdr_t *pStudioHdr ) { Warning( "%s/%s : missmatched parent bones on \"%s\"\n", pBaseStudioHdr->pszName(), pStudioHdr->pszName(), pStudioHdr->pBone( j )->pszName() ); } + + // merge the bone use flags and pass up the chain + int flags = (pStudioHdr->pBone( j )->flags | pBaseStudioHdr->pBone( k )->flags) & BONE_USED_MASK; + int n = k; + while (n != -1 && flags != pBaseStudioHdr->pBone( n )->flags) + { + pBaseStudioHdr->pBone( n )->flags |= flags; + n = pBaseStudioHdr->pBone( n )->parent; + } } else { @@ -405,23 +414,6 @@ void virtualmodel_t::AppendAttachments( int group, const studiohdr_t *pStudioHdr tmp.group = group; tmp.index = j; k = attachment.AddToTail( tmp ); - - // make sure bone flags are set so attachment calculates - if ((m_group[ 0 ].GetStudioHdr()->pBone( n )->flags & BONE_USED_BY_ATTACHMENT) == 0) - { - while (n != -1) - { - m_group[ 0 ].GetStudioHdr()->pBone( n )->flags |= BONE_USED_BY_ATTACHMENT; - - if (m_group[ 0 ].GetStudioHdr()->pLinearBones()) - { - *m_group[ 0 ].GetStudioHdr()->pLinearBones()->pflags(n) |= BONE_USED_BY_ATTACHMENT; - } - - n = m_group[ 0 ].GetStudioHdr()->pBone( n )->parent; - } - continue; - } } m_group[ group ].masterAttachment[ j ] = k; diff --git a/public/tier0/annotations.h b/public/tier0/annotations.h new file mode 100644 index 000000000..7e0f46987 --- /dev/null +++ b/public/tier0/annotations.h @@ -0,0 +1,84 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +#ifndef ANALYSIS_ANNOTATIONS_H +#define ANALYSIS_ANNOTATIONS_H + +#if _MSC_VER >= 1600 // VS 2010 and above. +//----------------------------------------------------------------------------- +// Upgrading important helpful warnings to errors +//----------------------------------------------------------------------------- +#pragma warning(error : 4789 ) // warning C4789: destination of memory copy is too small + +// Suppress some code analysis warnings +#ifdef _PREFAST_ +// Include the annotation header file. +#include + +// For temporarily suppressing warnings -- the warnings are suppressed for the next source line. +#define ANALYZE_SUPPRESS(wnum) __pragma(warning(suppress: wnum)) +#define ANALYZE_SUPPRESS2(wnum1, wnum2) __pragma(warning(supress: wnum1 wnum2)) +#define ANALYZE_SUPPRESS3(wnum1, wnum2, wnum3) __pragma(warning(suppress: wnum1 wnum2 wnum3)) +#define ANALYZE_SUPPRESS4(wnum1, wnum2, wnum3, wnum4) __pragma(warning(suppress: wnum1 wnum2 wnum3 wnum4)) + +// Tag all printf style format strings with this +#define PRINTF_FORMAT_STRING _Printf_format_string_ +#define SCANF_FORMAT_STRING _Scanf_format_string_impl_ +// Various macros for specifying the capacity of the buffer pointed +// to by a function parameter. Variations include in/out/inout, +// CAP (elements) versus BYTECAP (bytes), and null termination or +// not (_Z). +#define IN_Z _In_z_ +#define IN_CAP(x) _In_count_(x) +#define IN_BYTECAP(x) _In_bytecount_(x) +#define OUT_Z_CAP(x) _Out_z_cap_(x) +#define OUT_CAP(x) _Out_cap_(x) +#define OUT_CAP_C(x) _Out_cap_c_(x) // Output buffer with specified *constant* capacity in elements +#define OUT_BYTECAP(x) _Out_bytecap_(x) +#define OUT_Z_BYTECAP(x) _Out_z_bytecap_(x) +#define INOUT_BYTECAP(x) _Inout_bytecap_(x) +#define INOUT_Z_CAP(x) _Inout_z_cap_(x) +#define INOUT_Z_BYTECAP(x) _Inout_z_bytecap_(x) +// These macros are use for annotating array reference parameters, typically used in functions +// such as V_strcpy_safe. Because they are array references the capacity is already known. +#if _MSC_VER >= 1700 +#define IN_Z_ARRAY _Pre_z_ +#define OUT_Z_ARRAY _Post_z_ +#define INOUT_Z_ARRAY _Prepost_z_ +#else +#define IN_Z_ARRAY _Deref_pre_z_ +#define OUT_Z_ARRAY _Deref_post_z_ +#define INOUT_Z_ARRAY _Deref_prepost_z_ +#endif // _MSC_VER >= 1700 +// Used for annotating functions to describe their return types. +#define MUST_CHECK_RETURN _Check_return_ +// Use the macros above to annotate string functions that fill buffers as shown here, +// in order to give VS's /analyze more opportunities to find bugs. +// void V_wcsncpy( OUT_Z_BYTECAP(maxLenInBytes) wchar_t *pDest, wchar_t const *pSrc, int maxLenInBytes ); +// int V_snwprintf( OUT_Z_CAP(maxLenInCharacters) wchar_t *pDest, int maxLenInCharacters, PRINTF_FORMAT_STRING const wchar_t *pFormat, ... ); + +#endif // _PREFAST_ +#endif // _MSC_VER >= 1600 // VS 2010 and above. + +#ifndef ANALYZE_SUPPRESS +#define ANALYZE_SUPPRESS(wnum) +#define ANALYZE_SUPPRESS2(wnum1, wnum2) +#define ANALYZE_SUPPRESS3(wnum1, wnum2, wnum3) +#define ANALYZE_SUPPRESS4(wnum1, wnum2, wnum3, wnum4) +#define PRINTF_FORMAT_STRING +#define SCANF_FORMAT_STRING +#define IN_Z +#define IN_CAP(x) +#define IN_BYTECAP(x) +#define OUT_Z_CAP(x) +#define OUT_CAP(x) +#define OUT_CAP_C(x) +#define OUT_BYTECAP(x) +#define OUT_Z_BYTECAP(x) +#define INOUT_BYTECAP(x) +#define INOUT_Z_CAP(x) +#define INOUT_Z_BYTECAP(x) +#define OUT_Z_ARRAY +#define INOUT_Z_ARRAY +#define MUST_CHECK_RETURN +#endif + +#endif // ANALYSIS_ANNOTATIONS_H diff --git a/public/tier0/dbg.h b/public/tier0/dbg.h index 8d0f9e640..d1b509661 100644 --- a/public/tier0/dbg.h +++ b/public/tier0/dbg.h @@ -47,6 +47,27 @@ #endif // BUILD_AS_DLL +enum SpewType_t +{ + SPEW_MESSAGE = 0, + SPEW_WARNING, + SPEW_ASSERT, + SPEW_ERROR, + SPEW_LOG, + + SPEW_TYPE_COUNT +}; + +enum SpewRetval_t +{ + SPEW_DEBUGGER = 0, + SPEW_CONTINUE, + SPEW_ABORT +}; + +/* type of externally defined function used to display debug spew */ +typedef SpewRetval_t (*SpewOutputFunc_t)( SpewType_t spewType, const tchar *pMsg ); + class Color; diff --git a/public/tier0/fasttimer.h b/public/tier0/fasttimer.h index d59a93a57..315db9ba7 100644 --- a/public/tier0/fasttimer.h +++ b/public/tier0/fasttimer.h @@ -558,7 +558,7 @@ class CLimitTimer { public: void SetLimit( uint64 m_cMicroSecDuration ); - bool BLimitReached( void ); + bool BLimitReached( void ) const; private: int64 m_lCycleLimit; @@ -582,7 +582,7 @@ inline void CLimitTimer::SetLimit( uint64 m_cMicroSecDuration ) // Purpose: Determines whether our specified time period has passed // Output: true if at least the specified time period has passed //----------------------------------------------------------------------------- -inline bool CLimitTimer::BLimitReached( ) +inline bool CLimitTimer::BLimitReached( ) const { CCycleCount cycleCount; cycleCount.Sample( ); diff --git a/public/tier0/logging.h b/public/tier0/logging.h index c62f9bfbe..7c84ac520 100644 --- a/public/tier0/logging.h +++ b/public/tier0/logging.h @@ -83,7 +83,7 @@ class CLoggingSystem; -#if defined(_WIN32) && !defined(THREAD_PROFILER) +#if !defined(THREAD_PROFILER) class CThreadFastMutex; #else class CThreadMutex; diff --git a/public/tier0/platform.h b/public/tier0/platform.h index 95778f503..0dd4d4c7b 100644 --- a/public/tier0/platform.h +++ b/public/tier0/platform.h @@ -131,6 +131,8 @@ typedef unsigned __int32 uintp; #define __m128 __vector4 #endif +#define OVERRIDE override + #else // _WIN32 typedef short int16; @@ -147,8 +149,21 @@ typedef int intp; typedef unsigned int uintp; #endif +#undef OVERRIDE +#if __cplusplus >= 201103L + #define OVERRIDE override + #if defined(__clang__) + // warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] + // Disabling this warning is less intrusive than enabling C++11 extensions + #pragma GCC diagnostic ignored "-Wc++11-extensions" + #endif +#else + #define OVERRIDE +#endif + #endif // else _WIN32 +typedef uint32 RTime32; typedef float float32; typedef double float64; @@ -159,8 +174,7 @@ typedef unsigned int uint; #ifdef GNUC #undef offsetof -//#define offsetof( type, var ) __builtin_offsetof( type, var ) -#define offsetof(s,m) (size_t)&(((s *)0)->m) +#define offsetof( type, var ) __builtin_offsetof( type, var ) #else #include #undef offsetof @@ -300,11 +314,37 @@ typedef void * HINSTANCE; #define DECL_ALIGN(x) /* */ #endif +#ifdef _MSC_VER +// MSVC has the align at the start of the struct +#define ALIGN4 DECL_ALIGN(4) #define ALIGN8 DECL_ALIGN(8) #define ALIGN16 DECL_ALIGN(16) #define ALIGN32 DECL_ALIGN(32) #define ALIGN128 DECL_ALIGN(128) +#define ALIGN4_POST +#define ALIGN8_POST +#define ALIGN16_POST +#define ALIGN32_POST +#define ALIGN128_POST +#elif defined( GNUC ) +// gnuc has the align decoration at the end +#define ALIGN4 +#define ALIGN8 +#define ALIGN16 +#define ALIGN32 +#define ALIGN128 + +#define ALIGN4_POST DECL_ALIGN(4) +#define ALIGN8_POST DECL_ALIGN(8) +#define ALIGN16_POST DECL_ALIGN(16) +#define ALIGN32_POST DECL_ALIGN(32) +#define ALIGN128_POST DECL_ALIGN(128) +#else +#error +#endif + +#include "annotations.h" // Linux had a few areas where it didn't construct objects in the same order that Windows does. // So when CVProfile::CVProfile() would access g_pMemAlloc, it would crash because the allocator wasn't initalized yet. @@ -419,10 +459,22 @@ typedef void * HINSTANCE; #define stackfree( _p ) #elif defined(_LINUX) || defined(__APPLE__) // Alloca defined for this platform -#define stackalloc( _size ) _alloca( ALIGN_VALUE( _size, 16 ) ) +#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) ) #define stackfree( _p ) #endif +#if defined( GNUC ) +#ifdef _LINUX + #define mallocsize( _p ) ( malloc_usable_size( _p ) ) +#elif defined(OSX) + #define mallocsize( _p ) ( malloc_size( _p ) ) +#else +#error +#endif +#elif defined ( _WIN32 ) + #define mallocsize( _p ) ( _msize( _p ) ) +#endif + #ifdef _WIN32 #define RESTRICT __restrict #define RESTRICT_FUNC __declspec(restrict) diff --git a/public/tier0/threadtools.h b/public/tier0/threadtools.h index 3b0e47100..e3ec21cd5 100644 --- a/public/tier0/threadtools.h +++ b/public/tier0/threadtools.h @@ -158,13 +158,57 @@ inline int ThreadWaitForObject( HANDLE handle, bool bWaitAll = true, unsigned ti #define NOINLINE __attribute__ ((noinline)) #endif -#if defined(_WIN32) && !defined(_X360) -#if ( _MSC_VER >= 1310 ) +#if defined( _LINUX ) || defined( _OSX ) +#define USE_INTRINSIC_INTERLOCKED +// linux implementation +inline int32 ThreadInterlockedIncrement( int32 volatile *p ) +{ + Assert( (size_t)p % 4 == 0 ); + return __sync_fetch_and_add( p, 1 ) + 1; +} + +inline int32 ThreadInterlockedDecrement( int32 volatile *p ) +{ + Assert( (size_t)p % 4 == 0 ); + return __sync_fetch_and_add( p, -1 ) - 1; +} + +inline int32 ThreadInterlockedExchange( int32 volatile *p, int32 value ) +{ + Assert( (size_t)p % 4 == 0 ); + int32 nRet; + + // Note: The LOCK instruction prefix is assumed on the XCHG instruction and GCC gets very confused on the Mac when we use it. + __asm __volatile( + "xchgl %2,(%1)" + : "=r" (nRet) + : "r" (p), "0" (value) + : "memory"); + return nRet; +} + +inline int32 ThreadInterlockedExchangeAdd( int32 volatile *p, int32 value ) +{ + Assert( (size_t)p % 4 == 0 ); + return __sync_fetch_and_add( p, value ); +} +inline int32 ThreadInterlockedCompareExchange( int32 volatile *p, int32 value, int32 comperand ) +{ + Assert( (size_t)p % 4 == 0 ); + return __sync_val_compare_and_swap( p, comperand, value ); +} + + +inline bool ThreadInterlockedAssignIf( int32 volatile *p, int32 value, int32 comperand ) +{ + Assert( (size_t)p % 4 == 0 ); + return __sync_bool_compare_and_swap( p, comperand, value ); +} + +#elif ( defined( COMPILER_MSVC32 ) && ( _MSC_VER >= 1310 ) ) +// windows 32 implemnetation using compiler intrinsics #define USE_INTRINSIC_INTERLOCKED -#endif -#endif -#ifdef USE_INTRINSIC_INTERLOCKED extern "C" { long __cdecl _InterlockedIncrement(volatile long*); @@ -180,60 +224,66 @@ extern "C" #pragma intrinsic( _InterlockedExchangeAdd ) #pragma intrinsic( _InterlockedIncrement ) -inline long ThreadInterlockedIncrement( long volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedIncrement( p ); } -inline long ThreadInterlockedDecrement( long volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedDecrement( p ); } -inline long ThreadInterlockedExchange( long volatile *p, long value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchange( p, value ); } -inline long ThreadInterlockedExchangeAdd( long volatile *p, long value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchangeAdd( p, value ); } -inline long ThreadInterlockedCompareExchange( long volatile *p, long value, long comperand ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedCompareExchange( p, value, comperand ); } -inline bool ThreadInterlockedAssignIf( long volatile *p, long value, long comperand ) { Assert( (size_t)p % 4 == 0 ); return ( _InterlockedCompareExchange( p, value, comperand ) == comperand ); } +inline int32 ThreadInterlockedIncrement( int32 volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedIncrement( (volatile long*)p ); } +inline int32 ThreadInterlockedDecrement( int32 volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedDecrement( (volatile long*)p ); } +inline int32 ThreadInterlockedExchange( int32 volatile *p, int32 value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchange( (volatile long*)p, value ); } +inline int32 ThreadInterlockedExchangeAdd( int32 volatile *p, int32 value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchangeAdd( (volatile long*)p, value ); } +inline int32 ThreadInterlockedCompareExchange( int32 volatile *p, int32 value, int32 comperand ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedCompareExchange( (volatile long*)p, value, comperand ); } +inline bool ThreadInterlockedAssignIf( int32 volatile *p, int32 value, int32 comperand ) { Assert( (size_t)p % 4 == 0 ); return ( _InterlockedCompareExchange( (volatile long*)p, value, comperand ) == comperand ); } #else -TT_INTERFACE long ThreadInterlockedIncrement( long volatile * ); -TT_INTERFACE long ThreadInterlockedDecrement( long volatile * ); -TT_INTERFACE long ThreadInterlockedExchange( long volatile *, long value ); -TT_INTERFACE long ThreadInterlockedExchangeAdd( long volatile *, long value ); -TT_INTERFACE long ThreadInterlockedCompareExchange( long volatile *, long value, long comperand ); -TT_INTERFACE bool ThreadInterlockedAssignIf( long volatile *, long value, long comperand ); +// non 32-bit windows and 360 implementation +PLATFORM_INTERFACE int32 ThreadInterlockedIncrement( int32 volatile * ) NOINLINE; +PLATFORM_INTERFACE int32 ThreadInterlockedDecrement( int32 volatile * ) NOINLINE; +PLATFORM_INTERFACE int32 ThreadInterlockedExchange( int32 volatile *, int32 value ) NOINLINE; +PLATFORM_INTERFACE int32 ThreadInterlockedExchangeAdd( int32 volatile *, int32 value ) NOINLINE; +PLATFORM_INTERFACE int32 ThreadInterlockedCompareExchange( int32 volatile *, int32 value, int32 comperand ) NOINLINE; +PLATFORM_INTERFACE bool ThreadInterlockedAssignIf( int32 volatile *, int32 value, int32 comperand ) NOINLINE; #endif -inline unsigned ThreadInterlockedExchangeSubtract( long volatile *p, long value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, -value ); } -#if defined( USE_INTRINSIC_INTERLOCKED ) && !defined( _WIN64 ) +#if defined( USE_INTRINSIC_INTERLOCKED ) && !defined( PLATFORM_64BITS ) #define TIPTR() -inline void *ThreadInterlockedExchangePointer( void * volatile *p, void *value ) { return (void *)_InterlockedExchange( reinterpret_cast(p), reinterpret_cast(value) ); } -inline void *ThreadInterlockedCompareExchangePointer( void * volatile *p, void *value, void *comperand ) { return (void *)_InterlockedCompareExchange( reinterpret_cast(p), reinterpret_cast(value), reinterpret_cast(comperand) ); } -inline bool ThreadInterlockedAssignPointerIf( void * volatile *p, void *value, void *comperand ) { return ( _InterlockedCompareExchange( reinterpret_cast(p), reinterpret_cast(value), reinterpret_cast(comperand) ) == reinterpret_cast(comperand) ); } +inline void *ThreadInterlockedExchangePointer( void * volatile *p, void *value ) { return (void *)( ( intp )ThreadInterlockedExchange( reinterpret_cast(p), reinterpret_cast(value) ) ); } +inline void *ThreadInterlockedCompareExchangePointer( void * volatile *p, void *value, void *comperand ) { return (void *)( ( intp )ThreadInterlockedCompareExchange( reinterpret_cast(p), reinterpret_cast(value), reinterpret_cast(comperand) ) ); } +inline bool ThreadInterlockedAssignPointerIf( void * volatile *p, void *value, void *comperand ) { return ( ThreadInterlockedCompareExchange( reinterpret_cast(p), reinterpret_cast(value), reinterpret_cast(comperand) ) == reinterpret_cast(comperand) ); } #else -TT_INTERFACE void *ThreadInterlockedExchangePointer( void * volatile *, void *value ); -TT_INTERFACE void *ThreadInterlockedCompareExchangePointer( void * volatile *, void *value, void *comperand ); -TT_INTERFACE bool ThreadInterlockedAssignPointerIf( void * volatile *, void *value, void *comperand ); +PLATFORM_INTERFACE void *ThreadInterlockedExchangePointer( void * volatile *, void *value ) NOINLINE; +PLATFORM_INTERFACE void *ThreadInterlockedCompareExchangePointer( void * volatile *, void *value, void *comperand ) NOINLINE; +PLATFORM_INTERFACE bool ThreadInterlockedAssignPointerIf( void * volatile *, void *value, void *comperand ) NOINLINE; #endif + +inline unsigned ThreadInterlockedExchangeSubtract( int32 volatile *p, int32 value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, -value ); } + inline void const *ThreadInterlockedExchangePointerToConst( void const * volatile *p, void const *value ) { return ThreadInterlockedExchangePointer( const_cast < void * volatile * > ( p ), const_cast < void * > ( value ) ); } inline void const *ThreadInterlockedCompareExchangePointerToConst( void const * volatile *p, void const *value, void const *comperand ) { return ThreadInterlockedCompareExchangePointer( const_cast < void * volatile * > ( p ), const_cast < void * > ( value ), const_cast < void * > ( comperand ) ); } inline bool ThreadInterlockedAssignPointerToConstIf( void const * volatile *p, void const *value, void const *comperand ) { return ThreadInterlockedAssignPointerIf( const_cast < void * volatile * > ( p ), const_cast < void * > ( value ), const_cast < void * > ( comperand ) ); } -TT_INTERFACE int64 ThreadInterlockedIncrement64( int64 volatile * ); -TT_INTERFACE int64 ThreadInterlockedDecrement64( int64 volatile * ); -TT_INTERFACE int64 ThreadInterlockedCompareExchange64( int64 volatile *, int64 value, int64 comperand ); -TT_INTERFACE int64 ThreadInterlockedExchange64( int64 volatile *, int64 value ); -TT_INTERFACE int64 ThreadInterlockedExchangeAdd64( int64 volatile *, int64 value ); -TT_INTERFACE bool ThreadInterlockedAssignIf64(volatile int64 *pDest, int64 value, int64 comperand ); - -inline unsigned ThreadInterlockedExchangeSubtract( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); } -inline unsigned ThreadInterlockedIncrement( unsigned volatile *p ) { return ThreadInterlockedIncrement( (long volatile *)p ); } -inline unsigned ThreadInterlockedDecrement( unsigned volatile *p ) { return ThreadInterlockedDecrement( (long volatile *)p ); } -inline unsigned ThreadInterlockedExchange( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchange( (long volatile *)p, value ); } -inline unsigned ThreadInterlockedExchangeAdd( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); } -inline unsigned ThreadInterlockedCompareExchange( unsigned volatile *p, unsigned value, unsigned comperand ) { return ThreadInterlockedCompareExchange( (long volatile *)p, value, comperand ); } -inline bool ThreadInterlockedAssignIf( unsigned volatile *p, unsigned value, unsigned comperand ) { return ThreadInterlockedAssignIf( (long volatile *)p, value, comperand ); } - -inline int ThreadInterlockedExchangeSubtract( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); } -inline int ThreadInterlockedIncrement( int volatile *p ) { return ThreadInterlockedIncrement( (long volatile *)p ); } -inline int ThreadInterlockedDecrement( int volatile *p ) { return ThreadInterlockedDecrement( (long volatile *)p ); } -inline int ThreadInterlockedExchange( int volatile *p, int value ) { return ThreadInterlockedExchange( (long volatile *)p, value ); } -inline int ThreadInterlockedExchangeAdd( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); } -inline int ThreadInterlockedCompareExchange( int volatile *p, int value, int comperand ) { return ThreadInterlockedCompareExchange( (long volatile *)p, value, comperand ); } -inline bool ThreadInterlockedAssignIf( int volatile *p, int value, int comperand ) { return ThreadInterlockedAssignIf( (long volatile *)p, value, comperand ); } + +PLATFORM_INTERFACE int64 ThreadInterlockedCompareExchange64( int64 volatile *, int64 value, int64 comperand ) NOINLINE; +PLATFORM_INTERFACE bool ThreadInterlockedAssignIf64( volatile int64 *pDest, int64 value, int64 comperand ) NOINLINE; + +PLATFORM_INTERFACE int64 ThreadInterlockedExchange64( int64 volatile *, int64 value ) NOINLINE; +PLATFORM_INTERFACE int64 ThreadInterlockedIncrement64( int64 volatile * ) NOINLINE; +PLATFORM_INTERFACE int64 ThreadInterlockedDecrement64( int64 volatile * ) NOINLINE; +PLATFORM_INTERFACE int64 ThreadInterlockedExchangeAdd64( int64 volatile *, int64 value ) NOINLINE; + +inline unsigned ThreadInterlockedExchangeSubtract( uint32 volatile *p, uint32 value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); } +inline unsigned ThreadInterlockedIncrement( uint32 volatile *p ) { return ThreadInterlockedIncrement( (int32 volatile *)p ); } +inline unsigned ThreadInterlockedDecrement( uint32 volatile *p ) { return ThreadInterlockedDecrement( (int32 volatile *)p ); } +inline unsigned ThreadInterlockedExchange( uint32 volatile *p, uint32 value ) { return ThreadInterlockedExchange( (int32 volatile *)p, value ); } +inline unsigned ThreadInterlockedExchangeAdd( uint32 volatile *p, uint32 value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); } +inline unsigned ThreadInterlockedCompareExchange( uint32 volatile *p, uint32 value, uint32 comperand ) { return ThreadInterlockedCompareExchange( (int32 volatile *)p, value, comperand ); } +inline bool ThreadInterlockedAssignIf( uint32 volatile *p, uint32 value, uint32 comperand ) { return ThreadInterlockedAssignIf( (int32 volatile *)p, value, comperand ); } + +//inline int ThreadInterlockedExchangeSubtract( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); } +//inline int ThreadInterlockedIncrement( int volatile *p ) { return ThreadInterlockedIncrement( (int32 volatile *)p ); } +//inline int ThreadInterlockedDecrement( int volatile *p ) { return ThreadInterlockedDecrement( (int32 volatile *)p ); } +//inline int ThreadInterlockedExchange( int volatile *p, int value ) { return ThreadInterlockedExchange( (int32 volatile *)p, value ); } +//inline int ThreadInterlockedExchangeAdd( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); } +//inline int ThreadInterlockedCompareExchange( int volatile *p, int value, int comperand ) { return ThreadInterlockedCompareExchange( (int32 volatile *)p, value, comperand ); } +//inline bool ThreadInterlockedAssignIf( int volatile *p, int value, int comperand ) { return ThreadInterlockedAssignIf( (int32 volatile *)p, value, comperand ); } + //----------------------------------------------------------------------------- // Access to VTune thread profiling @@ -379,7 +429,7 @@ template class CInterlockedIntT { public: - CInterlockedIntT() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(long) ); } + CInterlockedIntT() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(int32) ); } CInterlockedIntT( T value ) : m_value( value ) {} operator T() const { return m_value; } @@ -388,17 +438,17 @@ class CInterlockedIntT bool operator==( T rhs ) const { return ( m_value == rhs ); } bool operator!=( T rhs ) const { return ( m_value != rhs ); } - T operator++() { return (T)ThreadInterlockedIncrement( (long *)&m_value ); } + T operator++() { return (T)ThreadInterlockedIncrement( (int32 *)&m_value ); } T operator++(int) { return operator++() - 1; } - T operator--() { return (T)ThreadInterlockedDecrement( (long *)&m_value ); } + T operator--() { return (T)ThreadInterlockedDecrement( (int32 *)&m_value ); } T operator--(int) { return operator--() + 1; } - bool AssignIf( T conditionValue, T newValue ) { return ThreadInterlockedAssignIf( (long *)&m_value, (long)newValue, (long)conditionValue ); } + bool AssignIf( T conditionValue, T newValue ) { return ThreadInterlockedAssignIf( (int32 *)&m_value, (int32)newValue, (int32)conditionValue ); } - T operator=( T newValue ) { ThreadInterlockedExchange((long *)&m_value, newValue); return m_value; } + T operator=( T newValue ) { ThreadInterlockedExchange((int32 *)&m_value, newValue); return m_value; } - void operator+=( T add ) { ThreadInterlockedExchangeAdd( (long *)&m_value, (long)add ); } + void operator+=( T add ) { ThreadInterlockedExchangeAdd( (int32 *)&m_value, (int32)add ); } void operator-=( T subtract ) { operator+=( -subtract ); } void operator*=( T multiplier ) { T original, result; @@ -433,7 +483,7 @@ template class CInterlockedPtr { public: - CInterlockedPtr() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T *) == sizeof(long) ); /* Will need to rework operator+= for 64 bit */ } + CInterlockedPtr() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T *) == sizeof(int32) ); /* Will need to rework operator+= for 64 bit */ } CInterlockedPtr( T *value ) : m_value( value ) {} operator T *() const { return m_value; } @@ -442,17 +492,17 @@ class CInterlockedPtr bool operator==( T *rhs ) const { return ( m_value == rhs ); } bool operator!=( T *rhs ) const { return ( m_value != rhs ); } - T *operator++() { return ((T *)ThreadInterlockedExchangeAdd( (long *)&m_value, sizeof(T) )) + 1; } - T *operator++(int) { return (T *)ThreadInterlockedExchangeAdd( (long *)&m_value, sizeof(T) ); } + T *operator++() { return ((T *)ThreadInterlockedExchangeAdd( (int32 *)&m_value, sizeof(T) )) + 1; } + T *operator++(int) { return (T *)ThreadInterlockedExchangeAdd( (int32 *)&m_value, sizeof(T) ); } - T *operator--() { return ((T *)ThreadInterlockedExchangeAdd( (long *)&m_value, -sizeof(T) )) - 1; } - T *operator--(int) { return (T *)ThreadInterlockedExchangeAdd( (long *)&m_value, -sizeof(T) ); } + T *operator--() { return ((T *)ThreadInterlockedExchangeAdd( (int32 *)&m_value, -sizeof(T) )) - 1; } + T *operator--(int) { return (T *)ThreadInterlockedExchangeAdd( (int32 *)&m_value, -sizeof(T) ); } bool AssignIf( T *conditionValue, T *newValue ) { return ThreadInterlockedAssignPointerToConstIf( (void const **) &m_value, (void const *) newValue, (void const *) conditionValue ); } T *operator=( T *newValue ) { ThreadInterlockedExchangePointerToConst( (void const **) &m_value, (void const *) newValue ); return newValue; } - void operator+=( int add ) { ThreadInterlockedExchangeAdd( (long *)&m_value, add * sizeof(T) ); } + void operator+=( int add ) { ThreadInterlockedExchangeAdd( (int32 *)&m_value, add * sizeof(T) ); } void operator-=( int subtract ) { operator+=( -subtract ); } T *operator+( int rhs ) const { return m_value + rhs; } @@ -524,9 +574,9 @@ class TT_CLASS CThreadMutex #else #error #endif - + #ifdef THREAD_MUTEX_TRACING_SUPPORTED - // Debugging (always here to allow mixed debug/release builds w/o changing size) + // Debugging (always herge to allow mixed debug/release builds w/o changing size) uint m_currentOwnerID; uint16 m_lockCount; bool m_bTrace; @@ -543,7 +593,7 @@ class TT_CLASS CThreadMutex // //----------------------------------------------------------------------------- -#if defined(_WIN32) && !defined(THREAD_PROFILER) +#if !defined(THREAD_PROFILER) class CThreadFastMutex { @@ -557,7 +607,7 @@ class CThreadFastMutex private: FORCEINLINE bool TryLockInline( const uint32 threadId ) volatile { - if ( threadId != m_ownerID && !ThreadInterlockedAssignIf( (volatile long *)&m_ownerID, (long)threadId, 0 ) ) + if ( threadId != m_ownerID && !ThreadInterlockedAssignIf( (volatile uint32 *)&m_ownerID, (uint32)threadId, 0 ) ) return false; ++m_depth; @@ -756,7 +806,7 @@ typedef CAutoLockT CAutoLock; template struct CAutoLockTypeDeducer {}; template <> struct CAutoLockTypeDeducer { typedef CThreadMutex Type_t; }; template <> struct CAutoLockTypeDeducer { typedef CThreadNullMutex Type_t; }; -#if defined(_WIN32) && !defined(THREAD_PROFILER) +#if !defined(THREAD_PROFILER) template <> struct CAutoLockTypeDeducer { typedef CThreadFastMutex Type_t; }; template <> struct CAutoLockTypeDeducer { typedef CAlignedThreadFastMutex Type_t; }; #endif @@ -1052,6 +1102,8 @@ class TT_CLASS CThread // Access the thread handle directly HANDLE GetThreadHandle(); uint GetThreadId(); +#elif defined( LINUX ) + uint GetThreadId(); #endif //----------------------------------------------------- diff --git a/public/tier0/valve_minmax_off.h b/public/tier0/valve_minmax_off.h new file mode 100644 index 000000000..633a37809 --- /dev/null +++ b/public/tier0/valve_minmax_off.h @@ -0,0 +1,7 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +#ifdef min + #undef min +#endif +#ifdef max + #undef max +#endif diff --git a/public/tier0/valve_minmax_on.h b/public/tier0/valve_minmax_on.h new file mode 100644 index 000000000..738eabc16 --- /dev/null +++ b/public/tier0/valve_minmax_on.h @@ -0,0 +1,9 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +#if !defined(POSIX) +#ifndef min + #define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef max + #define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#endif diff --git a/public/tier1/KeyValues.h b/public/tier1/KeyValues.h index 7eb2f026c..9cce28d16 100644 --- a/public/tier1/KeyValues.h +++ b/public/tier1/KeyValues.h @@ -30,6 +30,15 @@ class CUtlBuffer; class Color; typedef void * FileHandle_t; +#define FOR_EACH_SUBKEY( kvRoot, kvSubKey ) \ + for ( KeyValues * kvSubKey = kvRoot->GetFirstSubKey(); kvSubKey != NULL; kvSubKey = kvSubKey->GetNextKey() ) + +#define FOR_EACH_TRUE_SUBKEY( kvRoot, kvSubKey ) \ + for ( KeyValues * kvSubKey = kvRoot->GetFirstTrueSubKey(); kvSubKey != NULL; kvSubKey = kvSubKey->GetNextTrueSubKey() ) + +#define FOR_EACH_VALUE( kvRoot, kvValue ) \ + for ( KeyValues * kvValue = kvRoot->GetFirstValue(); kvValue != NULL; kvValue = kvValue->GetNextValue() ) + //----------------------------------------------------------------------------- // Purpose: Simple recursive data access class // Used in vgui for message parameters and resource files @@ -146,6 +155,7 @@ class KeyValues const wchar_t *GetWString( const char *keyName = NULL, const wchar_t *defaultValue = L"" ); void *GetPtr( const char *keyName = NULL, void *defaultValue = (void*)0 ); Color GetColor( const char *keyName = NULL /* default value is all black */); + bool GetBool( const char *keyName = NULL, bool defaultValue = false ) { return GetInt( keyName, defaultValue ? 1 : 0 ) ? true : false; } bool IsEmpty(const char *keyName = NULL); // Data access @@ -155,6 +165,7 @@ class KeyValues const wchar_t *GetWString( int keySymbol, const wchar_t *defaultValue = L"" ); void *GetPtr( int keySymbol, void *defaultValue = (void*)0 ); Color GetColor( int keySymbol /* default value is all black */); + bool GetBool( int keySymbol, bool defaultValue = false ) { return GetInt( keySymbol, defaultValue ? 1 : 0 ) ? true : false; } bool IsEmpty( int keySymbol ); // Key writing @@ -354,4 +365,13 @@ inline bool KeyValues::IsEmpty( int keySymbol ) bool EvaluateConditional( const char *str ); +class CUtlSortVectorKeyValuesByName +{ +public: + bool Less( const KeyValues* lhs, const KeyValues* rhs, void * ) + { + return Q_stricmp( lhs->GetName(), rhs->GetName() ) < 0; + } +}; + #endif // KEYVALUES_H diff --git a/public/tier1/UtlSortVector.h b/public/tier1/UtlSortVector.h index 3844f0a63..08ad33397 100644 --- a/public/tier1/UtlSortVector.h +++ b/public/tier1/UtlSortVector.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright ? 1996-2005, Valve Corporation, All rights reserved. ======// // // $Header: $ // $NoKeywords: $ @@ -32,34 +32,62 @@ extern void *g_pUtlSortVectorQSortContext; #endif -template -class CUtlSortVector : public CUtlVector +template +class CUtlSortVectorDefaultLess { public: + bool Less( const T& lhs, const T& rhs, void * ) + { + return lhs < rhs; + } +}; - // constructor +template , class BaseVector = CUtlVector > +class CUtlSortVector : public BaseVector +{ + typedef BaseVector BaseClass; +public: + /// constructor CUtlSortVector( int nGrowSize = 0, int initSize = 0 ); CUtlSortVector( T* pMemory, int numElements ); - // inserts (copy constructs) an element in sorted order into the list + /// inserts (copy constructs) an element in sorted order into the list int Insert( const T& src ); - // Finds an element within the list using a binary search - int Find( const T& search ) const; - int FindLessOrEqual( const T& search ) const; - int FindLess( const T& search ) const; + /// inserts (copy constructs) an element in sorted order into the list if it isn't already in the list + int InsertIfNotFound( const T& src ); + + /// Finds an element within the list using a binary search. These are templatized based upon the key + /// in which case the less function must handle the Less function for key, T and T, key + template< typename TKey > + int Find( const TKey& search ) const; + template< typename TKey > + int FindLessOrEqual( const TKey& search ) const; + template< typename TKey > + int FindLess( const TKey& search ) const; - // Removes a particular element + /// Removes a particular element void Remove( const T& search ); void Remove( int i ); - // Allows methods to set a context to be used with the less function.. + /// Allows methods to set a context to be used with the less function.. void SetLessContext( void *pCtx ); - // Note that you can only use this index until sorting is redone!!! + /// A version of insertion that will produce an un-ordered list. + /// Note that you can only use this index until sorting is redone with RedoSort!!! int InsertNoSort( const T& src ); void RedoSort( bool bForceSort = false ); + /// Use this to insert at a specific insertion point; using FindLessOrEqual + /// is required for use this this. This will test that what you've inserted + /// produces a correctly ordered list. + int InsertAfter( int nElemIndex, const T &src ); + + /// finds a particular element using a linear search. Useful when used + /// in between calls to InsertNoSort and RedoSort + template< typename TKey > + int FindUnsorted( const TKey &src ) const; + protected: // No copy constructor CUtlSortVector( const CUtlSortVector & ); @@ -69,10 +97,9 @@ class CUtlSortVector : public CUtlVector int AddToTail(); int InsertBefore( int elem ); int InsertAfter( int elem ); + int InsertBefore( int elem, const T& src ); int AddToHead( const T& src ); int AddToTail( const T& src ); - int InsertBefore( int elem, const T& src ); - int InsertAfter( int elem, const T& src ); int AddMultipleToHead( int num ); int AddMultipleToTail( int num, const T *pToCopy=NULL ); int InsertMultipleBefore( int elem, int num, const T *pToCopy=NULL ); @@ -111,6 +138,9 @@ class CUtlSortVector : public CUtlVector bool m_bNeedsSort; private: + template< typename TKey > + int FindLessOrEqual( const TKey& search, bool *pFound ) const; + void QuickSort( LessFunc& less, int X, int I ); }; @@ -118,23 +148,23 @@ class CUtlSortVector : public CUtlVector //----------------------------------------------------------------------------- // constructor //----------------------------------------------------------------------------- -template -CUtlSortVector::CUtlSortVector( int nGrowSize, int initSize ) : - CUtlVector( nGrowSize, initSize ), m_pLessContext(NULL), m_bNeedsSort( false ) +template +CUtlSortVector::CUtlSortVector( int nGrowSize, int initSize ) : + m_pLessContext(NULL), BaseVector( nGrowSize, initSize ), m_bNeedsSort( false ) { } -template -CUtlSortVector::CUtlSortVector( T* pMemory, int numElements ) : - CUtlVector( pMemory, numElements ), m_pLessContext(NULL), m_bNeedsSort( false ) +template +CUtlSortVector::CUtlSortVector( T* pMemory, int numElements ) : + m_pLessContext(NULL), BaseVector( pMemory, numElements ), m_bNeedsSort( false ) { } //----------------------------------------------------------------------------- // Allows methods to set a context to be used with the less function.. //----------------------------------------------------------------------------- -template -void CUtlSortVector::SetLessContext( void *pCtx ) +template +void CUtlSortVector::SetLessContext( void *pCtx ) { m_pLessContext = pCtx; } @@ -142,36 +172,73 @@ void CUtlSortVector::SetLessContext( void *pCtx ) //----------------------------------------------------------------------------- // grows the vector //----------------------------------------------------------------------------- -template -int CUtlSortVector::Insert( const T& src ) +template +int CUtlSortVector::Insert( const T& src ) { AssertFatal( !m_bNeedsSort ); int pos = FindLessOrEqual( src ) + 1; - CUtlVector::GrowVector(); - CUtlVector::ShiftElementsRight(pos); - CopyConstruct( &CUtlVector::Element(pos), src ); + this->GrowVector(); + this->ShiftElementsRight(pos); + CopyConstruct( &this->Element(pos), src ); return pos; } -template -int CUtlSortVector::InsertNoSort( const T& src ) +template +int CUtlSortVector::InsertNoSort( const T& src ) { m_bNeedsSort = true; - int lastElement = CUtlVector::m_Size; + int lastElement = BaseVector::m_Size; // Just stick the new element at the end of the vector, but don't do a sort - CUtlVector::GrowVector(); - CUtlVector::ShiftElementsRight(lastElement); - CopyConstruct( &CUtlVector::Element(lastElement), src ); + this->GrowVector(); + this->ShiftElementsRight(lastElement); + CopyConstruct( &this->Element(lastElement), src ); return lastElement; } -template -void CUtlSortVector::QuickSort( LessFunc& less, int nLower, int nUpper ) +/// inserts (copy constructs) an element in sorted order into the list if it isn't already in the list +template +int CUtlSortVector::InsertIfNotFound( const T& src ) +{ + AssertFatal( !m_bNeedsSort ); + bool bFound; + int pos = FindLessOrEqual( src, &bFound ); + if ( bFound ) + return pos; + + ++pos; + this->GrowVector(); + this->ShiftElementsRight(pos); + CopyConstruct( &this->Element(pos), src ); + return pos; +} + +template +int CUtlSortVector::InsertAfter( int nIndex, const T &src ) +{ + int nInsertedIndex = this->BaseClass::InsertAfter( nIndex, src ); + +#ifdef DEBUG + LessFunc less; + if ( nInsertedIndex > 0 ) + { + Assert( less.Less( this->Element(nInsertedIndex-1), src, m_pLessContext ) ); + } + if ( nInsertedIndex < BaseClass::Count()-1 ) + { + Assert( less.Less( src, this->Element(nInsertedIndex+1), m_pLessContext ) ); + } +#endif + return nInsertedIndex; +} + + +template +void CUtlSortVector::QuickSort( LessFunc& less, int nLower, int nUpper ) { #ifdef _WIN32 typedef int (__cdecl *QSortCompareFunc_t)(void *context, const void *, const void *); - if ( Count() > 1 ) + if ( this->Count() > 1 ) { QSortContext_t ctx; ctx.m_pLessContext = m_pLessContext; @@ -181,48 +248,49 @@ void CUtlSortVector::QuickSort( LessFunc& less, int nLower, int nUp } #else typedef int (__cdecl *QSortCompareFunc_t)( const void *, const void *); - if ( CUtlVector::Count() > 1 ) + if ( this->Count() > 1 ) { QSortContext_t ctx; ctx.m_pLessContext = m_pLessContext; ctx.m_pLessFunc = &less; g_pUtlSortVectorQSortContext = &ctx; - qsort( CUtlVector::Base(), CUtlVector::Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector::CompareHelper ); + qsort( this->Base(), this->Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector::CompareHelper ); } #endif } -template -void CUtlSortVector::RedoSort( bool bForceSort /*= false */ ) +template +void CUtlSortVector::RedoSort( bool bForceSort /*= false */ ) { if ( !m_bNeedsSort && !bForceSort ) return; m_bNeedsSort = false; LessFunc less; - QuickSort( less, 0, CUtlVector::Count() - 1 ); + QuickSort( less, 0, this->Count() - 1 ); } //----------------------------------------------------------------------------- // finds a particular element //----------------------------------------------------------------------------- -template -int CUtlSortVector::Find( const T& src ) const +template +template < typename TKey > +int CUtlSortVector::Find( const TKey& src ) const { AssertFatal( !m_bNeedsSort ); LessFunc less; - int start = 0, end = CUtlVector::Count() - 1; + int start = 0, end = this->Count() - 1; while (start <= end) { int mid = (start + end) >> 1; - if ( less.Less( CUtlVector::Element(mid), src, m_pLessContext ) ) + if ( less.Less( this->Element(mid), src, m_pLessContext ) ) { start = mid + 1; } - else if ( less.Less( src, CUtlVector::Element(mid), m_pLessContext ) ) + else if ( less.Less( src, this->Element(mid), m_pLessContext ) ) { end = mid - 1; } @@ -235,46 +303,81 @@ int CUtlSortVector::Find( const T& src ) const } +//----------------------------------------------------------------------------- +// finds a particular element using a linear search. Useful when used +// in between calls to InsertNoSort and RedoSort +//----------------------------------------------------------------------------- +template< class T, class LessFunc, class BaseVector > +template < typename TKey > +int CUtlSortVector::FindUnsorted( const TKey &src ) const +{ + LessFunc less; + int nCount = this->Count(); + for ( int i = 0; i < nCount; ++i ) + { + if ( less.Less( this->Element(i), src, m_pLessContext ) ) + continue; + if ( less.Less( src, this->Element(i), m_pLessContext ) ) + continue; + return i; + } + return -1; +} + + //----------------------------------------------------------------------------- // finds a particular element //----------------------------------------------------------------------------- -template -int CUtlSortVector::FindLessOrEqual( const T& src ) const +template +template < typename TKey > +int CUtlSortVector::FindLessOrEqual( const TKey& src, bool *pFound ) const { AssertFatal( !m_bNeedsSort ); LessFunc less; - int start = 0, end = CUtlVector::Count() - 1; + int start = 0, end = this->Count() - 1; while (start <= end) { int mid = (start + end) >> 1; - if ( less.Less( CUtlVector::Element(mid), src, m_pLessContext ) ) + if ( less.Less( this->Element(mid), src, m_pLessContext ) ) { start = mid + 1; } - else if ( less.Less( src, CUtlVector::Element(mid), m_pLessContext ) ) + else if ( less.Less( src, this->Element(mid), m_pLessContext ) ) { end = mid - 1; } else { + *pFound = true; return mid; } } + + *pFound = false; return end; } -template -int CUtlSortVector::FindLess( const T& src ) const +template +template < typename TKey > +int CUtlSortVector::FindLessOrEqual( const TKey& src ) const +{ + bool bFound; + return FindLessOrEqual( src, &bFound ); +} + +template +template < typename TKey > +int CUtlSortVector::FindLess( const TKey& src ) const { AssertFatal( !m_bNeedsSort ); LessFunc less; - int start = 0, end = CUtlVector::Count() - 1; + int start = 0, end = this->Count() - 1; while (start <= end) { int mid = (start + end) >> 1; - if ( less.Less( CUtlVector::Element(mid), src, m_pLessContext ) ) + if ( less.Less( this->Element(mid), src, m_pLessContext ) ) { start = mid + 1; } @@ -290,22 +393,22 @@ int CUtlSortVector::FindLess( const T& src ) const //----------------------------------------------------------------------------- // Removes a particular element //----------------------------------------------------------------------------- -template -void CUtlSortVector::Remove( const T& search ) +template +void CUtlSortVector::Remove( const T& search ) { AssertFatal( !m_bNeedsSort ); int pos = Find(search); if (pos != -1) { - CUtlVector::Remove(pos); + BaseVector::Remove(pos); } } -template -void CUtlSortVector::Remove( int i ) +template +void CUtlSortVector::Remove( int i ) { - CUtlVector::Remove( i ); + BaseVector::Remove( i ); } #endif // UTLSORTVECTOR_H diff --git a/public/tier1/checksum_md5.h b/public/tier1/checksum_md5.h index 134d2b526..8f38577bc 100644 --- a/public/tier1/checksum_md5.h +++ b/public/tier1/checksum_md5.h @@ -13,6 +13,18 @@ // 16 bytes == 128 bit digest #define MD5_DIGEST_LENGTH 16 +#define MD5_BIT_LENGTH ( MD5_DIGEST_LENGTH * sizeof(unsigned char) ) +struct MD5Value_t +{ + unsigned char bits[MD5_DIGEST_LENGTH]; + + void Zero(); + bool IsZero() const; + + bool operator==( const MD5Value_t &src ) const; + bool operator!=( const MD5Value_t &src ) const; + +}; // MD5 Hash typedef struct diff --git a/public/tier1/checksum_sha1.h b/public/tier1/checksum_sha1.h new file mode 100644 index 000000000..7c87aa5c7 --- /dev/null +++ b/public/tier1/checksum_sha1.h @@ -0,0 +1,174 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Implementation of SHA-1 +// +//============================================================================= + +#ifndef CHECKSUM_SHA1_H +#define CHECKSUM_SHA1_H + +#if defined( _WIN32 ) +#pragma once +#endif + +/* + 100% free public domain implementation of the SHA-1 + algorithm by Dominik Reichl + + + === Test Vectors (from FIPS PUB 180-1) === + + SHA1("abc") = + A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D + + SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") = + 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 + + SHA1(A million repetitions of "a") = + 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +#if !defined(_MINIMUM_BUILD_) +#include // Needed for file access +#if defined( _PS3 ) +#include +#else +#include +#endif +#include // Needed for strcat and strcpy +#endif + +// If you're compiling big endian, just comment out the following line +#define SHA1_LITTLE_ENDIAN + +typedef union +{ + unsigned char c[64]; + unsigned long l[16]; +} SHA1_WORKSPACE_BLOCK; + +// SHA1 hash +const unsigned int k_cubHash = 20; +const unsigned int k_cchHash = 41; // k_cubHash * 2, plus 1 for terminator +#pragma pack( push, 1 ) +typedef unsigned char SHADigest_t[ k_cubHash ]; +#pragma pack( pop ) + +#if !defined(_MINIMUM_BUILD_) +class CSHA1 +#else +class Minimum_CSHA1 +#endif +{ +public: + // Two different formats for ReportHash(...) + enum + { + REPORT_HEX = 0, + REPORT_DIGIT = 1 + }; + + // Constructor and Destructor +#if !defined(_MINIMUM_BUILD_) + CSHA1(); + virtual ~CSHA1() ; +#else + Minimum_CSHA1() ; + ~Minimum_CSHA1() ; // no virtual destructor's in the minimal builds ! +#endif + + unsigned long m_state[5]; + unsigned long m_count[2]; + unsigned char m_buffer[64]; + unsigned char m_digest[k_cubHash]; + + void Reset(); + + // Update the hash value + void Update(unsigned char *data, unsigned int len); +#if !defined(_MINIMUM_BUILD_) + bool HashFile(char *szFileName); +#endif + + // Finalize hash and report + void Final(); +#if !defined(_MINIMUM_BUILD_) + void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX); +#endif + void GetHash(unsigned char *uDest); + +private: + // Private SHA-1 transformation + void Transform(unsigned long state[5], unsigned char buffer[64]); + + // Member variables + unsigned char m_workspace[64]; + SHA1_WORKSPACE_BLOCK *m_block; // SHA1 pointer to the byte array above +}; + +#define GenerateHash( hash, pubData, cubData ) { CSHA1 sha1; sha1.Update( (byte *)pubData, cubData ); sha1.Final(); sha1.GetHash( hash ); } + +#if !defined(_MINIMUM_BUILD_) +// hash comparison function, for use with CUtlMap/CUtlRBTree +bool HashLessFunc( SHADigest_t const &lhs, SHADigest_t const &rhs ); + +// utility class for manipulating SHA1 hashes in their compact form +struct CSHA +{ +public: + SHADigest_t m_shaDigest; + + CSHA() + { + memset( m_shaDigest, 0, k_cubHash ); + } + + explicit CSHA( const SHADigest_t rhs ) + { + memcpy( m_shaDigest, rhs, k_cubHash ); + } + + SHADigest_t &SHADigest() + { + return m_shaDigest; + } + + bool operator<( const CSHA &rhs ) const + { + return memcmp( m_shaDigest, rhs.m_shaDigest, k_cubHash ) < 0; + } + + bool operator==( const CSHA &rhs ) const + { + return memcmp( m_shaDigest, rhs.m_shaDigest, k_cubHash ) == 0; + } + + bool operator!=( const CSHA &rhs ) const + { + return !(*this == rhs); + } + + bool operator==( const SHADigest_t &rhs ) const + { + return memcmp( m_shaDigest, rhs, k_cubHash ) == 0; + } + + bool operator!=( const SHADigest_t &rhs ) const + { + return !(*this == rhs); + } + + CSHA &operator=( const SHADigest_t rhs ) + { + memcpy( m_shaDigest, rhs, k_cubHash ); + return *this; + } + + void AssignTo( SHADigest_t rhs ) const + { + memcpy( rhs, m_shaDigest, k_cubHash ); + } +}; +#endif // _MINIMUM_BUILD_ + +#endif // CHECKSUM_SHA1_H diff --git a/public/tier1/convar.h b/public/tier1/convar.h index e1d816e3b..298b4b168 100644 --- a/public/tier1/convar.h +++ b/public/tier1/convar.h @@ -68,6 +68,7 @@ void ConVar_PublishToVXConsole(); // Called when a ConCommand needs to execute //----------------------------------------------------------------------------- typedef void ( *FnCommandCallbackV1_t )( void ); +typedef void ( *FnCommandCallbackVoid_t )( void ); typedef void ( *FnCommandCallback_t )( const CCommand &command ); #define COMMAND_COMPLETION_MAXITEMS 64 diff --git a/public/tier1/fmtstr.h b/public/tier1/fmtstr.h index 50d9f9f25..2af5515d5 100644 --- a/public/tier1/fmtstr.h +++ b/public/tier1/fmtstr.h @@ -32,6 +32,7 @@ va_end(arg_ptr); \ \ (szBuf)[(nBufSize)-1] = 0; \ + m_nLength = V_strlen( szBuf ); \ } \ while (0) @@ -44,7 +45,7 @@ template class CFmtStrN { public: - CFmtStrN() { m_szBuf[0] = 0; } + CFmtStrN() { m_szBuf[0] = 0; m_nLength = 0; } // Standard C formatting CFmtStrN(const char *pszFormat, ...) { FmtStrVSNPrintf(m_szBuf, SIZE_BUF, &pszFormat); } @@ -61,11 +62,37 @@ class CFmtStrN // Use for access operator const char *() const { return m_szBuf; } char *Access() { return m_szBuf; } - - void Clear() { m_szBuf[0] = 0; } - + char *Get() { return m_szBuf; } + + void Clear() { m_szBuf[0] = 0; m_nLength = 0; } + + void Append( const char *pchValue ) + { + // This function is close to the metal to cut down on the CPU cost + // of the previous incantation of Append which was implemented as + // AppendFormat( "%s", pchValue ). This implementation, though not + // as easy to read, instead does a strcpy from the existing end + // point of the CFmtStrN. This brings something like a 10-20x speedup + // in my rudimentary tests. It isn't using V_strncpy because that + // function doesn't return the number of characters copied, which + // we need to adjust m_nLength. Doing the V_strncpy with a V_strlen + // afterwards took twice as long as this implementations in tests, + // so V_strncpy's implementation was used to write this method. + char *pDest = m_szBuf + m_nLength; + const int maxLen = SIZE_BUF - m_nLength; + char *pLast = pDest + maxLen - 1; + while ( (pDest < pLast) && (*pchValue != 0) ) + { + *pDest = *pchValue; + ++pDest; ++pchValue; + } + *pDest = 0; + m_nLength = pDest - m_szBuf; + } + private: char m_szBuf[SIZE_BUF]; + int m_nLength; }; //----------------------------------------------------------------------------- @@ -76,6 +103,77 @@ class CFmtStrN #define FMTSTR_STD_LEN 256 typedef CFmtStrN CFmtStr; +typedef CFmtStrN<1024> CFmtStr1024; +typedef CFmtStrN<8192> CFmtStrMax; + +class CNumStr +{ +public: + CNumStr() { m_szBuf[0] = 0; } + + explicit CNumStr( bool b ) { SetBool( b ); } + + explicit CNumStr( int8 n8 ) { SetInt8( n8 ); } + explicit CNumStr( uint8 un8 ) { SetUint8( un8 ); } + explicit CNumStr( int16 n16 ) { SetInt16( n16 ); } + explicit CNumStr( uint16 un16 ) { SetUint16( un16 ); } + explicit CNumStr( int32 n32 ) { SetInt32( n32 ); } + explicit CNumStr( uint32 un32 ) { SetUint32( un32 ); } + explicit CNumStr( int64 n64 ) { SetInt64( n64 ); } + explicit CNumStr( uint64 un64 ) { SetUint64( un64 ); } + +#if defined(COMPILER_GCC) && defined(PLATFORM_64BITS) + explicit CNumStr( lint64 n64 ) { SetInt64( (int64)n64 ); } + explicit CNumStr( ulint64 un64 ) { SetUint64( (uint64)un64 ); } +#endif + + explicit CNumStr( double f ) { SetDouble( f ); } + explicit CNumStr( float f ) { SetFloat( f ); } + + inline void SetBool( bool b ) { Q_memcpy( m_szBuf, b ? "1" : "0", 2 ); } + +#ifdef _WIN32 + inline void SetInt8( int8 n8 ) { _itoa( (int32)n8, m_szBuf, 10 ); } + inline void SetUint8( uint8 un8 ) { _itoa( (int32)un8, m_szBuf, 10 ); } + inline void SetInt16( int16 n16 ) { _itoa( (int32)n16, m_szBuf, 10 ); } + inline void SetUint16( uint16 un16 ) { _itoa( (int32)un16, m_szBuf, 10 ); } + inline void SetInt32( int32 n32 ) { _itoa( n32, m_szBuf, 10 ); } + inline void SetUint32( uint32 un32 ) { _i64toa( (int64)un32, m_szBuf, 10 ); } + inline void SetInt64( int64 n64 ) { _i64toa( n64, m_szBuf, 10 ); } + inline void SetUint64( uint64 un64 ) { _ui64toa( un64, m_szBuf, 10 ); } +#else + inline void SetInt8( int8 n8 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)n8 ); } + inline void SetUint8( uint8 un8 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)un8 ); } + inline void SetInt16( int16 n16 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)n16 ); } + inline void SetUint16( uint16 un16 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)un16 ); } + inline void SetInt32( int32 n32 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", n32 ); } + inline void SetUint32( uint32 un32 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%u", un32 ); } + inline void SetInt64( int64 n64 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%lld", n64 ); } + inline void SetUint64( uint64 un64 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%llu", un64 ); } +#endif + + inline void SetDouble( double f ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%.18g", f ); } + inline void SetFloat( float f ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%.18g", f ); } + + inline void SetHexUint64( uint64 un64 ) { Q_binarytohex( (byte *)&un64, sizeof( un64 ), m_szBuf, sizeof( m_szBuf ) ); } + + operator const char *() const { return m_szBuf; } + const char* String() const { return m_szBuf; } + + void AddQuotes() + { + Assert( m_szBuf[0] != '"' ); + const int nLength = Q_strlen( m_szBuf ); + Q_memmove( m_szBuf + 1, m_szBuf, nLength ); + m_szBuf[0] = '"'; + m_szBuf[nLength + 1] = '"'; + m_szBuf[nLength + 2] = 0; + } + +protected: + char m_szBuf[28]; // long enough to hold 18 digits of precision, a decimal, a - sign, e+### suffix, and quotes + +}; //============================================================================= diff --git a/public/tier1/ilocalize.h b/public/tier1/ilocalize.h new file mode 100644 index 000000000..35d8d3aca --- /dev/null +++ b/public/tier1/ilocalize.h @@ -0,0 +1,504 @@ + +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef TIER1_ILOCALIZE_H +#define TIER1_ILOCALIZE_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "appframework/IAppSystem.h" +#include + +// unicode character type +// for more unicode manipulation functions #include +#if !defined(_WCHAR_T_DEFINED) && !defined(GNUC) +typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + + +// direct references to localized strings +typedef unsigned long StringIndex_t; +const unsigned long INVALID_LOCALIZE_STRING_INDEX = (StringIndex_t) -1; + +//----------------------------------------------------------------------------- +// Purpose: Handles localization of text +// looks up string names and returns the localized unicode text +//----------------------------------------------------------------------------- +abstract_class ILocalize +{ +public: + // adds the contents of a file to the localization table + virtual bool AddFile( const char *fileName, const char *pPathID = NULL, bool bIncludeFallbackSearchPaths = false ) = 0; + + // Remove all strings from the table + virtual void RemoveAll() = 0; + + // Finds the localized text for tokenName + virtual wchar_t *Find(char const *tokenName) = 0; + + // finds the index of a token by token name, INVALID_STRING_INDEX if not found + virtual StringIndex_t FindIndex(const char *tokenName) = 0; + + // gets the values by the string index + virtual const char *GetNameByIndex(StringIndex_t index) = 0; + virtual wchar_t *GetValueByIndex(StringIndex_t index) = 0; + + /////////////////////////////////////////////////////////////////// + // the following functions should only be used by localization editors + + // iteration functions + virtual StringIndex_t GetFirstStringIndex() = 0; + // returns the next index, or INVALID_STRING_INDEX if no more strings available + virtual StringIndex_t GetNextStringIndex(StringIndex_t index) = 0; + + // adds a single name/unicode string pair to the table + virtual void AddString( const char *tokenName, wchar_t *unicodeString, const char *fileName ) = 0; + + // changes the value of a string + virtual void SetValueByIndex(StringIndex_t index, wchar_t *newValue) = 0; + + // saves the entire contents of the token tree to the file + virtual bool SaveToFile( const char *fileName ) = 0; + + // iterates the filenames + virtual int GetLocalizationFileCount() = 0; + virtual const char *GetLocalizationFileName(int index) = 0; + + // returns the name of the file the specified localized string is stored in + virtual const char *GetFileNameByIndex(StringIndex_t index) = 0; + + // for development only, reloads localization files + virtual void ReloadLocalizationFiles( ) = 0; + + virtual const char *FindAsUTF8( const char *pchTokenName ) = 0; + + // need to replace the existing ConstructString with this + virtual void ConstructString(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) wchar_t *unicodeOutput, int unicodeBufferSizeInBytes, const char *tokenName, KeyValues *localizationVariables) = 0; + virtual void ConstructString(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) wchar_t *unicodeOutput, int unicodeBufferSizeInBytes, StringIndex_t unlocalizedTextSymbol, KeyValues *localizationVariables) = 0; + + /////////////////////////////////////////////////////////////////// + // static interface + + // converts an english string to unicode + // returns the number of wchar_t in resulting string, including null terminator + static int ConvertANSIToUnicode(const char *ansi, OUT_Z_BYTECAP(unicodeBufferSizeInBytes) wchar_t *unicode, int unicodeBufferSizeInBytes); + + // converts an unicode string to an english string + // unrepresentable characters are converted to system default + // returns the number of characters in resulting string, including null terminator + static int ConvertUnicodeToANSI(const wchar_t *unicode, OUT_Z_BYTECAP(ansiBufferSize) char *ansi, int ansiBufferSize); + + // builds a localized formatted string + // uses the format strings first: %s1, %s2, ... unicode strings (wchar_t *) + template < typename T > + static void ConstructString(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) T *unicodeOuput, int unicodeBufferSizeInBytes, const T *formatString, int numFormatParameters, ...) + { + va_list argList; + va_start( argList, numFormatParameters ); + + ConstructStringVArgsInternal( unicodeOuput, unicodeBufferSizeInBytes, formatString, numFormatParameters, argList ); + + va_end( argList ); + } + + template < typename T > + static void ConstructStringVArgs(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) T *unicodeOuput, int unicodeBufferSizeInBytes, const T *formatString, int numFormatParameters, va_list argList) + { + ConstructStringVArgsInternal( unicodeOuput, unicodeBufferSizeInBytes, formatString, numFormatParameters, argList ); + } + + template < typename T > + static void ConstructString(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) T *unicodeOutput, int unicodeBufferSizeInBytes, const T *formatString, KeyValues *localizationVariables) + { + ConstructStringKeyValuesInternal( unicodeOutput, unicodeBufferSizeInBytes, formatString, localizationVariables ); + } + + + // Safe version of Construct String that has the compiler infer the buffer size + template + static void ConstructString_safe( OUT_Z_ARRAY T (&pDest)[maxLenInChars], const T *formatString, int numFormatParameters, ... ) + { + va_list argList; + va_start( argList, numFormatParameters ); + + ConstructStringVArgsInternal( pDest, maxLenInChars * sizeof( *pDest ), formatString, numFormatParameters, argList ); + + va_end( argList ); + } + + template + static void ConstructString_safe( OUT_Z_ARRAY T (&pDest)[maxLenInChars], const T *formatString, KeyValues *localizationVariables ) + { + ConstructStringKeyValuesInternal( pDest, maxLenInChars * sizeof( *pDest ), formatString, localizationVariables ); + } + + // Non-static version to be safe version of the virtual functions that utilize KVP + template + void ConstructString_safe( OUT_Z_ARRAY T( &pDest )[maxLenInChars], const char *formatString, KeyValues *localizationVariables ) + { + ConstructString( pDest, maxLenInChars * sizeof( *pDest ), formatString, localizationVariables ); + } + +private: + // internal "interface" + static void ConstructStringVArgsInternal(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) char *unicodeOutput, int unicodeBufferSizeInBytes, const char *formatString, int numFormatParameters, va_list argList); + static void ConstructStringVArgsInternal(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) wchar_t *unicodeOutput, int unicodeBufferSizeInBytes, const wchar_t *formatString, int numFormatParameters, va_list argList); + + static void ConstructStringKeyValuesInternal(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) char *unicodeOutput, int unicodeBufferSizeInBytes, const char *formatString, KeyValues *localizationVariables); + static void ConstructStringKeyValuesInternal(OUT_Z_BYTECAP(unicodeBufferSizeInBytes) wchar_t *unicodeOutput, int unicodeBufferSizeInBytes, const wchar_t *formatString, KeyValues *localizationVariables); +}; + +#ifdef GC + + typedef char locchar_t; + + #define loc_snprintf Q_snprintf + #define loc_sprintf_safe V_sprintf_safe + #define loc_sncat Q_strncat + #define loc_scat_safe V_strcat_safe + #define loc_sncpy Q_strncpy + #define loc_scpy_safe V_strcpy_safe + #define loc_strlen Q_strlen + #define LOCCHAR( x ) x + +#else + + typedef wchar_t locchar_t; + + #define loc_snprintf V_snwprintf + #define loc_sprintf_safe V_swprintf_safe + #define loc_sncat V_wcsncat + #define loc_scat_safe V_wcscat_safe + #define loc_sncpy Q_wcsncpy + #define loc_scpy_safe V_wcscpy_safe + #define loc_strlen Q_wcslen + #define LOCCHAR(x) L ## x + +#endif + +// -------------------------------------------------------------------------- +// Purpose: +// -------------------------------------------------------------------------- + +template < typename T > +class TypedKeyValuesStringHelper +{ +public: + static const T *Read( KeyValues *pKeyValues, const char *pKeyName, const T *pDefaultValue ); + static void Write( KeyValues *pKeyValues, const char *pKeyName, const T *pValue ); +}; + +// -------------------------------------------------------------------------- + +template < > +class TypedKeyValuesStringHelper +{ +public: + static const char *Read( KeyValues *pKeyValues, const char *pKeyName, const char *pDefaultValue ) { return pKeyValues->GetString( pKeyName, pDefaultValue ); } + static void Write( KeyValues *pKeyValues, const char *pKeyName, const char *pValue ) { pKeyValues->SetString( pKeyName, pValue ); } +}; + +// -------------------------------------------------------------------------- + +template < > +class TypedKeyValuesStringHelper +{ +public: + static const wchar_t *Read( KeyValues *pKeyValues, const char *pKeyName, const wchar_t *pDefaultValue ) { return pKeyValues->GetWString( pKeyName, pDefaultValue ); } + static void Write( KeyValues *pKeyValues, const char *pKeyName, const wchar_t *pValue ) { pKeyValues->SetWString( pKeyName, pValue ); } +}; + +// -------------------------------------------------------------------------- +// Purpose: CLocalizedStringArg<> is a class that will take a variable of any +// arbitary type and convert it to a string of whatever character type +// we're using for localization (locchar_t). +// +// Independently it isn't very useful, though it can be used to sort-of- +// intelligently fill out the correct format string. It's designed to be +// used for the arguments of CConstructLocalizedString, which can be of +// arbitrary number and type. +// +// If you pass in a (non-specialized) pointer, the code will assume that +// you meant that pointer to be used as a localized string. This will +// still fail to compile if some non-string type is passed in, but will +// handle weird combinations of const/volatile/whatever automatically. +// -------------------------------------------------------------------------- + +// The base implementation doesn't do anything except fail to compile if you +// use it. Getting an "incomplete type" error here means that you tried to construct +// a localized string with a type that doesn't have a specialization. +template < typename T > +class CLocalizedStringArg; + +// -------------------------------------------------------------------------- + +template < typename T > +class CLocalizedStringArgStringImpl +{ +public: + enum { kIsValid = true }; + + CLocalizedStringArgStringImpl( const locchar_t *pStr ) : m_pStr( pStr ) { } + + const locchar_t *GetLocArg() const { Assert( m_pStr ); return m_pStr; } + +private: + const locchar_t *m_pStr; +}; + +// -------------------------------------------------------------------------- + +template < typename T > +class CLocalizedStringArg : public CLocalizedStringArgStringImpl +{ +public: + CLocalizedStringArg( const locchar_t *pStr ) : CLocalizedStringArgStringImpl( pStr ) { } +}; + +// -------------------------------------------------------------------------- + +template < typename T > +class CLocalizedStringArgPrintfImpl +{ +public: + enum { kIsValid = true }; + + CLocalizedStringArgPrintfImpl( T value, const locchar_t *loc_Format ) { loc_snprintf( m_cBuffer, kBufferSize, loc_Format, value ); } + + const locchar_t *GetLocArg() const { return m_cBuffer; } + +private: + enum { kBufferSize = 128, }; + locchar_t m_cBuffer[ kBufferSize ]; +}; + +// -------------------------------------------------------------------------- + +template < > +class CLocalizedStringArg : public CLocalizedStringArgPrintfImpl +{ +public: + CLocalizedStringArg( uint16 unValue ) : CLocalizedStringArgPrintfImpl( unValue, LOCCHAR("%u") ) { } +}; + +// -------------------------------------------------------------------------- + +template < > +class CLocalizedStringArg : public CLocalizedStringArgPrintfImpl +{ +public: + CLocalizedStringArg( uint32 unValue ) : CLocalizedStringArgPrintfImpl( unValue, LOCCHAR("%u") ) { } +}; + +// -------------------------------------------------------------------------- + +template < > +class CLocalizedStringArg : public CLocalizedStringArgPrintfImpl +{ +public: + CLocalizedStringArg( uint64 unValue ) : CLocalizedStringArgPrintfImpl( unValue, LOCCHAR("%llu") ) { } +}; + +// -------------------------------------------------------------------------- + +template < > +class CLocalizedStringArg : public CLocalizedStringArgPrintfImpl +{ +public: + // Display one decimal point if we've got a value less than one, and no point + // if we're greater than one or are effectively zero. + CLocalizedStringArg( float fValue ) + : CLocalizedStringArgPrintfImpl( fValue, + fabsf( fValue ) <= FLT_EPSILON || fabsf( fValue ) >= 1.0f ? LOCCHAR("%.0f") : LOCCHAR("%.1f") ) + { + // + } +}; + +// -------------------------------------------------------------------------- +// Purpose: +// -------------------------------------------------------------------------- +class CConstructLocalizedString +{ +public: + template < typename T > + CConstructLocalizedString( const locchar_t *loc_Format, T arg0 ) + { + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + + m_loc_Buffer[0] = '\0'; + + if ( loc_Format ) + { + ::ILocalize::ConstructString( m_loc_Buffer, sizeof( m_loc_Buffer ), loc_Format, 1, CLocalizedStringArg( arg0 ).GetLocArg() ); + } + } + + template < typename T, typename U > + CConstructLocalizedString( const locchar_t *loc_Format, T arg0, U arg1 ) + { + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + + m_loc_Buffer[0] = '\0'; + + if ( loc_Format ) + { + ::ILocalize::ConstructString( m_loc_Buffer, sizeof( m_loc_Buffer ), loc_Format, 2, CLocalizedStringArg( arg0 ).GetLocArg(), CLocalizedStringArg( arg1 ).GetLocArg() ); + } + } + + template < typename T, typename U, typename V > + CConstructLocalizedString( const locchar_t *loc_Format, T arg0, U arg1, V arg2 ) + { + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + + m_loc_Buffer[0] = '\0'; + + if ( loc_Format ) + { + ::ILocalize::ConstructString( m_loc_Buffer, + sizeof( m_loc_Buffer ), + loc_Format, + 3, + CLocalizedStringArg( arg0 ).GetLocArg(), + CLocalizedStringArg( arg1 ).GetLocArg(), + CLocalizedStringArg( arg2 ).GetLocArg() ); + } + } + + template < typename T, typename U, typename V, typename W > + CConstructLocalizedString( const locchar_t *loc_Format, T arg0, U arg1, V arg2, W arg3 ) + { + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + + m_loc_Buffer[0] = '\0'; + + if ( loc_Format ) + { + ::ILocalize::ConstructString( m_loc_Buffer, + sizeof( m_loc_Buffer ), + loc_Format, + 4, + CLocalizedStringArg( arg0 ).GetLocArg(), + CLocalizedStringArg( arg1 ).GetLocArg(), + CLocalizedStringArg( arg2 ).GetLocArg(), + CLocalizedStringArg( arg3 ).GetLocArg() ); + } + } + + template < typename T, typename U, typename V, typename W, typename X > + CConstructLocalizedString( const locchar_t *loc_Format, T arg0, U arg1, V arg2, W arg3, X arg4 ) + { + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + + m_loc_Buffer[0] = '\0'; + + if ( loc_Format ) + { + ::ILocalize::ConstructString( m_loc_Buffer, + sizeof( m_loc_Buffer ), + loc_Format, + 5, + CLocalizedStringArg( arg0 ).GetLocArg(), + CLocalizedStringArg( arg1 ).GetLocArg(), + CLocalizedStringArg( arg2 ).GetLocArg(), + CLocalizedStringArg( arg3 ).GetLocArg(), + CLocalizedStringArg( arg4 ).GetLocArg() ); + } + } + + template < typename T, typename U, typename V, typename W, typename X, typename Y > + CConstructLocalizedString( const locchar_t *loc_Format, T arg0, U arg1, V arg2, W arg3, X arg4, Y arg5 ) + { + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + + m_loc_Buffer[0] = '\0'; + + if ( loc_Format ) + { + ::ILocalize::ConstructString( m_loc_Buffer, + sizeof( m_loc_Buffer ), + loc_Format, + 6, + CLocalizedStringArg( arg0 ).GetLocArg(), + CLocalizedStringArg( arg1 ).GetLocArg(), + CLocalizedStringArg( arg2 ).GetLocArg(), + CLocalizedStringArg( arg3 ).GetLocArg(), + CLocalizedStringArg( arg4 ).GetLocArg(), + CLocalizedStringArg( arg5 ).GetLocArg() ); + } + } + + template < typename T, typename U, typename V, typename W, typename X, typename Y, typename Z > + CConstructLocalizedString( const locchar_t *loc_Format, T arg0, U arg1, V arg2, W arg3, X arg4, Y arg5, Z arg6) + { + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + COMPILE_TIME_ASSERT( CLocalizedStringArg::kIsValid ); + + m_loc_Buffer[0] = '\0'; + + if ( loc_Format ) + { + ::ILocalize::ConstructString( m_loc_Buffer, + sizeof( m_loc_Buffer ), + loc_Format, + 7, + CLocalizedStringArg( arg0 ).GetLocArg(), + CLocalizedStringArg( arg1 ).GetLocArg(), + CLocalizedStringArg( arg2 ).GetLocArg(), + CLocalizedStringArg( arg3 ).GetLocArg(), + CLocalizedStringArg( arg4 ).GetLocArg(), + CLocalizedStringArg( arg5 ).GetLocArg(), + CLocalizedStringArg( arg6 ).GetLocArg() ); + } + } + + CConstructLocalizedString( const locchar_t *loc_Format, KeyValues *pKeyValues ) + { + m_loc_Buffer[0] = '\0'; + + if ( loc_Format && pKeyValues ) + { + ::ILocalize::ConstructString( m_loc_Buffer, sizeof( m_loc_Buffer ), loc_Format, pKeyValues ); + } + } + + operator const locchar_t *() const + { + return m_loc_Buffer; + } + +private: + enum { kBufferSize = 512, }; + locchar_t m_loc_Buffer[ kBufferSize ]; +}; + +#endif // TIER1_ILOCALIZE_H diff --git a/public/tier1/kvpacker.h b/public/tier1/kvpacker.h new file mode 100644 index 000000000..7e47fa1a9 --- /dev/null +++ b/public/tier1/kvpacker.h @@ -0,0 +1,49 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef KVPACKER_H +#define KVPACKER_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "KeyValues.h" + +//----------------------------------------------------------------------------- +// Purpose: Handles packing KeyValues binary packing and unpacking in a a +// consistent way across all branches, including Steam. If you change +// this packing format you need to do so in a backward compatible way +// so that the Steam servers and all the various GCs can still talk to +// each other. +//----------------------------------------------------------------------------- +class KVPacker +{ +public: + bool WriteAsBinary( KeyValues *pNode, CUtlBuffer &buffer ); + bool ReadAsBinary( KeyValues *pNode, CUtlBuffer &buffer ); + +private: + // These types are used for serialization of KeyValues nodes. + // Do not renumber them or you will break serialization across + // branches. + enum EPackType + { + PACKTYPE_NONE = 0, + PACKTYPE_STRING, + PACKTYPE_INT, + PACKTYPE_FLOAT, + PACKTYPE_PTR, + PACKTYPE_WSTRING, + PACKTYPE_COLOR, + PACKTYPE_UINT64, + PACKTYPE_NULLMARKER, // used to mark the end of a block in the binary format + }; +}; + + +#endif // KVPACKER_H diff --git a/public/tier1/mempool.h b/public/tier1/mempool.h index 3b9278126..e3f707729 100644 --- a/public/tier1/mempool.h +++ b/public/tier1/mempool.h @@ -30,16 +30,24 @@ typedef void (*MemoryPoolReportFunc_t)( char const* pMsg, ... ); +enum MemoryPoolGrowType_t +{ + UTLMEMORYPOOL_GROW_NONE=0, // Don't allow new blobs. + UTLMEMORYPOOL_GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates + // get larger and larger each time it allocates one). + UTLMEMORYPOOL_GROW_SLOW=2 // New blob size is numElements. +}; + class CMemoryPool { public: // Ways the memory pool can grow when it needs to make a new blob. enum MemoryPoolGrowType_t { - GROW_NONE=0, // Don't allow new blobs. - GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates + GROW_NONE=UTLMEMORYPOOL_GROW_NONE, // Don't allow new blobs. + GROW_FAST=UTLMEMORYPOOL_GROW_FAST, // New blob size is numElements * (i+1) (ie: the blocks it allocates // get larger and larger each time it allocates one). - GROW_SLOW=2 // New blob size is numElements. + GROW_SLOW=UTLMEMORYPOOL_GROW_SLOW // New blob size is numElements. }; CMemoryPool( int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 ); @@ -93,6 +101,8 @@ class CMemoryPool }; +typedef CMemoryPool CUtlMemoryPool; + //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- diff --git a/public/tier1/passwordhash.h b/public/tier1/passwordhash.h new file mode 100644 index 000000000..f557c7f78 --- /dev/null +++ b/public/tier1/passwordhash.h @@ -0,0 +1,94 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Cryptographic hash agility helper definitions +// +//============================================================================= + +#ifndef PASSWORDHASH_H +#define PASSWORDHASH_H + +#if defined( _WIN32 ) +#pragma once +#endif + + +#include "checksum_sha1.h" + +typedef unsigned char BigPasswordHash_t[32]; +typedef unsigned char PBKDF2Hash_t[32]; + +// +// A union of all the possible password hash types. +// When adding to this, if the maximum size of the +// structure has changed then the Account table and +// the AccountSecurityHistory table need to be manually +// revised using something like the following SQL: +// +// ALTER TABLE Account ALTER COLUMN PasswordHash binary(32) +// ALTER TABLE AccountSecurityHistory ALTER COLUMN PasswordHashOld binary(32) +// ALTER TABLE AccountSecurityHistory ALTER COLUMN PasswordHashNew binary(32) +// +// Replace 32 with the new size of PasswordHash_t. +// +// If the width of those columns does not match sizeof(PasswordHash_t), many +// database operations will fail. +// +// Note that while this query was correct at the time this code was checked in, +// it may not be sufficient at the time you actually change the size of the +// type, so look around. +// +typedef union +{ + SHADigest_t sha; + BigPasswordHash_t bigpassword; + PBKDF2Hash_t pbkdf2; +} PasswordHash_t; + + +// +// Enum of all available password hash algorithms. These should +// be consecutive and ordinals should never be reused. +// +// k_EHashSHA1: A salted SHA-1 hash, width 20 bytes. +// k_EHashBigPassword: For testing purposes, a salted SHA-1 hash extended to 32 bytes, with 6 bytes of 0x1 on either side. +// k_EHashPBKDF2_1000: A PKCS#5 v2.0 Password-Based Key Derivation Function hash (PBKDF2-HMAC-SHA256) with 1,000 iterations. +// The digest width is 32 bytes. +// k_EHashPBKDF2_5000: A PKCS#5 v2.0 Password-Based Key Derivation Function hash (PBKDF2-HMAC-SHA256) with 5,000 iterations. +// k_EHashPBKDF2_10000: A PKCS#5 v2.0 Password-Based Key Derivation Function hash (PBKDF2-HMAC-SHA256) with 10,000 iterations. +// k_EHashSHA1WrappedWithPBKDF2_10000: A SHA-1 hash which is then further hashed with PBKDF2 at 10,000 rounds. Used for +// strengthening old hashes in the database that haven't been logged in in a long time. +// +// Make sure to update k_EHashMax when adding new hash types. Also add the length into the k_HashLengths array below. +enum EPasswordHashAlg +{ + k_EHashSHA1 = 0, + k_EHashBigPassword = 1, + k_EHashPBKDF2_1000 = 2, + k_EHashPBKDF2_5000 = 3, + k_EHashPBKDF2_10000 = 4, + k_EHashSHA1WrappedWithPBKDF2_10000 = 5, + k_EHashMax = 5, +}; + +// +// Hash sizes for the various available hash algorithms, +// indexed by EPasswordHashAlg. +const size_t k_HashLengths[] = { + sizeof(SHADigest_t), + sizeof(BigPasswordHash_t), + sizeof(PBKDF2Hash_t), + sizeof(PBKDF2Hash_t), + sizeof(PBKDF2Hash_t), + sizeof(PBKDF2Hash_t), +}; + +#if defined(C_ASSERT) +// +// If you're hitting this assert at compile time, it means that you've added a new +// hash type and properly updated k_EHashMax, but you forgot to add the length +// of the new hash type into k_HashLengths. So do that. +// +C_ASSERT( ( ( sizeof(k_HashLengths) / sizeof(size_t) ) == k_EHashMax + 1 ) ); +#endif + +#endif // PASSWORDHASH_H diff --git a/public/tier1/refcount.h b/public/tier1/refcount.h index 16318b31d..4fb20a427 100644 --- a/public/tier1/refcount.h +++ b/public/tier1/refcount.h @@ -159,8 +159,8 @@ class CRefPtr : public CBaseAutoPtr class CRefMT { public: - static int Increment( int *p) { return ThreadInterlockedIncrement( (long *)p ); } - static int Decrement( int *p) { return ThreadInterlockedDecrement( (long *)p ); } + static int Increment( int *p) { return ThreadInterlockedIncrement( (int32 *)p ); } + static int Decrement( int *p) { return ThreadInterlockedDecrement( (int32 *)p ); } }; class CRefST diff --git a/public/tier1/reliabletimer.h b/public/tier1/reliabletimer.h new file mode 100644 index 000000000..c830fbe34 --- /dev/null +++ b/public/tier1/reliabletimer.h @@ -0,0 +1,183 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef RELIABLETIMER_H +#define RELIABLETIMER_H + +#include "tier0/dbg.h" +//#include "constants.h" +#include "tier0/fasttimer.h" +#include "tier1/tier1.h" +#include "tier1/strtools.h" + +#define DbgAssert Assert +#define kMILLION (1000000) +#define kTHOUSAND (1000) + +// Timer class that uses QueryPerformanceCounter. This is heavier-weight than CFastTimer which uses rdtsc, +// but this is reliable on multi-core systems whereas CFastTimer is not. + +class CReliableTimer +{ +public: + CReliableTimer(); + void Start(); + void End(); + int64 GetMicroseconds(); + int64 GetMilliseconds(); + void SetLimit( uint64 m_cMicroSecDuration ); + bool BLimitReached(); + int64 CMicroSecOverage(); + int64 CMicroSecLeft(); + int64 CMilliSecLeft(); +private: + int64 GetPerformanceCountNow(); + + int64 m_nPerformanceCounterStart; + int64 m_nPerformanceCounterEnd; + int64 m_nPerformanceCounterLimit; + + static int64 sm_nPerformanceFrequency; + static bool sm_bUseQPC; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Records timer start time +//----------------------------------------------------------------------------- +inline void CReliableTimer::Start() +{ + m_nPerformanceCounterStart = GetPerformanceCountNow(); +} + +//----------------------------------------------------------------------------- +// Purpose: Records timer end time +//----------------------------------------------------------------------------- +inline void CReliableTimer::End() +{ + m_nPerformanceCounterEnd = GetPerformanceCountNow(); + + // enforce that we've advanced at least one cycle + if ( m_nPerformanceCounterEnd < m_nPerformanceCounterStart ) + { +#ifdef _SERVER + if ( m_nPerformanceCounterEnd+10000 < m_nPerformanceCounterStart ) + AssertMsgOnce( false, CDbgFmtMsg( "CReliableTimer went backwards - start:%lld end:%lld", m_nPerformanceCounterStart, m_nPerformanceCounterEnd ).ToString() ); +#endif + m_nPerformanceCounterEnd = m_nPerformanceCounterStart + 1; + } +} + + +//----------------------------------------------------------------------------- +// Purpose: Gets microseconds elapsed between start and end +//----------------------------------------------------------------------------- +inline int64 CReliableTimer::GetMicroseconds() +{ + DbgAssert( m_nPerformanceCounterStart ); // timer must have been started + DbgAssert( m_nPerformanceCounterEnd ); // timer must have been ended + DbgAssert( 0 != sm_nPerformanceFrequency ); // must have calc'd performance counter frequency + return ( ( m_nPerformanceCounterEnd - m_nPerformanceCounterStart ) * kMILLION / sm_nPerformanceFrequency ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Gets microseconds elapsed between start and end +//----------------------------------------------------------------------------- +inline int64 CReliableTimer::GetMilliseconds() +{ + DbgAssert( m_nPerformanceCounterStart ); // timer must have been started + DbgAssert( m_nPerformanceCounterEnd ); // timer must have been ended + DbgAssert( 0 != sm_nPerformanceFrequency ); // must have calc'd performance counter frequency + return ( ( m_nPerformanceCounterEnd - m_nPerformanceCounterStart ) * kTHOUSAND / sm_nPerformanceFrequency ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Sets a limit on this timer that can subsequently be checked against +//----------------------------------------------------------------------------- +inline void CReliableTimer::SetLimit( uint64 cMicroSecDuration ) +{ + DbgAssert( 0 != sm_nPerformanceFrequency ); // must have calc'd performance counter frequency + m_nPerformanceCounterStart = GetPerformanceCountNow(); + m_nPerformanceCounterLimit = m_nPerformanceCounterStart + ( ( cMicroSecDuration * sm_nPerformanceFrequency ) / kMILLION ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Returns if previously set limit has been reached +//----------------------------------------------------------------------------- +inline bool CReliableTimer::BLimitReached() +{ + DbgAssert( m_nPerformanceCounterStart ); // SetLimit must have been called + DbgAssert( m_nPerformanceCounterLimit ); // SetLimit must have been called + int64 nPerformanceCountNow = GetPerformanceCountNow(); + + // make sure time advances + if ( nPerformanceCountNow < m_nPerformanceCounterStart ) + { +#ifdef _SERVER + if ( nPerformanceCountNow+10000 < m_nPerformanceCounterStart ) + AssertMsgOnce( false, CDbgFmtMsg( "CReliableTimer went backwards - start:%lld end:%lld", m_nPerformanceCounterStart, m_nPerformanceCounterEnd ).ToString() ); +#endif + // reset the limit to be lower, to match our new clock + m_nPerformanceCounterLimit = nPerformanceCountNow + (m_nPerformanceCounterLimit - m_nPerformanceCounterStart); + } + + return ( nPerformanceCountNow >= m_nPerformanceCounterLimit ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Returns microseconds current time is past limit, or 0 if not past limit +//----------------------------------------------------------------------------- +inline int64 CReliableTimer::CMicroSecOverage() +{ + DbgAssert( m_nPerformanceCounterStart ); // SetLimit must have been called + DbgAssert( m_nPerformanceCounterLimit ); // SetLimit must have been called + int64 nPerformanceCountNow = GetPerformanceCountNow(); +#ifdef _SERVER + if ( nPerformanceCountNow+10000 < m_nPerformanceCounterStart ) + AssertMsgOnce( nPerformanceCountNow >= m_nPerformanceCounterStart, CDbgFmtMsg( "CReliableTimer went backwards - start:%lld end:%lld", m_nPerformanceCounterStart, m_nPerformanceCounterEnd ).ToString() ); +#endif + int64 nPerformanceCountOver = ( nPerformanceCountNow > m_nPerformanceCounterLimit ? + nPerformanceCountNow - m_nPerformanceCounterLimit : 0 ); + + Assert( 0 != sm_nPerformanceFrequency ); // must have calc'd performance counter frequency + return ( nPerformanceCountOver * kMILLION / sm_nPerformanceFrequency ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Returns microseconds remaining until limit +//----------------------------------------------------------------------------- +inline int64 CReliableTimer::CMicroSecLeft() +{ + DbgAssert( m_nPerformanceCounterStart ); // SetLimit must have been called + DbgAssert( m_nPerformanceCounterLimit ); // SetLimit must have been called + int64 nPerformanceCountNow = GetPerformanceCountNow(); +#ifdef _SERVER + if ( nPerformanceCountNow+10000 < m_nPerformanceCounterStart ) + AssertMsgOnce( nPerformanceCountNow >= m_nPerformanceCounterStart, CDbgFmtMsg( "CReliableTimer went backwards - start:%lld end:%lld", m_nPerformanceCounterStart, m_nPerformanceCounterEnd ).ToString() ); +#endif + int64 nPerformanceCountLeft = ( nPerformanceCountNow < m_nPerformanceCounterLimit ? + m_nPerformanceCounterLimit - nPerformanceCountNow : 0 ); + + DbgAssert( 0 != sm_nPerformanceFrequency ); // must have calc'd performance counter frequency + return ( nPerformanceCountLeft * kMILLION / sm_nPerformanceFrequency ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Returns milliseconds remaining until limit +//----------------------------------------------------------------------------- +inline int64 CReliableTimer::CMilliSecLeft() +{ + return CMicroSecLeft() / 1000; +} + + +#endif // TICKLIMITTIMER_H diff --git a/public/tier1/smartptr.h b/public/tier1/smartptr.h index fa17a792c..24a82199c 100644 --- a/public/tier1/smartptr.h +++ b/public/tier1/smartptr.h @@ -66,10 +66,10 @@ class CPlainAutoPtr { public: explicit CPlainAutoPtr( T *p = NULL ) : m_p( p ) {} - ~CPlainAutoPtr( void ) { Delete(); } + ~CPlainAutoPtr( void ) { this->Delete(); } public: - void Delete( void ) { delete Detach(); } + void Delete( void ) { delete this->Detach(); } private: // Disallow copying, use Detach() instead to avoid ambiguity CPlainAutoPtr( CPlainAutoPtr const &x ); @@ -82,8 +82,8 @@ class CPlainAutoPtr public: bool IsValid( void ) const { return m_p != NULL; } T * Get( void ) const { return m_p; } - T * operator -> ( void ) const { return Get(); } - T & operator * ( void ) const { return *Get(); } + T * operator -> ( void ) const { return this->Get(); } + T & operator * ( void ) const { return *this->Get(); } private: T * m_p; @@ -107,14 +107,14 @@ template < typename T > class CArrayAutoPtr : public CPlainAutoPtr < T > // Warning: no polymorphic destructor (delete on base class will be a mistake) { public: - explicit CArrayAutoPtr( T *p = NULL ) { Attach( p ); } - ~CArrayAutoPtr( void ) { Delete(); } + explicit CArrayAutoPtr( T *p = NULL ) { this->Attach( p ); } + ~CArrayAutoPtr( void ) { this->Delete(); } public: - void Delete( void ) { delete [] Detach(); } + void Delete( void ) { delete [] this->Detach(); } public: - T & operator [] ( int k ) const { return Get()[ k ]; } + T & operator [] ( int k ) const { return this->Get()[ k ]; } }; diff --git a/public/tier1/thash.h b/public/tier1/thash.h new file mode 100644 index 000000000..51020749e --- /dev/null +++ b/public/tier1/thash.h @@ -0,0 +1,698 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef THASH_H +#define THASH_H +#ifdef _WIN32 +#pragma once +#endif + +#include + +//#define DBGFLAG_THASH // Perform extra sanity checks on the THash + + +// THash +// This is a heavyweight, templatized version of DHash. +// It differs from DHash in the following ways: +// - It's templetized, and automatically constructs and destructs its records as appropriate +// - It provides a scheduling service, which can be used to touch every record in the table +// at a specified interval. The scheduler is low-overhead, and provides a very smooth +// distribution of touches across frames. + +// Template arguments: +// Data: the class to be stored in the hash table +// I: the type of the primary key (uint32 by default) +template +class CTHash +{ +private: + // RecHdr + // We insert one of these at the beginning of every record. It's used for + // keeping the records in a linked list. + typedef struct RecHdr_t + { + RecHdr_t *m_pRecHdrNext; // Next item in our linked list + RecHdr_t *m_pRecHdrPrev; // Previous item in our linked list + I m_unKey; // Key of this item + int m_iBucket; // The bucket we're in + int m_nRunRatio; // We want to run 1 cycle out of every m_nRunRatio + // cycles (not at all if 0). +#ifdef DBGFLAG_THASH + uint m_iCycleLast; // Last cycle we were visited (whether or not we ran) +#endif + } RecHdr_t; + + // Bucket + // Each hash bucket is represented by a Bucket structure, which points to the + // first record with the bucket's hash. + typedef struct Bucket_t + { + RecHdr_t *m_pRecHdrFirst; // First record in our list + } Bucket_t; + + +public: + // Constructors & destructors + CTHash( int cFramesPerCycle ); + ~CTHash(); + + // Initializer + void Init( int cRecordInit, int cBuckets ); + + // Insert a record into the table + Data *PvRecordInsert( I unKey ); + // Insert a record into the table and set the allocated object's pointer as the hash key + Data *PvRecordInsertAutoKey(); + // Changes the key for a previously inserted item + void ChangeKey( Data * pvRecord, I unOldKey, I unNewKey ); + + // Remove a record + void Remove( I unKey ); + // Remove a record + void Remove( Data * pvRecord ); + // Remove all records + void RemoveAll(); + + // Find a record + Data *PvRecordFind( I unKey ) const; + + // How many records do we have + int Count() const { return m_cRecordInUse; } + + // Iterate through our members + Data *PvRecordFirst() const; + Data *PvRecordNext( Data *pvRecordCur ) const; + + // We provide a scheduling service. Call StartFrameSchedule when you want to start running + // records in a given frame, and repeatedly call PvRecordRun until it returns NULL (or you + // run our of time). + void SetRunRatio( Data *pvRecord, int nRunRatio ); + void SetMicroSecPerCycle( int cMicroSecPerCycle, int cMicroSecPerFrame ) { m_cFramesPerCycle = cMicroSecPerCycle / cMicroSecPerFrame; } + void StartFrameSchedule( bool bNewFrame ); + Data *PvRecordRun(); + + bool BCompletedPass(); + +#ifdef DBGFLAG_VALIDATE + virtual void Validate( CValidator &validator, const char *pchName ); +#endif // DBGFLAG_VALIDATE + + +private: + // Insert a record into the table + Data *PvRecordInsertInternal( RecHdr_t *pRecHdr, I unKey ); + + // Get the record associated with a THashHdr + Data *PvRecordFromPRecHdr( RecHdr_t *pRecHdr ) const { return ( Data * ) ( ( ( uint8 * ) pRecHdr + sizeof( RecHdr_t ) ) ); } + + // Get the RecHdr preceding a PvRecord + RecHdr_t *PRecHdrFromPvRecord( Data *pvRecord ) const { return ( ( ( RecHdr_t * ) pvRecord ) - 1 ); } + + // Get the hash bucket corresponding to a key + int IBucket( I unKey ) const; + + void InsertIntoHash( RecHdr_t *pRecHdr, I unKey ); + void RemoveFromHash( Data * pvRecord ); + + int m_cBucket; // # of hash buckets we have + Bucket_t *m_pBucket; // Big array of hash buckets + + CUtlMemoryPool *m_pMemoryPoolRecord; // All our data records + + int m_cRecordInUse; // # of records in use + RecHdr_t m_RecHdrHead; // Head of our linked list + RecHdr_t m_RecHdrTail; // Tail of our linked list + + int m_cFramesPerCycle; // Run each of our records once every m_cFramesPerCycle frames + RecHdr_t *m_pRecHdrRunNext; // Next record to run (be careful-- this is more complicated than it sounds) + int m_iBucketRunMax; // Stop running when we get to this bucket + uint m_iCycleCur; // Current cycle (ie, how many times we've made a complete scheduler pass) + uint m_iCycleLast; // Our previous cycle + uint m_iFrameCur; // Our current frame (incremented once each StartFrameSchedule) + uint m_iCycleLastReported; // Last cycle checked by BCompletedPass() +}; + + +//----------------------------------------------------------------------------- +// Purpose: Constructor +// Input: cMicroSecRunInterval - How often we want the scheduler to run each of our records +//----------------------------------------------------------------------------- +template +CTHash::CTHash( int cFramesPerCycle ) +{ + m_cBucket = 0; + m_pBucket = NULL; + m_pMemoryPoolRecord = NULL; + m_cRecordInUse = 0; + + m_cFramesPerCycle = cFramesPerCycle; + m_pRecHdrRunNext = &m_RecHdrTail; // This will make us start at the beginning on our first frame + m_iBucketRunMax = 0; + m_iCycleCur = 0; + m_iCycleLast = 0; + m_iFrameCur = 0; + m_iCycleLastReported = 0; + + m_RecHdrHead.m_pRecHdrPrev = NULL; + m_RecHdrHead.m_pRecHdrNext = &m_RecHdrTail; + m_RecHdrHead.m_iBucket = -1; + + m_RecHdrTail.m_pRecHdrPrev = &m_RecHdrHead; + m_RecHdrTail.m_pRecHdrNext = NULL; +} + + +//----------------------------------------------------------------------------- +// Purpose: Destructor +//----------------------------------------------------------------------------- +template +CTHash::~CTHash() +{ + RemoveAll(); + + if ( NULL != m_pBucket ) + FreePv( m_pBucket ); + m_pBucket = NULL; + + if ( NULL != m_pMemoryPoolRecord ) + delete( m_pMemoryPoolRecord ); + m_pMemoryPoolRecord = NULL; +} + + +//----------------------------------------------------------------------------- +// Purpose: Initializer. Allocate our various arrays, and set up the free +// list. +// Input: cRecordInit - Initial # of data records we can contain +// cBucket - # of hash buckets we should use +//----------------------------------------------------------------------------- +template +void CTHash::Init( int cRecordInit, int cBucket ) +{ + Assert( cRecordInit > 0 ); // need to init with non-zero value or memory pool will never grow + + // Copy our parameters + m_cBucket = cBucket; + + // Alloc our arrays + m_pBucket = ( Bucket_t * ) PvAlloc( sizeof( Bucket_t ) * m_cBucket ); + m_pMemoryPoolRecord = new CUtlMemoryPool( sizeof( Data ) + sizeof( RecHdr_t ), cRecordInit, + CUtlMemoryPool::GROW_SLOW ); + + // Init the hash buckets + for ( int iBucket = 0; iBucket < m_cBucket; iBucket++ ) + m_pBucket[iBucket].m_pRecHdrFirst = NULL; + + // Make the tail have an illegally large bucket + m_RecHdrTail.m_iBucket = m_cBucket + 1; +} + + +//----------------------------------------------------------------------------- +// Purpose: Inserts a new record into the table +// Input: unKey - Primary key of the new record +// Output: Pointer to the new record +//----------------------------------------------------------------------------- +template +Data *CTHash::PvRecordInsert( I unKey ) +{ + Assert( PvRecordFind( unKey ) == NULL ); // keys are unique; no record with this key may exist + + // Find a free record + RecHdr_t *pRecHdr = ( RecHdr_t * ) m_pMemoryPoolRecord->Alloc(); + + return PvRecordInsertInternal( pRecHdr, unKey ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Inserts a new record into the table and sets its key to the pointer +// value of the record +// Output: Pointer to the new record +//----------------------------------------------------------------------------- +template +Data *CTHash::PvRecordInsertAutoKey() +{ + // Find a free record + RecHdr_t *pRecHdr = ( RecHdr_t * ) m_pMemoryPoolRecord->Alloc(); + + return PvRecordInsertInternal( pRecHdr, (I) PvRecordFromPRecHdr( pRecHdr ) ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Inserts an allocated record into the hash table with specified key +// and calls the constructor of the allocated object +// Input: pRecHdr - record to insert +// unKey - hash key to use for record +// Output: Pointer to the new record +//----------------------------------------------------------------------------- +template +Data *CTHash::PvRecordInsertInternal( RecHdr_t *pRecHdr, I unKey ) +{ + InsertIntoHash( pRecHdr, unKey ); + + // assert that we don't have too many items per bucket + static bool s_bPerfWarning = false; + if ( !s_bPerfWarning && Count() >= ( 5 * m_cBucket ) ) + { + s_bPerfWarning = true; + AssertMsg( false, "Performance warning: too many items, not enough buckets" ); + Msg( "not enough buckets in thash class %s (%d records, %d buckets)\n", +#ifdef _WIN32 + typeid(*this).raw_name(), +#else + typeid(*this).name(), +#endif + Count(), m_cBucket ); + } + + // Construct ourselves + Data *pData = PvRecordFromPRecHdr( pRecHdr ); + Construct( pData ); + return pData; +} + +//----------------------------------------------------------------------------- +// Purpose: Changes key on previously inserted item +// Input: pvRecord - record to change key for +// unOldKey - old key (not strictly needed, but helpful consistency check) +// unNewKey - new key to use +//----------------------------------------------------------------------------- +template +void CTHash::ChangeKey( Data * pvRecord, I unOldKey, I unNewKey ) +{ + Data * pvRecordFound = PvRecordFind( unOldKey ); + Assert( pvRecordFound == pvRecord ); + if ( pvRecordFound == pvRecord ) + { + RemoveFromHash( pvRecord ); + InsertIntoHash( PRecHdrFromPvRecord( pvRecord), unNewKey ); + } +} + + +//----------------------------------------------------------------------------- +// Purpose: Removes the entry with a specified key from the table +// Input: unKey - Key of the entry to remove +//----------------------------------------------------------------------------- +template +void CTHash::Remove( I unKey ) +{ + Data *pvRemove = ( Data * ) PvRecordFind( unKey ); + Assert( pvRemove ); + if ( !pvRemove ) + return; + Remove( pvRemove ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Removes the specified entry from the table +// Input: pvRemove - Pointer to the entry to remove +//----------------------------------------------------------------------------- +template +void CTHash::Remove( Data * pvRemove ) +{ + // Destruct the record we're removing + Destruct( pvRemove ); + + RemoveFromHash( pvRemove ); + m_pMemoryPoolRecord->Free( PRecHdrFromPvRecord( pvRemove ) ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Removes all entries from the table +//----------------------------------------------------------------------------- +template +void CTHash::RemoveAll() +{ + Data * pvRecord = PvRecordFirst(); + while ( pvRecord ) + { + Data *pvRecordNext = PvRecordNext( pvRecord ); + Remove( pvRecord ); + pvRecord = pvRecordNext; + } +} + +//----------------------------------------------------------------------------- +// Purpose: Finds the entry with a specified key +// Input: unKey - Key to find +//----------------------------------------------------------------------------- +template +Data *CTHash::PvRecordFind( I unKey ) const +{ + // Find our hash bucket + int iBucket = IBucket( unKey ); + + // Walk the bucket's list looking for an exact match + for ( RecHdr_t *pRecHdr = m_pBucket[iBucket].m_pRecHdrFirst; + NULL != pRecHdr && pRecHdr->m_iBucket == iBucket; + pRecHdr = pRecHdr->m_pRecHdrNext ) + { + if ( unKey == pRecHdr->m_unKey ) + return PvRecordFromPRecHdr( pRecHdr ); + } + + // Didn't find a match + return NULL; +} + + +//----------------------------------------------------------------------------- +// Purpose: Finds our first record +// Output: Pointer to our first record +//----------------------------------------------------------------------------- +template +Data *CTHash::PvRecordFirst() const +{ + if ( &m_RecHdrTail != m_RecHdrHead.m_pRecHdrNext ) + return PvRecordFromPRecHdr( m_RecHdrHead.m_pRecHdrNext ); + else + return NULL; +} + + +//----------------------------------------------------------------------------- +// Purpose: Iterates to the record after a given record +// Input: Pointer to a current record +// Output: Pointer to the next record +//----------------------------------------------------------------------------- +template +Data *CTHash::PvRecordNext( Data *pvRecordCur ) const +{ + RecHdr_t *pRecHdr = PRecHdrFromPvRecord( pvRecordCur ); + if ( &m_RecHdrTail == pRecHdr->m_pRecHdrNext ) + return NULL; + + return PvRecordFromPRecHdr( pRecHdr->m_pRecHdrNext ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Sets the run ratio of a particular record in the hash table. +// The record will be run 1 cycle out of every nRunRatio cycles. +// Input: pvRecord - The record we're setting +// nRunRatio - The run ratio for this record +//----------------------------------------------------------------------------- +template +void CTHash::SetRunRatio( Data *pvRecord, int nRunRatio ) +{ + PRecHdrFromPvRecord( pvRecord )->m_nRunRatio = nRunRatio; +} + + +//----------------------------------------------------------------------------- +// Purpose: Prepares us to run all records that are due to be run this frame. +// Records are run at a particular time dependent on their hash bucket, +// regardless of when they were last run. +// Input: bNewFrame - True if this is a new frame. If false, we've run +// off the end of the list and are checking whether +// we need to keep going at the beginning. +//----------------------------------------------------------------------------- +template +void CTHash::StartFrameSchedule( bool bNewFrame ) +{ + // Calculate our current frame and cycle cycle + if ( bNewFrame ) + { + m_iCycleLast = m_iCycleCur; + m_iFrameCur++; + m_iCycleCur = m_iFrameCur / m_cFramesPerCycle; + } + + // Calculate the last bucket to run + int iFrameInCycle = m_iFrameCur % m_cFramesPerCycle; + m_iBucketRunMax = ( int ) ( ( ( int64 ) ( iFrameInCycle + 1 ) * ( int64 ) m_cBucket ) + / ( int64 ) m_cFramesPerCycle ); + AssertFatal( m_iBucketRunMax >= 0 && m_iBucketRunMax <= m_cBucket ); + + // Are we starting a new cycle? + if ( m_iCycleCur > m_iCycleLast ) + { +#ifdef DBGFLAG_THASH + Assert( m_iCycleCur == m_iCycleLast + 1 ); +#endif + + // Did we finish the last cycle? + if ( &m_RecHdrTail == m_pRecHdrRunNext ) + { + m_pRecHdrRunNext = m_RecHdrHead.m_pRecHdrNext; + } + // No-- finish it up before moving on + else + { + m_iBucketRunMax = m_cBucket + 1; + } + } +} + + +//----------------------------------------------------------------------------- +// Purpose: Returns the next record to run, if any +// Output: Pointer to the next record that needs to run (NULL if we're done) +//----------------------------------------------------------------------------- +template +Data *CTHash::PvRecordRun() +{ + // Loop until we find a record to run, or until we pass m_iBucketRunMax + for ( ; ; ) + { + // Are we past our stopping point? + if ( m_pRecHdrRunNext->m_iBucket >= m_iBucketRunMax ) + { + // If this cycle ran to the very end, see if we need to start over + if ( m_iBucketRunMax > m_cBucket ) + { + StartFrameSchedule( false ); + continue; + } + + return NULL; + } + +#ifdef DBGFLAG_THASH + Assert( m_pRecHdrRunNext->m_iBucket >= m_iBucketRunFirst ); + if ( 0 != m_pRecHdrRunNext->m_iCycleLast ) + { + if ( m_pRecHdrRunNext->m_iCycleLast == m_iCycleCur ) + { + DMsg( SPEW_CONSOLE, 1, "Double cycle: hdr = 0x%x, last frame = %d, curFrame = %d, first = %d, last = %d, bucket = %d\n", + m_pRecHdrRunNext, m_pRecHdrRunNext->m_iFrameLast, m_iFrame, + m_iBucketRunFirst, m_iBucketRunMax, m_pRecHdrRunNext->m_iBucket ); + } + else if ( m_pRecHdrRunNext->m_iCycleLast != m_iCycleCur - 1 ) + { + DMsg( SPEW_CONSOLE, 1, "Skipped cycle: hdr = 0x%x, cycleLast = %u, cycleCur = %u (missed %u cycles)\n", + m_pRecHdrRunNext, m_pRecHdrRunNext->m_iCycleLast, m_iCycleCur, + m_iCycleCur - m_pRecHdrRunNext->m_iCycleLast ); + Assert( false ); + } + } + m_pRecHdrRunNext->m_iCycleLast = m_iCycleCur; + m_pRecHdrRunNext->m_iFrameLast = m_iFrame; +#endif + + // Set up the record to run next time + RecHdr_t *pRecHdrCur = m_pRecHdrRunNext; + m_pRecHdrRunNext = m_pRecHdrRunNext->m_pRecHdrNext; + + // Does this record need to run? + if ( 0 == pRecHdrCur->m_nRunRatio ) + continue; + + if ( 0 == m_iCycleCur % pRecHdrCur->m_nRunRatio ) + return PvRecordFromPRecHdr( pRecHdrCur ); + } +} + + +//----------------------------------------------------------------------------- +// Purpose: Return true if we've completed a scheduler pass since last called +//----------------------------------------------------------------------------- +template +bool CTHash::BCompletedPass() +{ + if ( m_iCycleCur != m_iCycleLastReported ) + { + m_iCycleLastReported = m_iCycleCur; + return true; + } + return false; +} + + +extern const unsigned char g_CTHashRandomValues[256]; // definition lives in globals.cpp + +//----------------------------------------------------------------------------- +// Purpose: Returns the index of the hash bucket corresponding to a particular key +// Input: unKey - Key to find +// Output: Index of the hash bucket corresponding to unKey +//----------------------------------------------------------------------------- +template +int CTHash::IBucket( I unKey ) const +{ + AssertFatal( m_cBucket > 0 ); + + // This is a pearsons hash variant that returns a maximum of 32 bits + size_t size = sizeof(I); + const uint8 * k = (const uint8 *) &unKey; + uint32 byte_one = 0, byte_two = 0, byte_three = 0, byte_four = 0, n; + + while (size) + { + --size; + n = *k++; + byte_one = g_CTHashRandomValues[byte_one ^ n]; + + if (size) + { + --size; + n = *k++; + byte_two = g_CTHashRandomValues[byte_two ^ n]; + } + else + break; + + if (size) + { + --size; + n = *k++; + byte_three = g_CTHashRandomValues[byte_three ^ n]; + } + else + break; + + if (size) + { + --size; + n = *k++; + byte_four = g_CTHashRandomValues[byte_four ^ n]; + } + else + break; + } + + uint32 idx = ( byte_four << 24 ) | ( byte_three << 16 ) | ( byte_two << 8 ) | byte_one; + idx = idx % m_cBucket; + return ( (int) idx ); +} + + +#ifdef DBGFLAG_VALIDATE +//----------------------------------------------------------------------------- +// Purpose: Run a global validation pass on all of our data structures and memory +// allocations. +// Input: validator - Our global validator object +// pchName - Our name (typically a member var in our container) +//----------------------------------------------------------------------------- +template +void CTHash::Validate( CValidator &validator, const char *pchName ) +{ + VALIDATE_SCOPE(); + + validator.ClaimMemory( m_pBucket ); + ValidatePtr( m_pMemoryPoolRecord ); + +#if defined( _DEBUG ) + // first verify m_cRecordInUse + Data * pvRecord = PvRecordFirst(); + int cItems = 0; + while ( pvRecord ) + { + Data *pvRecordNext = PvRecordNext( pvRecord ); + cItems++; + pvRecord = pvRecordNext; + } + Assert( m_cRecordInUse == cItems ); + // then ask the mempool to verify this + if ( m_pMemoryPoolRecord ) + m_pMemoryPoolRecord->LeakCheck( cItems ); +#endif // _DEBUG +} +#endif // DBGFLAG_VALIDATE + + +//----------------------------------------------------------------------------- +// Purpose: Inserts a new record into the table +// Input: unKey - Primary key of the new record +// Output: Pointer to the new record +//----------------------------------------------------------------------------- +template +void CTHash::InsertIntoHash( RecHdr_t *pRecHdr, I unKey ) +{ + m_cRecordInUse++; + + // Init the RecHdr + pRecHdr->m_unKey = unKey; + pRecHdr->m_nRunRatio = 1; + + // Find our hash bucket + int iBucket = IBucket( unKey ); + pRecHdr->m_iBucket = iBucket; +#ifdef DBGFLAG_THASH + pRecHdr->m_iCycleLast = 0; +#endif + + // Find where to insert ourselves in the linked list + RecHdr_t *pRecHdrInsertBefore = &m_RecHdrTail; + // Find the first bucket with anything in it that's at or after our bucket + for ( int iBucketT = iBucket; iBucketT < m_cBucket; iBucketT++ ) + { + if ( NULL != m_pBucket[iBucketT].m_pRecHdrFirst ) + { + pRecHdrInsertBefore = m_pBucket[iBucketT].m_pRecHdrFirst; + break; + } + } + + // Insert ourselves + pRecHdr->m_pRecHdrNext = pRecHdrInsertBefore; + pRecHdr->m_pRecHdrPrev = pRecHdrInsertBefore->m_pRecHdrPrev; + pRecHdrInsertBefore->m_pRecHdrPrev = pRecHdr; + pRecHdr->m_pRecHdrPrev->m_pRecHdrNext = pRecHdr; + + // Our bucket should point to us + m_pBucket[iBucket].m_pRecHdrFirst = pRecHdr; +} + + +//----------------------------------------------------------------------------- +// Purpose: Removes the specified entry from the table +// Input: pvRemove - Pointer to the entry to remove +//----------------------------------------------------------------------------- +template +void CTHash::RemoveFromHash( Data * pvRemove ) +{ + // Find our RecHdr + RecHdr_t *pRecHdr = PRecHdrFromPvRecord( pvRemove ); + + // If our bucket points to us, point it to the next record (or else NULL) + int iBucket = IBucket( pRecHdr->m_unKey ); + if ( pRecHdr == m_pBucket[iBucket].m_pRecHdrFirst ) + { + if ( pRecHdr->m_pRecHdrNext->m_iBucket == iBucket ) + m_pBucket[iBucket].m_pRecHdrFirst = pRecHdr->m_pRecHdrNext; + else + m_pBucket[iBucket].m_pRecHdrFirst = NULL; + } + + // Remove us from the linked list + pRecHdr->m_pRecHdrPrev->m_pRecHdrNext = pRecHdr->m_pRecHdrNext; + pRecHdr->m_pRecHdrNext->m_pRecHdrPrev = pRecHdr->m_pRecHdrPrev; + + // Are we the next record to run? + if ( pRecHdr == m_pRecHdrRunNext ) + m_pRecHdrRunNext = pRecHdr->m_pRecHdrNext; + + m_cRecordInUse--; +} + +#endif // THASH_H diff --git a/public/tier1/utlallocation.h b/public/tier1/utlallocation.h new file mode 100644 index 000000000..65416bcfe --- /dev/null +++ b/public/tier1/utlallocation.h @@ -0,0 +1,134 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// The CUtlAllocation class: +// A single allocation in the style of CUtlMemory/CUtlString/CUtlBuffer +// as compact as possible, no virtuals or extraneous data +// to be used primarily to replace CUtlBuffer +//============================================================================= + +#ifndef UTLALLOCATION_H +#define UTLALLOCATION_H +#ifdef _WIN32 +#pragma once +#endif + +#include "tier1/utlmemory.h" + +class CUtlAllocation +{ +public: + + // constructor, destructor + CUtlAllocation() + { + m_pMemory = NULL; + } + + CUtlAllocation( const void *pMemory, int cub ) + { + m_pMemory = NULL; + Copy( pMemory, cub ); + } + + CUtlAllocation( CUtlAllocation const &src ) + { + m_pMemory = NULL; + Copy( src ); + } + + ~CUtlAllocation() + { + Purge(); + } + + CUtlAllocation &operator=( CUtlAllocation const &src ) + { + Copy( src ); + return *this; + } + + bool operator==( CUtlAllocation const &src ) + { + if ( Count() != src.Count() ) + return false; + return Q_memcmp( Base(), src.Base(), Count() ) == 0; + } + + void Copy( const void *pMemory, int cub ) + { + if ( cub == 0 || pMemory == NULL ) + { + Purge(); + return; + } + if ( cub != Count() ) + { + Purge(); + m_pMemory = (ActualMemory_t *)malloc( cub + sizeof( int ) ); + m_pMemory->cub = cub; + } + Q_memcpy( Base(), pMemory, cub ); + } + + // Gets the base address + uint8* Base() + { + if ( m_pMemory == NULL ) + return NULL; + return m_pMemory->rgub; + } + + const uint8* Base() const + { + if ( m_pMemory == NULL ) + return NULL; + return m_pMemory->rgub; + } + + // Size + int Count() const + { + if ( m_pMemory == NULL ) + return 0; + return m_pMemory->cub; + } + + // Memory deallocation + void Purge() + { + if ( m_pMemory ) + free(m_pMemory); + m_pMemory = NULL; + } + + void Copy( const CUtlAllocation &alloc ) + { + Copy( alloc.Base(), alloc.Count() ); + } + + void Swap( CUtlAllocation &alloc ) + { + ActualMemory_t *pTemp = m_pMemory; + m_pMemory = alloc.m_pMemory; + alloc.m_pMemory = pTemp; + } + + void Alloc( int cub ) + { + Purge(); + m_pMemory = (ActualMemory_t *)malloc( cub + sizeof( int ) ); + m_pMemory->cub = cub; + } + +private: + struct ActualMemory_t + { + int cub; + uint8 rgub[4]; // i'd prefer to make this 0 but the compiler whines when i do + }; + + ActualMemory_t *m_pMemory; +}; + +#endif // UTLALLOCATION_H diff --git a/public/tier1/utlcommon.h b/public/tier1/utlcommon.h new file mode 100644 index 000000000..23e67f040 --- /dev/null +++ b/public/tier1/utlcommon.h @@ -0,0 +1,371 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: common helpers for reuse among various Utl containers +// +// $NoKeywords: $ +// +//=============================================================================// + +#ifndef UTLCOMMON_H +#define UTLCOMMON_H +#pragma once + +//----------------------------------------------------------------------------- +// Henry Goffin (henryg) was here. Questions? Bugs? Go slap him around a bit. +//----------------------------------------------------------------------------- + +// empty_t is the canonical "no-value" type which is fully defined but empty. +struct empty_t {}; + +// undefined_t is the canonical "undefined" type, used mostly for typedefs; +// parameters of type undefined_t will not compile, which is actually useful +// behavior when it comes to template programming. Google "SFINAE" for info. +struct undefined_t; + +// CTypeSelect::type is a typedef of A if sel is nonzero, else B +template +struct CTypeSelect { typedef A type; }; + +template +struct CTypeSelect<0, A, B> { typedef B type; }; + +// CTypeEquals::value is nonzero if A and B are the same type +template +struct CTypeEquals { enum { value = 0 }; }; + +template +struct CTypeEquals { enum { value = 1 }; }; + +template +struct CTypeEquals : CTypeEquals< const volatile A&, const volatile B& > {}; + +template +struct CTypeEquals : CTypeEquals< const volatile A, const volatile B > {}; + +template +struct CTypeEquals : CTypeEquals< A&, B& > {}; + +// CUtlKeyValuePair is intended for use with key-lookup containers. +// Because it is specialized for "empty_t" values, one container can +// function as either a set of keys OR a key-value dictionary while +// avoiding storage waste or padding for the empty_t value objects. +template +class CUtlKeyValuePair +{ +public: + typedef V ValueReturn_t; + K m_key; + V m_value; + + CUtlKeyValuePair() {} + + template < typename KInit > + explicit CUtlKeyValuePair( const KInit &k ) : m_key( k ) {} + + template < typename KInit, typename VInit > + CUtlKeyValuePair( const KInit &k, const VInit &v ) : m_key( k ), m_value( v ) {} + + V &GetValue() { return m_value; } + const V &GetValue() const { return m_value; } +}; + +template +class CUtlKeyValuePair +{ +public: + typedef const K ValueReturn_t; + K m_key; + + CUtlKeyValuePair() {} + + template < typename KInit > + explicit CUtlKeyValuePair( const KInit &k ) : m_key( k ) {} + + template < typename KInit > + CUtlKeyValuePair( const KInit &k, empty_t ) : m_key( k ) {} + + CUtlKeyValuePair( const K &k, const empty_t& ) : m_key( k ) {} + const K &GetValue() const { return m_key; } +}; + + +// Default functors. You can specialize these if your type does +// not implement operator== or operator< in an efficient way for +// some odd reason. +template struct DefaultLessFunctor; +template struct DefaultEqualFunctor; + +// Hashing functor used by hash tables. You can either specialize +// for types which are widely used, or plug a custom functor directly +// into the hash table. If you do roll your own, please read up on +// bit-mixing and the avalanche property; be sure that your values +// are reasonably well-distributed across the entire 32-bit range. +// http://en.wikipedia.org/wiki/Avalanche_effect +// http://home.comcast.net/~bretm/hash/5.html +// +template struct DefaultHashFunctor; + +// Argument type information. Struct currently contains one or two typedefs: +// typename Arg_t = primary argument type. Usually const T&, sometimes T. +// typename Alt_t = optional alternate type. Usually *undefined*. +// +// Any specializations should be implemented via simple inheritance +// from ArgumentTypeInfoImpl< BestArgType, [optional] AlternateArgType > +// +template struct ArgumentTypeInfo; + + +// Some fundamental building-block functors... +struct StringLessFunctor { bool operator()( const char *a, const char *b ) const { return Q_strcmp( a, b ) < 0; } }; +struct StringEqualFunctor { bool operator()( const char *a, const char *b ) const { return Q_strcmp( a, b ) == 0; } }; +struct CaselessStringLessFunctor { bool operator()( const char *a, const char *b ) const { return Q_strcasecmp( a, b ) < 0; } }; +struct CaselessStringEqualFunctor { bool operator()( const char *a, const char *b ) const { return Q_strcasecmp( a, b ) == 0; } }; + +struct Mix32HashFunctor { unsigned int operator()( uint32 s ) const; }; +struct Mix64HashFunctor { unsigned int operator()( uint64 s ) const; }; +struct StringHashFunctor { unsigned int operator()( const char* s ) const; }; +struct CaselessStringHashFunctor { unsigned int operator()( const char* s ) const; }; + +struct PointerLessFunctor { bool operator()( const void *a, const void *b ) const { return a < b; } }; +struct PointerEqualFunctor { bool operator()( const void *a, const void *b ) const { return a == b; } }; +#if defined( PLATFORM_64BITS ) +struct PointerHashFunctor { unsigned int operator()( const void* s ) const { return Mix64HashFunctor()( ( uintp ) s ); } }; +#else +struct PointerHashFunctor { unsigned int operator()( const void* s ) const { return Mix32HashFunctor()( ( uintp ) s ); } }; +#endif + + +// Generic implementation of Less and Equal functors +template < typename T > +struct DefaultLessFunctor +{ + bool operator()( typename ArgumentTypeInfo< T >::Arg_t a, typename ArgumentTypeInfo< T >::Arg_t b ) const { return a < b; } + bool operator()( typename ArgumentTypeInfo< T >::Alt_t a, typename ArgumentTypeInfo< T >::Arg_t b ) const { return a < b; } + bool operator()( typename ArgumentTypeInfo< T >::Arg_t a, typename ArgumentTypeInfo< T >::Alt_t b ) const { return a < b; } +}; + +template < typename T > +struct DefaultEqualFunctor +{ + bool operator()( typename ArgumentTypeInfo< T >::Arg_t a, typename ArgumentTypeInfo< T >::Arg_t b ) const { return a == b; } + bool operator()( typename ArgumentTypeInfo< T >::Alt_t a, typename ArgumentTypeInfo< T >::Arg_t b ) const { return a == b; } + bool operator()( typename ArgumentTypeInfo< T >::Arg_t a, typename ArgumentTypeInfo< T >::Alt_t b ) const { return a == b; } +}; + +// Hashes for basic types +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +#if !defined(PLATFORM_64BITS) || defined(_WIN32) +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +#elif defined(POSIX) +template <> struct DefaultHashFunctor : Mix64HashFunctor { }; +template <> struct DefaultHashFunctor : Mix64HashFunctor { }; +#endif +template <> struct DefaultHashFunctor : Mix64HashFunctor { }; +template <> struct DefaultHashFunctor : Mix64HashFunctor { }; +template <> struct DefaultHashFunctor : PointerHashFunctor { }; +template <> struct DefaultHashFunctor : PointerHashFunctor { }; +#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) +template <> struct DefaultHashFunctor : Mix32HashFunctor { }; +#endif + +// String specializations. If you want to operate on raw values, use +// PointerLessFunctor and friends from the "building-block" section above +template <> struct DefaultLessFunctor : StringLessFunctor { }; +template <> struct DefaultLessFunctor : StringLessFunctor { }; +template <> struct DefaultEqualFunctor : StringEqualFunctor { }; +template <> struct DefaultEqualFunctor : StringEqualFunctor { }; +template <> struct DefaultHashFunctor : StringHashFunctor { }; +template <> struct DefaultHashFunctor : StringHashFunctor { }; + +// CUtlString/CUtlConstString are specialized here and not in utlstring.h +// because I consider string datatypes to be fundamental, and don't feel +// comfortable making that header file dependent on this one. (henryg) +class CUtlString; +template < typename T > class CUtlConstStringBase; + +template <> struct DefaultLessFunctor : StringLessFunctor { }; +template <> struct DefaultHashFunctor : StringHashFunctor { }; +template < typename T > struct DefaultLessFunctor< CUtlConstStringBase > : StringLessFunctor { }; +template < typename T > struct DefaultHashFunctor< CUtlConstStringBase > : StringHashFunctor { }; + + +// Helpers to deduce if a type defines a public AltArgumentType_t typedef: +template < typename T > +struct HasClassAltArgumentType +{ + template < typename X > static long Test( typename X::AltArgumentType_t* ); + template < typename X > static char Test( ... ); + enum { value = ( sizeof( Test< T >( NULL ) ) != sizeof( char ) ) }; +}; + +template < typename T, bool = HasClassAltArgumentType< T >::value > +struct GetClassAltArgumentType { typedef typename T::AltArgumentType_t Result_t; }; + +template < typename T > +struct GetClassAltArgumentType< T, false > { typedef undefined_t Result_t; }; + +// Unwrap references; reference types don't have member typedefs. +template < typename T > +struct GetClassAltArgumentType< T&, false > : GetClassAltArgumentType< T > { }; + +// ArgumentTypeInfoImpl is the base for all ArgumentTypeInfo specializations. +template < typename ArgT, typename AltT = typename GetClassAltArgumentType::Result_t > +struct ArgumentTypeInfoImpl +{ + enum { has_alt = 1 }; + typedef ArgT Arg_t; + typedef AltT Alt_t; +}; + +// Handle cases where AltArgumentType_t is typedef'd to undefined_t +template < typename ArgT > +struct ArgumentTypeInfoImpl< ArgT, undefined_t > +{ + enum { has_alt = 0 }; + typedef ArgT Arg_t; + typedef undefined_t Alt_t; +}; + +// Handle cases where AltArgumentType_t is typedef'd to the primary type +template < typename ArgT > +struct ArgumentTypeInfoImpl< ArgT, ArgT > +{ + enum { has_alt = 0 }; + typedef ArgT Arg_t; + typedef undefined_t Alt_t; +}; + + +// By default, everything is passed via const ref and doesn't define an alternate type. +template struct ArgumentTypeInfo : ArgumentTypeInfoImpl< const T& > { }; + +// Small native types are most efficiently passed by value. +template <> struct ArgumentTypeInfo< bool > : ArgumentTypeInfoImpl< bool > { }; +template <> struct ArgumentTypeInfo< char > : ArgumentTypeInfoImpl< char > { }; +template <> struct ArgumentTypeInfo< signed char > : ArgumentTypeInfoImpl< signed char > { }; +template <> struct ArgumentTypeInfo< unsigned char > : ArgumentTypeInfoImpl< unsigned char > { }; +template <> struct ArgumentTypeInfo< signed short > : ArgumentTypeInfoImpl< signed short > { }; +template <> struct ArgumentTypeInfo< unsigned short > : ArgumentTypeInfoImpl< unsigned short > { }; +template <> struct ArgumentTypeInfo< signed int > : ArgumentTypeInfoImpl< signed int > { }; +template <> struct ArgumentTypeInfo< unsigned int > : ArgumentTypeInfoImpl< unsigned int > { }; +template <> struct ArgumentTypeInfo< signed long > : ArgumentTypeInfoImpl< signed long > { }; +template <> struct ArgumentTypeInfo< unsigned long > : ArgumentTypeInfoImpl< unsigned long > { }; +template <> struct ArgumentTypeInfo< signed long long > : ArgumentTypeInfoImpl< signed long long > { }; +template <> struct ArgumentTypeInfo< unsigned long long > : ArgumentTypeInfoImpl< unsigned long long > { }; +template <> struct ArgumentTypeInfo< float > : ArgumentTypeInfoImpl< float > { }; +template <> struct ArgumentTypeInfo< double > : ArgumentTypeInfoImpl< double > { }; +template <> struct ArgumentTypeInfo< long double > : ArgumentTypeInfoImpl< long double > { }; +#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) +template <> struct ArgumentTypeInfo< wchar_t > : ArgumentTypeInfoImpl< wchar_t > { }; +#endif + +// Pointers are also most efficiently passed by value. +template < typename T > struct ArgumentTypeInfo< T* > : ArgumentTypeInfoImpl< T* > { }; + + +// Specializations to unwrap const-decorated types and references +template struct ArgumentTypeInfo : ArgumentTypeInfo { }; +template struct ArgumentTypeInfo : ArgumentTypeInfo { }; +template struct ArgumentTypeInfo : ArgumentTypeInfo { }; +template struct ArgumentTypeInfo : ArgumentTypeInfo { }; + +template struct DefaultLessFunctor : DefaultLessFunctor { }; +template struct DefaultLessFunctor : DefaultLessFunctor { }; +template struct DefaultLessFunctor : DefaultLessFunctor { }; +template struct DefaultLessFunctor : DefaultLessFunctor { }; + +template struct DefaultEqualFunctor : DefaultEqualFunctor { }; +template struct DefaultEqualFunctor : DefaultEqualFunctor { }; +template struct DefaultEqualFunctor : DefaultEqualFunctor { }; +template struct DefaultEqualFunctor : DefaultEqualFunctor { }; + +template struct DefaultHashFunctor : DefaultHashFunctor { }; +template struct DefaultHashFunctor : DefaultHashFunctor { }; +template struct DefaultHashFunctor : DefaultHashFunctor { }; +template struct DefaultHashFunctor : DefaultHashFunctor { }; + + +// Hash all pointer types as raw pointers by default +template struct DefaultHashFunctor< T * > : PointerHashFunctor { }; + + +// Here follow the useful implementations. + +// Bob Jenkins's 32-bit mix function. +inline unsigned int Mix32HashFunctor::operator()( uint32 n ) const +{ + // Perform a mixture of the bits in n, where each bit + // of the input value has an equal chance to affect each + // bit of the output. This turns tightly clustered input + // values into a smooth distribution. + // + // This takes 16-20 cycles on modern x86 architectures; + // that's roughly the same cost as a mispredicted branch. + // It's also reasonably efficient on PPC-based consoles. + // + // If you're still thinking, "too many instructions!", + // do keep in mind that reading one byte of uncached RAM + // is about 30x slower than executing this code. It pays + // to have a good hash function which minimizes collisions + // (and therefore long lookup chains). + n = ( n + 0x7ed55d16 ) + ( n << 12 ); + n = ( n ^ 0xc761c23c ) ^ ( n >> 19 ); + n = ( n + 0x165667b1 ) + ( n << 5 ); + n = ( n + 0xd3a2646c ) ^ ( n << 9 ); + n = ( n + 0xfd7046c5 ) + ( n << 3 ); + n = ( n ^ 0xb55a4f09 ) ^ ( n >> 16 ); + return n; +} + +inline unsigned int Mix64HashFunctor::operator()( uint64 s ) const +{ + // Thomas Wang hash, http://www.concentric.net/~ttwang/tech/inthash.htm + s = ( ~s ) + ( s << 21 ); // s = (s << 21) - s - 1; + s = s ^ ( s >> 24 ); + s = (s + ( s << 3 ) ) + ( s << 8 ); // s * 265 + s = s ^ ( s >> 14 ); + s = ( s + ( s << 2 ) ) + ( s << 4 ); // s * 21 + s = s ^ ( s >> 28 ); + s = s + ( s << 31 ); + return (unsigned int)s; +} + + +// Based on the widely-used FNV-1A string hash with a final +// mixing step to improve dispersion for very small and very +// large hash table sizes. +inline unsigned int StringHashFunctor::operator()( const char* s ) const +{ + uint32 h = 2166136261u; + for ( ; *s; ++s ) + { + uint32 c = (unsigned char) *s; + h = (h ^ c) * 16777619; + } + return (h ^ (h << 17)) + (h >> 21); +} + +// Equivalent to StringHashFunctor on lower-case strings. +inline unsigned int CaselessStringHashFunctor::operator()( const char* s ) const +{ + uint32 h = 2166136261u; + for ( ; *s; ++s ) + { + uint32 c = (unsigned char) *s; + // Brutally fast branchless ASCII tolower(): + // if ((c >= 'A') && (c <= 'Z')) c += ('a' - 'A'); + c += (((('A'-1) - c) & (c - ('Z'+1))) >> 26) & 32; + h = (h ^ c) * 16777619; + } + return (h ^ (h << 17)) + (h >> 21); +} + + +#endif // UTLCOMMON_H diff --git a/public/tier1/utldict.h b/public/tier1/utldict.h index d6e777d12..bdccf576f 100644 --- a/public/tier1/utldict.h +++ b/public/tier1/utldict.h @@ -31,10 +31,12 @@ enum EDictCompareType //----------------------------------------------------------------------------- // A dictionary mapping from symbol to structure //----------------------------------------------------------------------------- -template +template class CUtlDict { public: + typedef I IndexType_t; + // constructor, destructor // Left at growSize = 0, the memory will first allocate 1 element and double in size // at each increment. diff --git a/public/tier1/utlhashtable.h b/public/tier1/utlhashtable.h new file mode 100644 index 000000000..eca14dfad --- /dev/null +++ b/public/tier1/utlhashtable.h @@ -0,0 +1,988 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: a fast growable hashtable with stored hashes, L2-friendly behavior. +// Useful as a string dictionary or a low-overhead set/map for small POD types. +// +// Usage notes: +// - handles are NOT STABLE across element removal! use RemoveAndAdvance() +// if you are removing elements while iterating through the hashtable. +// Use CUtlStableHashtable if you need stable handles (less efficient). +// - handles are also NOT STABLE across element insertion. The handle +// resulting from the insertion of an element may not retreive the +// same (or any!) element after further insertions. Again, use +// CUtlStableHashtable if you need stable handles +// - Insert() first searches for an existing match and returns it if found +// - a value type of "empty_t" can be used to eliminate value storage and +// switch Element() to return const Key references instead of values +// - an extra user flag bit is accessible via Get/SetUserFlag() +// - hash function pointer / functor is exposed via GetHashRef() +// - comparison function pointer / functor is exposed via GetEqualRef() +// - if your value type cannot be copy-constructed, use key-only Insert() +// to default-initialize the value and then manipulate it afterwards. +// - The reason that UtlHashtable permutes itself and invalidates +// iterators is to make it faster in the case where you are not +// tracking iterators. If you use it as a set or a map ("is this +// value a member?") as opposed to a long-term container, then you +// probably don't need stable iterators. Hashtable tries to place +// newly inserted data in the primary hash slot, making an +// assumption that if you inserted it recently, you're more likely +// to access it than if you inserted something a long time +// ago. It's effectively trying to minimize cache misses for hot +// data if you add and remove a lot. +// If you don't care too much about cache misses, UtlStableHashtable +// is what you're looking for +// +// Implementation notes: +// - overall hash table load is kept between .25 and .75 +// - items which would map to the same ideal slot are chained together +// - chained items are stored sequentially in adjacent free spaces +// - "root" entries are prioritized over chained entries; if a +// slot is not occupied by an item in its root position, the table +// is guaranteed to contain no keys which would hash to that slot. +// - new items go at the head of the chain (ie, in their root slot) +// and evict / "bump" any chained entries which occupy that slot +// - chain-following skips over unused holes and continues examining +// table entries until a chain entry with FLAG_LAST is encountered +// +// CUtlHashtable< uint32 > setOfIntegers; +// CUtlHashtable< const char* > setOfStringPointers; +// CUtlHashtable< int, CUtlVector > mapFromIntsToArrays; +// +// $NoKeywords: $ +// +// A closed-form (open addressing) hashtable with linear sequential probing. +//=============================================================================// + +#ifndef UTLHASHTABLE_H +#define UTLHASHTABLE_H +#pragma once + +#include "utlcommon.h" +#include "utlmemory.h" +#include "mathlib/mathlib.h" +#include "utllinkedlist.h" + +//----------------------------------------------------------------------------- +// Henry Goffin (henryg) was here. Questions? Bugs? Go slap him around a bit. +//----------------------------------------------------------------------------- + +typedef unsigned int UtlHashHandle_t; + +#define FOR_EACH_HASHTABLE( table, iter ) \ + for ( UtlHashHandle_t iter = (table).FirstHandle(); iter != (table).InvalidHandle(); iter = (table).NextHandle( iter ) ) + +// CUtlHashtableEntry selects between 16 and 32 bit storage backing +// for flags_and_hash depending on the size of the stored types. +template < typename KeyT, typename ValueT = empty_t > +class CUtlHashtableEntry +{ +public: + typedef CUtlKeyValuePair< KeyT, ValueT > KVPair; + + enum { INT16_STORAGE = ( sizeof( KVPair ) <= 2 ) }; + typedef typename CTypeSelect< INT16_STORAGE, int16, int32 >::type storage_t; + + enum + { + FLAG_FREE = INT16_STORAGE ? 0x8000 : 0x80000000, // must be high bit for IsValid and IdealIndex to work + FLAG_LAST = INT16_STORAGE ? 0x4000 : 0x40000000, + MASK_HASH = INT16_STORAGE ? 0x3FFF : 0x3FFFFFFF + }; + + storage_t flags_and_hash; + storage_t data[ ( sizeof(KVPair) + sizeof(storage_t) - 1 ) / sizeof(storage_t) ]; + + bool IsValid() const { return flags_and_hash >= 0; } + void MarkInvalid() { int32 flag = FLAG_FREE; flags_and_hash = (storage_t)flag; } + const KVPair *Raw() const { return reinterpret_cast< const KVPair * >( &data[0] ); } + const KVPair *operator->() const { Assert( IsValid() ); return reinterpret_cast< const KVPair * >( &data[0] ); } + KVPair *Raw() { return reinterpret_cast< KVPair * >( &data[0] ); } + KVPair *operator->() { Assert( IsValid() ); return reinterpret_cast< KVPair * >( &data[0] ); } + + // Returns the ideal index of the data in this slot, or all bits set if invalid + uint32 FORCEINLINE IdealIndex( uint32 slotmask ) const { return IdealIndex( flags_and_hash, slotmask ) | ( (int32)flags_and_hash >> 31 ); } + + // Use template tricks to fully define only one function that takes either 16 or 32 bits + // and performs different logic without using "if ( INT16_STORAGE )", because GCC and MSVC + // sometimes have trouble removing the constant branch, which is dumb... but whatever. + // 16-bit hashes are simply too narrow for large hashtables; more mask bits than hash bits! + // So we duplicate the hash bits. (Note: h *= MASK_HASH+2 is the same as h += h<::type uint32_if16BitStorage; + typedef typename CTypeSelect< INT16_STORAGE, undefined_t, int32 >::type uint32_if32BitStorage; + static FORCEINLINE uint32 IdealIndex( uint32_if16BitStorage h, uint32 m ) { h &= MASK_HASH; h *= MASK_HASH + 2; return h & m; } + static FORCEINLINE uint32 IdealIndex( uint32_if32BitStorage h, uint32 m ) { return h & m; } + + // More efficient than memcpy for the small types that are stored in a hashtable + void MoveDataFrom( CUtlHashtableEntry &src ) + { + storage_t * RESTRICT srcData = &src.data[0]; + for ( int i = 0; i < ARRAYSIZE( data ); ++i ) { data[i] = srcData[i]; } + } +}; + +template , typename KeyIsEqualT = DefaultEqualFunctor, typename AlternateKeyT = typename ArgumentTypeInfo::Alt_t > +class CUtlHashtable +{ +public: + typedef UtlHashHandle_t handle_t; + +protected: + typedef CUtlKeyValuePair KVPair; + typedef typename ArgumentTypeInfo::Arg_t KeyArg_t; + typedef typename ArgumentTypeInfo::Arg_t ValueArg_t; + typedef typename ArgumentTypeInfo::Arg_t KeyAlt_t; + typedef CUtlHashtableEntry< KeyT, ValueT > entry_t; + + enum { FLAG_FREE = entry_t::FLAG_FREE }; + enum { FLAG_LAST = entry_t::FLAG_LAST }; + enum { MASK_HASH = entry_t::MASK_HASH }; + + CUtlMemory< entry_t > m_table; + int m_nUsed; + int m_nMinSize; + bool m_bSizeLocked; + KeyIsEqualT m_eq; + KeyHashT m_hash; + + // Allocate an empty table and then re-insert all existing entries. + void DoRealloc( int size ); + + // Move an existing entry to a free slot, leaving a hole behind + void BumpEntry( unsigned int idx ); + + // Insert an unconstructed KVPair at the primary slot + int DoInsertUnconstructed( unsigned int h, bool allowGrow ); + + // Implementation for Insert functions, constructs a KVPair + // with either a default-construted or copy-constructed value + template handle_t DoInsert( KeyParamT k, unsigned int h ); + template handle_t DoInsert( KeyParamT k, typename ArgumentTypeInfo::Arg_t v, unsigned int h, bool* pDidInsert ); + template handle_t DoInsertNoCheck( KeyParamT k, typename ArgumentTypeInfo::Arg_t v, unsigned int h ); + + // Key lookup. Can also return previous-in-chain if result is chained. + template handle_t DoLookup( KeyParamT x, unsigned int h, handle_t *pPreviousInChain ) const; + + // Remove single element by key + hash. Returns the index of the new hole + // that was created. Returns InvalidHandle() if element was not found. + template int DoRemove( KeyParamT x, unsigned int h ); + + // Friend CUtlStableHashtable so that it can call our Do* functions directly + template < typename K, typename V, typename S, typename H, typename E, typename A > friend class CUtlStableHashtable; + +public: + explicit CUtlHashtable( int minimumSize = 32 ) + : m_nUsed(0), m_nMinSize(MAX(8, minimumSize)), m_bSizeLocked(false), m_eq(), m_hash() { } + + CUtlHashtable( int minimumSize, const KeyHashT &hash, KeyIsEqualT const &eq = KeyIsEqualT() ) + : m_nUsed(0), m_nMinSize(MAX(8, minimumSize)), m_bSizeLocked(false), m_eq(eq), m_hash(hash) { } + + CUtlHashtable( entry_t* pMemory, unsigned int nCount, const KeyHashT &hash = KeyHashT(), KeyIsEqualT const &eq = KeyIsEqualT() ) + : m_nUsed(0), m_nMinSize(8), m_bSizeLocked(false), m_eq(eq), m_hash(hash) { SetExternalBuffer( pMemory, nCount ); } + + ~CUtlHashtable() { RemoveAll(); } + + CUtlHashtable &operator=( CUtlHashtable const &src ); + + // Set external memory + void SetExternalBuffer( byte* pRawBuffer, unsigned int nBytes, bool bAssumeOwnership = false, bool bGrowable = false ); + void SetExternalBuffer( entry_t* pBuffer, unsigned int nSize, bool bAssumeOwnership = false, bool bGrowable = false ); + + // Functor/function-pointer access + KeyHashT& GetHashRef() { return m_hash; } + KeyIsEqualT& GetEqualRef() { return m_eq; } + KeyHashT const &GetHashRef() const { return m_hash; } + KeyIsEqualT const &GetEqualRef() const { return m_eq; } + + // Handle validation + bool IsValidHandle( handle_t idx ) const { return (unsigned)idx < (unsigned)m_table.Count() && m_table[idx].IsValid(); } + static handle_t InvalidHandle() { return (handle_t) -1; } + + // Iteration functions + handle_t FirstHandle() const { return NextHandle( (handle_t) -1 ); } + handle_t NextHandle( handle_t start ) const; + + // Returns the number of unique keys in the table + int Count() const { return m_nUsed; } + + + // Key lookup, returns InvalidHandle() if not found + handle_t Find( KeyArg_t k ) const { return DoLookup( k, m_hash(k), NULL ); } + handle_t Find( KeyArg_t k, unsigned int hash) const { Assert( hash == m_hash(k) ); return DoLookup( k, hash, NULL ); } + // Alternate-type key lookup, returns InvalidHandle() if not found + handle_t Find( KeyAlt_t k ) const { return DoLookup( k, m_hash(k), NULL ); } + handle_t Find( KeyAlt_t k, unsigned int hash) const { Assert( hash == m_hash(k) ); return DoLookup( k, hash, NULL ); } + + // True if the key is in the table + bool HasElement( KeyArg_t k ) const { return InvalidHandle() != Find( k ); } + bool HasElement( KeyAlt_t k ) const { return InvalidHandle() != Find( k ); } + + // Key insertion or lookup, always returns a valid handle + handle_t Insert( KeyArg_t k ) { return DoInsert( k, m_hash(k) ); } + handle_t Insert( KeyArg_t k, ValueArg_t v, bool *pDidInsert = NULL ) { return DoInsert( k, v, m_hash(k), pDidInsert ); } + handle_t Insert( KeyArg_t k, ValueArg_t v, unsigned int hash, bool *pDidInsert = NULL ) { Assert( hash == m_hash(k) ); return DoInsert( k, v, hash, pDidInsert ); } + // Alternate-type key insertion or lookup, always returns a valid handle + handle_t Insert( KeyAlt_t k ) { return DoInsert( k, m_hash(k) ); } + handle_t Insert( KeyAlt_t k, ValueArg_t v, bool *pDidInsert = NULL ) { return DoInsert( k, v, m_hash(k), pDidInsert ); } + handle_t Insert( KeyAlt_t k, ValueArg_t v, unsigned int hash, bool *pDidInsert = NULL ) { Assert( hash == m_hash(k) ); return DoInsert( k, v, hash, pDidInsert ); } + + // Key removal, returns false if not found + bool Remove( KeyArg_t k ) { return DoRemove( k, m_hash(k) ) >= 0; } + bool Remove( KeyArg_t k, unsigned int hash ) { Assert( hash == m_hash(k) ); return DoRemove( k, hash ) >= 0; } + // Alternate-type key removal, returns false if not found + bool Remove( KeyAlt_t k ) { return DoRemove( k, m_hash(k) ) >= 0; } + bool Remove( KeyAlt_t k, unsigned int hash ) { Assert( hash == m_hash(k) ); return DoRemove( k, hash ) >= 0; } + + // Remove while iterating, returns the next handle for forward iteration + // Note: aside from this, ALL handles are invalid if an element is removed + handle_t RemoveAndAdvance( handle_t idx ); + + // Remove by handle, convenient when you look up a handle and do something with it before removing the element + void RemoveByHandle( handle_t idx ); + + // Nuke contents + void RemoveAll(); + + // Nuke and release memory. + void Purge() { RemoveAll(); m_table.Purge(); } + + // Reserve table capacity up front to avoid reallocation during insertions + void Reserve( int expected ) { if ( expected > m_nUsed ) DoRealloc( expected * 4 / 3 ); } + + // Shrink to best-fit size, re-insert keys for optimal lookup + void Compact( bool bMinimal ) { DoRealloc( bMinimal ? m_nUsed : ( m_nUsed * 4 / 3 ) ); } + + // Access functions. Note: if ValueT is empty_t, all functions return const keys. + typedef typename KVPair::ValueReturn_t Element_t; + KeyT const &Key( handle_t idx ) const { return m_table[idx]->m_key; } + Element_t const &Element( handle_t idx ) const { return m_table[idx]->GetValue(); } + Element_t &Element(handle_t idx) { return m_table[idx]->GetValue(); } + Element_t const &operator[]( handle_t idx ) const { return m_table[idx]->GetValue(); } + Element_t &operator[]( handle_t idx ) { return m_table[idx]->GetValue(); } + + void ReplaceKey( handle_t idx, KeyArg_t k ) { Assert( m_eq( m_table[idx]->m_key, k ) && m_hash( k ) == m_hash( m_table[idx]->m_key ) ); m_table[idx]->m_key = k; } + void ReplaceKey( handle_t idx, KeyAlt_t k ) { Assert( m_eq( m_table[idx]->m_key, k ) && m_hash( k ) == m_hash( m_table[idx]->m_key ) ); m_table[idx]->m_key = k; } + + Element_t const &Get( KeyArg_t k, Element_t const &defaultValue ) const { handle_t h = Find( k ); if ( h != InvalidHandle() ) return Element( h ); return defaultValue; } + Element_t const &Get( KeyAlt_t k, Element_t const &defaultValue ) const { handle_t h = Find( k ); if ( h != InvalidHandle() ) return Element( h ); return defaultValue; } + + Element_t const *GetPtr( KeyArg_t k ) const { handle_t h = Find(k); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + Element_t const *GetPtr( KeyAlt_t k ) const { handle_t h = Find(k); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + Element_t *GetPtr( KeyArg_t k ) { handle_t h = Find( k ); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + Element_t *GetPtr( KeyAlt_t k ) { handle_t h = Find( k ); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + + // Swap memory and contents with another identical hashtable + // (NOTE: if using function pointers or functors with state, + // it is up to the caller to ensure that they are compatible!) + void Swap( CUtlHashtable &other ) { m_table.Swap(other.m_table); ::V_swap(m_nUsed, other.m_nUsed); } + + // GetMemoryUsage returns all memory held by this class + // and its held classes. It does not include sizeof(*this). + size_t GetMemoryUsage() const + { + return m_table.AllocSize(); + } + + size_t GetReserveCount( )const + { + return m_table.Count(); + } + + +#if _DEBUG + // Validate the integrity of the hashtable + void DbgCheckIntegrity() const; +#endif + +private: + CUtlHashtable(const CUtlHashtable& copyConstructorIsNotImplemented); +}; + + +// Set external memory (raw byte buffer, best-fit) +template +void CUtlHashtable::SetExternalBuffer( byte* pRawBuffer, unsigned int nBytes, bool bAssumeOwnership, bool bGrowable ) +{ + Assert( ((uintptr_t)pRawBuffer % __alignof(int)) == 0 ); + uint32 bestSize = LargestPowerOfTwoLessThanOrEqual( nBytes / sizeof(entry_t) ); + Assert( bestSize != 0 && bestSize*sizeof(entry_t) <= nBytes ); + + return SetExternalBuffer( (entry_t*) pRawBuffer, bestSize, bAssumeOwnership, bGrowable ); +} + +// Set external memory (typechecked, must be power of two) +template +void CUtlHashtable::SetExternalBuffer( entry_t* pBuffer, unsigned int nSize, bool bAssumeOwnership, bool bGrowable ) +{ + Assert( IsPowerOfTwo(nSize) ); + Assert( m_nUsed == 0 ); + for ( uint i = 0; i < nSize; ++i ) + pBuffer[i].MarkInvalid(); + if ( bAssumeOwnership ) + m_table.AssumeMemory( pBuffer, nSize ); + else + m_table.SetExternalBuffer( pBuffer, nSize ); + m_bSizeLocked = !bGrowable; +} + +// Allocate an empty table and then re-insert all existing entries. +template +void CUtlHashtable::DoRealloc( int size ) +{ + Assert( !m_bSizeLocked ); + + size = SmallestPowerOfTwoGreaterOrEqual( MAX( m_nMinSize, size ) ); + Assert( size > 0 && (uint)size <= entry_t::IdealIndex( ~0, 0x1FFFFFFF ) ); // reasonable power of 2 + Assert( size > m_nUsed ); + + CUtlMemory oldTable; + oldTable.Swap( m_table ); + entry_t * RESTRICT const pOldBase = oldTable.Base(); + + m_table.EnsureCapacity( size ); + entry_t * const pNewBase = m_table.Base(); + for ( int i = 0; i < size; ++i ) + pNewBase[i].MarkInvalid(); + + int nLeftToMove = m_nUsed; + m_nUsed = 0; + for ( int i = oldTable.Count() - 1; i >= 0; --i ) + { + if ( pOldBase[i].IsValid() ) + { + int newIdx = DoInsertUnconstructed( pOldBase[i].flags_and_hash, false ); + pNewBase[newIdx].MoveDataFrom( pOldBase[i] ); + if ( --nLeftToMove == 0 ) + break; + } + } + Assert( nLeftToMove == 0 ); +} + + +// Move an existing entry to a free slot, leaving a hole behind +template +void CUtlHashtable::BumpEntry( unsigned int idx ) +{ + Assert( m_table[idx].IsValid() ); + Assert( m_nUsed < m_table.Count() ); + + entry_t* table = m_table.Base(); + unsigned int slotmask = m_table.Count()-1; + unsigned int new_flags_and_hash = table[idx].flags_and_hash & (FLAG_LAST | MASK_HASH); + + unsigned int chainid = entry_t::IdealIndex( new_flags_and_hash, slotmask ); + + // Look for empty slots scanning forward, stripping FLAG_LAST as we go. + // Note: this potentially strips FLAG_LAST from table[idx] if we pass it + int newIdx = chainid; // start at ideal slot + for ( ; ; newIdx = (newIdx + 1) & slotmask ) + { + if ( table[newIdx].IdealIndex( slotmask ) == chainid ) + { + if ( table[newIdx].flags_and_hash & FLAG_LAST ) + { + table[newIdx].flags_and_hash &= ~FLAG_LAST; + new_flags_and_hash |= FLAG_LAST; + } + continue; + } + if ( table[newIdx].IsValid() ) + { + continue; + } + break; + } + + // Did we pick something closer to the ideal slot, leaving behind a + // FLAG_LAST bit on the current slot because we didn't scan past it? + if ( table[idx].flags_and_hash & FLAG_LAST ) + { +#ifdef _DEBUG + Assert( new_flags_and_hash & FLAG_LAST ); + // Verify logic: we must have moved to an earlier slot, right? + uint offset = ((uint)idx - chainid + slotmask + 1) & slotmask; + uint newOffset = ((uint)newIdx - chainid + slotmask + 1) & slotmask; + Assert( newOffset < offset ); +#endif + // Scan backwards from old to new location, depositing FLAG_LAST on + // the first match we find. (+slotmask) is the same as (-1) without + // having to make anyone think about two's complement shenanigans. + int scan = (idx + slotmask) & slotmask; + while ( scan != newIdx ) + { + if ( table[scan].IdealIndex( slotmask ) == chainid ) + { + table[scan].flags_and_hash |= FLAG_LAST; + new_flags_and_hash &= ~FLAG_LAST; + break; + } + scan = (scan + slotmask) & slotmask; + } + } + + // Move entry to the free slot we found, leaving a hole at idx + table[newIdx].flags_and_hash = new_flags_and_hash; + table[newIdx].MoveDataFrom( table[idx] ); + table[idx].MarkInvalid(); +} + + +// Insert a value at the root position for that value's hash chain. +template +int CUtlHashtable::DoInsertUnconstructed( unsigned int h, bool allowGrow ) +{ + if ( allowGrow && !m_bSizeLocked ) + { + // Keep the load factor between .25 and .75 + int newSize = m_nUsed + 1; + if ( ( newSize*4 < m_table.Count() && m_table.Count() > m_nMinSize*2 ) || newSize*4 > m_table.Count()*3 ) + { + DoRealloc( newSize * 4 / 3 ); + } + } + Assert( m_nUsed < m_table.Count() ); + ++m_nUsed; + + entry_t* table = m_table.Base(); + unsigned int slotmask = m_table.Count()-1; + unsigned int new_flags_and_hash = FLAG_LAST | (h & MASK_HASH); + unsigned int idx = entry_t::IdealIndex( h, slotmask ); + if ( table[idx].IdealIndex( slotmask ) == idx ) + { + // There is already an entry in this chain. + new_flags_and_hash &= ~FLAG_LAST; + BumpEntry(idx); + } + else if ( table[idx].IsValid() ) + { + // Somebody else is living in our ideal index but does not belong + // to our entry chain; move it out of the way, start a new chain. + BumpEntry(idx); + } + table[idx].flags_and_hash = new_flags_and_hash; + return idx; +} + + +// Key lookup. Can also return previous-in-chain if result is a chained slot. +template +template +UtlHashHandle_t CUtlHashtable::DoLookup( KeyParamT x, unsigned int h, handle_t *pPreviousInChain ) const +{ + if ( m_nUsed == 0 ) + { + // Empty table. + return (handle_t) -1; + } + + const entry_t* table = m_table.Base(); + unsigned int slotmask = m_table.Count()-1; + Assert( m_table.Count() > 0 && (slotmask & m_table.Count()) == 0 ); + unsigned int chainid = entry_t::IdealIndex( h, slotmask ); + + unsigned int idx = chainid; + if ( table[idx].IdealIndex( slotmask ) != chainid ) + { + // Nothing in root position? No match. + return (handle_t) -1; + } + + // Linear scan until found or end of chain + handle_t lastIdx = (handle_t) -1; + while (1) + { + // Only examine this slot if it is valid and belongs to our hash chain + if ( table[idx].IdealIndex( slotmask ) == chainid ) + { + // Test the full-width hash to avoid unnecessary calls to m_eq() + if ( ((table[idx].flags_and_hash ^ h) & MASK_HASH) == 0 && m_eq( table[idx]->m_key, x ) ) + { + // Found match! + if (pPreviousInChain) + *pPreviousInChain = lastIdx; + + return (handle_t) idx; + } + + if ( table[idx].flags_and_hash & FLAG_LAST ) + { + // End of chain. No match. + return (handle_t) -1; + } + + lastIdx = (handle_t) idx; + } + idx = (idx + 1) & slotmask; + } +} + + +// Key insertion, or return index of existing key if found +template +template +UtlHashHandle_t CUtlHashtable::DoInsert( KeyParamT k, unsigned int h ) +{ + handle_t idx = DoLookup( k, h, NULL ); + if ( idx == (handle_t) -1 ) + { + idx = (handle_t) DoInsertUnconstructed( h, true ); + ConstructOneArg( m_table[ idx ].Raw(), k ); + } + return idx; +} + +// Key insertion, or return index of existing key if found +template +template +UtlHashHandle_t CUtlHashtable::DoInsert( KeyParamT k, typename ArgumentTypeInfo::Arg_t v, unsigned int h, bool *pDidInsert ) +{ + handle_t idx = DoLookup( k, h, NULL ); + if ( idx == (handle_t) -1 ) + { + idx = (handle_t) DoInsertUnconstructed( h, true ); + ConstructTwoArg( m_table[ idx ].Raw(), k, v ); + if ( pDidInsert ) *pDidInsert = true; + } + else + { + if ( pDidInsert ) *pDidInsert = false; + } + return idx; +} + +// Key insertion +template +template +UtlHashHandle_t CUtlHashtable::DoInsertNoCheck( KeyParamT k, typename ArgumentTypeInfo::Arg_t v, unsigned int h ) +{ + Assert( DoLookup( k, h, NULL ) == (handle_t) -1 ); + handle_t idx = (handle_t) DoInsertUnconstructed( h, true ); + ConstructTwoArg( m_table[ idx ].Raw(), k, v ); + return idx; +} + + +// Remove single element by key + hash. Returns the location of the new empty hole. +template +template +int CUtlHashtable::DoRemove( KeyParamT x, unsigned int h ) +{ + unsigned int slotmask = m_table.Count()-1; + handle_t previous = (handle_t) -1; + int idx = (int) DoLookup( x, h, &previous ); + if (idx == -1) + { + return -1; + } + + enum { FAKEFLAG_ROOT = 1 }; + int nLastAndRootFlags = m_table[idx].flags_and_hash & FLAG_LAST; + nLastAndRootFlags |= ( (uint)idx == m_table[idx].IdealIndex( slotmask ) ); + + // Remove from table + m_table[idx].MarkInvalid(); + Destruct( m_table[idx].Raw() ); + --m_nUsed; + + if ( nLastAndRootFlags == FLAG_LAST ) // last only, not root + { + // This was the end of the chain - mark previous as last. + // (This isn't the root, so there must be a previous.) + Assert( previous != (handle_t) -1 ); + m_table[previous].flags_and_hash |= FLAG_LAST; + } + + if ( nLastAndRootFlags == FAKEFLAG_ROOT ) // root only, not last + { + // If we are removing the root and there is more to the chain, + // scan to find the next chain entry and move it to the root. + unsigned int chainid = entry_t::IdealIndex( h, slotmask ); + unsigned int nextIdx = idx; + while (1) + { + nextIdx = (nextIdx + 1) & slotmask; + if ( m_table[nextIdx].IdealIndex( slotmask ) == chainid ) + { + break; + } + } + Assert( !(m_table[nextIdx].flags_and_hash & FLAG_FREE) ); + + // Leave a hole where the next entry in the chain was. + m_table[idx].flags_and_hash = m_table[nextIdx].flags_and_hash; + m_table[idx].MoveDataFrom( m_table[nextIdx] ); + m_table[nextIdx].MarkInvalid(); + return nextIdx; + } + + // The hole is still where the element used to be. + return idx; +} + + +// Assignment operator. It's up to the user to make sure that the hash and equality functors match. +template +CUtlHashtable &CUtlHashtable::operator=( CUtlHashtable const &src ) +{ + if ( &src != this ) + { + Assert( !m_bSizeLocked || m_table.Count() >= src.m_nUsed ); + if ( !m_bSizeLocked ) + { + Purge(); + Reserve(src.m_nUsed); + } + else + { + RemoveAll(); + } + + const entry_t * srcTable = src.m_table.Base(); + for ( int i = src.m_table.Count() - 1; i >= 0; --i ) + { + if ( srcTable[i].IsValid() ) + { + // If this assert trips, double-check that both hashtables + // have the same hash function pointers or hash functor state! + Assert( m_hash(srcTable[i]->m_key) == src.m_hash(srcTable[i]->m_key) ); + int newIdx = DoInsertUnconstructed( srcTable[i].flags_and_hash , false ); + CopyConstruct( m_table[newIdx].Raw(), *srcTable[i].Raw() ); // copy construct KVPair + } + } + } + return *this; +} + +// Remove and return the next valid iterator for a forward iteration. +template +UtlHashHandle_t CUtlHashtable::RemoveAndAdvance( UtlHashHandle_t idx ) +{ + Assert( IsValidHandle( idx ) ); + + // TODO optimize, implement DoRemoveAt that does not need to re-evaluate equality in DoLookup + int hole = DoRemove< KeyArg_t >( m_table[idx]->m_key, m_table[idx].flags_and_hash & MASK_HASH ); + // DoRemove returns the index of the element that it moved to fill the hole, if any. + if ( hole <= (int) idx ) + { + // Didn't fill, or filled from a previously seen element. + return NextHandle( idx ); + } + else + { + // Do not advance; slot has a new un-iterated value. + Assert( IsValidHandle(idx) ); + return idx; + } +} + + +// Remove and return the next valid iterator for a forward iteration. +template +void CUtlHashtable::RemoveByHandle( UtlHashHandle_t idx ) +{ + Assert( IsValidHandle( idx ) ); + + // Copied from RemoveAndAdvance(): TODO optimize, implement DoRemoveAt that does not need to re-evaluate equality in DoLookup + DoRemove< KeyArg_t >( m_table[idx]->m_key, m_table[idx].flags_and_hash & MASK_HASH ); +} + + +// Burn it with fire. +template +void CUtlHashtable::RemoveAll() +{ + int used = m_nUsed; + if ( used != 0 ) + { + entry_t* table = m_table.Base(); + for ( int i = m_table.Count() - 1; i >= 0; --i ) + { + if ( table[i].IsValid() ) + { + table[i].MarkInvalid(); + Destruct( table[i].Raw() ); + if ( --used == 0 ) + break; + } + } + m_nUsed = 0; + } +} + +template +UtlHashHandle_t CUtlHashtable::NextHandle( handle_t start ) const +{ + const entry_t *table = m_table.Base(); + for ( int i = (int)start + 1; i < m_table.Count(); ++i ) + { + if ( table[i].IsValid() ) + return (handle_t) i; + } + return (handle_t) -1; +} + + +#if _DEBUG +template +void CUtlHashtable::DbgCheckIntegrity() const +{ + // Stress test the hash table as a test of both container functionality + // and also the validity of the user's Hash and Equal function objects. + // NOTE: will fail if function objects require any sort of state! + CUtlHashtable clone; + unsigned int bytes = sizeof(entry_t)*max(16,m_table.Count()); + byte* tempbuf = (byte*) malloc(bytes); + clone.SetExternalBuffer( tempbuf, bytes, false, false ); + clone = *this; + + int count = 0, roots = 0, ends = 0; + int slotmask = m_table.Count() - 1; + for (int i = 0; i < m_table.Count(); ++i) + { + if (!(m_table[i].flags_and_hash & FLAG_FREE)) ++count; + if (m_table[i].IdealIndex(slotmask) == (uint)i) ++roots; + if (m_table[i].flags_and_hash & FLAG_LAST) ++ends; + if (m_table[i].IsValid()) + { + Assert( Find(m_table[i]->m_key) == (handle_t)i ); + Verify( clone.Remove(m_table[i]->m_key) ); + } + else + { + Assert( m_table[i].flags_and_hash == FLAG_FREE ); + } + } + Assert( count == Count() && count >= roots && roots == ends ); + Assert( clone.Count() == 0 ); + clone.Purge(); + free(tempbuf); +} +#endif + +//----------------------------------------------------------------------- +// CUtlStableHashtable +//----------------------------------------------------------------------- + +// Stable hashtables are less memory and cache efficient, but can be +// iterated quickly and their element handles are completely stable. +// Implemented as a hashtable which only stores indices, and a separate +// CUtlLinkedList data table which contains key-value pairs; this may +// change to a more efficient structure in the future if space becomes +// critical. I have some ideas about that but not the time to implement +// at the moment. -henryg + +// Note: RemoveAndAdvance is slower than in CUtlHashtable because the +// key needs to be re-hashed under the current implementation. + +template , typename KeyIsEqualT = DefaultEqualFunctor, typename IndexStorageT = uint16, typename AlternateKeyT = typename ArgumentTypeInfo::Alt_t > +class CUtlStableHashtable +{ +public: + typedef typename ArgumentTypeInfo::Arg_t KeyArg_t; + typedef typename ArgumentTypeInfo::Arg_t ValueArg_t; + typedef typename ArgumentTypeInfo::Arg_t KeyAlt_t; + typedef typename CTypeSelect< sizeof( IndexStorageT ) == 2, uint16, uint32 >::type IndexStorage_t; + +protected: + //COMPILE_TIME_ASSERT( sizeof( IndexStorage_t ) == sizeof( IndexStorageT ) ); + + typedef CUtlKeyValuePair< KeyT, ValueT > KVPair; + struct HashProxy; + struct EqualProxy; + struct IndirectIndex; + + typedef CUtlHashtable< IndirectIndex, empty_t, HashProxy, EqualProxy, AlternateKeyT > Hashtable_t; + typedef CUtlLinkedList< KVPair, IndexStorage_t > LinkedList_t; + + template bool DoRemove( KeyArgumentT k ); + template UtlHashHandle_t DoFind( KeyArgumentT k ) const; + template UtlHashHandle_t DoInsert( KeyArgumentT k ); + template UtlHashHandle_t DoInsert( KeyArgumentT k, ValueArgumentT v ); + +public: + + KeyHashT &GetHashRef() { return m_table.GetHashRef().m_hash; } + KeyIsEqualT &GetEqualRef() { return m_table.GetEqualRef().m_eq; } + KeyHashT const &GetHashRef() const { return m_table.GetHashRef().m_hash; } + KeyIsEqualT const &GetEqualRef() const { return m_table.GetEqualRef().m_eq; } + + UtlHashHandle_t Insert( KeyArg_t k ) { return DoInsert( k ); } + UtlHashHandle_t Insert( KeyAlt_t k ) { return DoInsert( k ); } + UtlHashHandle_t Insert( KeyArg_t k, ValueArg_t v ) { return DoInsert( k, v ); } + UtlHashHandle_t Insert( KeyAlt_t k, ValueArg_t v ) { return DoInsert( k, v ); } + UtlHashHandle_t Find( KeyArg_t k ) const { return DoFind( k ); } + UtlHashHandle_t Find( KeyAlt_t k ) const { return DoFind( k ); } + bool Remove( KeyArg_t k ) { return DoRemove( k ); } + bool Remove( KeyAlt_t k ) { return DoRemove( k ); } + + void RemoveAll() { m_table.RemoveAll(); m_data.RemoveAll(); } + void Purge() { m_table.Purge(); m_data.Purge(); } + int Count() const { return m_table.Count(); } + + typedef typename KVPair::ValueReturn_t Element_t; + KeyT const &Key( UtlHashHandle_t idx ) const { return m_data[idx].m_key; } + Element_t const &Element( UtlHashHandle_t idx ) const { return m_data[idx].GetValue(); } + Element_t &Element( UtlHashHandle_t idx ) { return m_data[idx].GetValue(); } + Element_t const &operator[]( UtlHashHandle_t idx ) const { return m_data[idx].GetValue(); } + Element_t &operator[]( UtlHashHandle_t idx ) { return m_data[idx].GetValue(); } + + void ReplaceKey( UtlHashHandle_t idx, KeyArg_t k ) { Assert( GetEqualRef()( m_data[idx].m_key, k ) && GetHashRef()( k ) == GetHashRef()( m_data[idx].m_key ) ); m_data[idx].m_key = k; } + void ReplaceKey( UtlHashHandle_t idx, KeyAlt_t k ) { Assert( GetEqualRef()( m_data[idx].m_key, k ) && GetHashRef()( k ) == GetHashRef()( m_data[idx].m_key ) ); m_data[idx].m_key = k; } + + Element_t const &Get( KeyArg_t k, Element_t const &defaultValue ) const { UtlHashHandle_t h = Find( k ); if ( h != InvalidHandle() ) return Element( h ); return defaultValue; } + Element_t const &Get( KeyAlt_t k, Element_t const &defaultValue ) const { UtlHashHandle_t h = Find( k ); if ( h != InvalidHandle() ) return Element( h ); return defaultValue; } + + Element_t const *GetPtr( KeyArg_t k ) const { UtlHashHandle_t h = Find(k); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + Element_t const *GetPtr( KeyAlt_t k ) const { UtlHashHandle_t h = Find(k); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + Element_t *GetPtr( KeyArg_t k ) { UtlHashHandle_t h = Find( k ); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + Element_t *GetPtr( KeyAlt_t k ) { UtlHashHandle_t h = Find( k ); if ( h != InvalidHandle() ) return &Element( h ); return NULL; } + + UtlHashHandle_t FirstHandle() const { return ExtendInvalidHandle( m_data.Head() ); } + UtlHashHandle_t NextHandle( UtlHashHandle_t h ) const { return ExtendInvalidHandle( m_data.Next( h ) ); } + bool IsValidHandle( UtlHashHandle_t h ) const { return m_data.IsValidIndex( h ); } + UtlHashHandle_t InvalidHandle() const { return (UtlHashHandle_t)-1; } + + UtlHashHandle_t RemoveAndAdvance( UtlHashHandle_t h ) + { + Assert( m_data.IsValidIndex( h ) ); + m_table.Remove( IndirectIndex( h ) ); + IndexStorage_t next = m_data.Next( h ); + m_data.Remove( h ); + return ExtendInvalidHandle(next); + } + + void Compact( bool bMinimal ) { m_table.Compact( bMinimal ); /*m_data.Compact();*/ } + + void Swap( CUtlStableHashtable &other ) + { + m_table.Swap(other.m_table); + // XXX swapping CUtlLinkedList by block memory swap, ugh + char buf[ sizeof(m_data) ]; + memcpy( buf, &m_data, sizeof(m_data) ); + memcpy( &m_data, &other.m_data, sizeof(m_data) ); + memcpy( &other.m_data, buf, sizeof(m_data) ); + } + + +protected: + // Perform extension of 0xFFFF to 0xFFFFFFFF if necessary. Note: ( a < CONSTANT ) ? 0 : -1 is usually branchless + static UtlHashHandle_t ExtendInvalidHandle( uint32 x ) { return x; } + static UtlHashHandle_t ExtendInvalidHandle( uint16 x ) { uint32 a = x; return a | ( ( a < 0xFFFFu ) ? 0 : -1 ); } + + struct IndirectIndex + { + explicit IndirectIndex(IndexStorage_t i) : m_index(i) { } + IndexStorage_t m_index; + }; + + struct HashProxy + { + KeyHashT m_hash; + unsigned int operator()( IndirectIndex idx ) const + { + const ptrdiff_t tableoffset = (uintptr_t)(&((Hashtable_t*)1024)->GetHashRef()) - 1024; + const ptrdiff_t owneroffset = offsetof(CUtlStableHashtable, m_table) + tableoffset; + CUtlStableHashtable* pOwner = (CUtlStableHashtable*)((uintptr_t)this - owneroffset); + return m_hash( pOwner->m_data[ idx.m_index ].m_key ); + } + unsigned int operator()( KeyArg_t k ) const { return m_hash( k ); } + unsigned int operator()( KeyAlt_t k ) const { return m_hash( k ); } + }; + + struct EqualProxy + { + KeyIsEqualT m_eq; + unsigned int operator()( IndirectIndex lhs, IndirectIndex rhs ) const + { + return lhs.m_index == rhs.m_index; + } + unsigned int operator()( IndirectIndex lhs, KeyArg_t rhs ) const + { + const ptrdiff_t tableoffset = (uintptr_t)(&((Hashtable_t*)1024)->GetEqualRef()) - 1024; + const ptrdiff_t owneroffset = offsetof(CUtlStableHashtable, m_table) + tableoffset; + CUtlStableHashtable* pOwner = (CUtlStableHashtable*)((uintptr_t)this - owneroffset); + return m_eq( pOwner->m_data[ lhs.m_index ].m_key, rhs ); + } + unsigned int operator()( IndirectIndex lhs, KeyAlt_t rhs ) const + { + const ptrdiff_t tableoffset = (uintptr_t)(&((Hashtable_t*)1024)->GetEqualRef()) - 1024; + const ptrdiff_t owneroffset = offsetof(CUtlStableHashtable, m_table) + tableoffset; + CUtlStableHashtable* pOwner = (CUtlStableHashtable*)((uintptr_t)this - owneroffset); + return m_eq( pOwner->m_data[ lhs.m_index ].m_key, rhs ); + } + }; + + class CCustomLinkedList : public LinkedList_t + { + public: + int AddToTailUnconstructed() + { + IndexStorage_t newNode = this->AllocInternal(); + if ( newNode != this->InvalidIndex() ) + this->LinkToTail( newNode ); + return newNode; + } + }; + + Hashtable_t m_table; + CCustomLinkedList m_data; +}; + +template +template +inline bool CUtlStableHashtable::DoRemove( KeyArgumentT k ) +{ + unsigned int hash = m_table.GetHashRef()( k ); + UtlHashHandle_t h = m_table.template DoLookup( k, hash, NULL ); + if ( h == m_table.InvalidHandle() ) + return false; + + int idx = m_table[ h ].m_index; + m_table.template DoRemove( IndirectIndex( idx ), hash ); + m_data.Remove( idx ); + return true; +} + +template +template +inline UtlHashHandle_t CUtlStableHashtable::DoFind( KeyArgumentT k ) const +{ + unsigned int hash = m_table.GetHashRef()( k ); + UtlHashHandle_t h = m_table.template DoLookup( k, hash, NULL ); + if ( h != m_table.InvalidHandle() ) + return m_table[ h ].m_index; + + return (UtlHashHandle_t) -1; +} + +template +template +inline UtlHashHandle_t CUtlStableHashtable::DoInsert( KeyArgumentT k ) +{ + unsigned int hash = m_table.GetHashRef()( k ); + UtlHashHandle_t h = m_table.template DoLookup( k, hash, NULL ); + if ( h != m_table.InvalidHandle() ) + return m_table[ h ].m_index; + + int idx = m_data.AddToTailUnconstructed(); + ConstructOneArg( &m_data[idx], k ); + m_table.template DoInsertNoCheck( IndirectIndex( idx ), empty_t(), hash ); + return idx; +} + +template +template +inline UtlHashHandle_t CUtlStableHashtable::DoInsert( KeyArgumentT k, ValueArgumentT v ) +{ + unsigned int hash = m_table.GetHashRef()( k ); + UtlHashHandle_t h = m_table.template DoLookup( k, hash, NULL ); + if ( h != m_table.InvalidHandle() ) + return m_table[ h ].m_index; + + int idx = m_data.AddToTailUnconstructed(); + ConstructTwoArg( &m_data[idx], k, v ); + m_table.template DoInsertNoCheck( IndirectIndex( idx ), empty_t(), hash ); + return idx; +} + +#endif // UTLHASHTABLE_H diff --git a/public/tier1/utlmap.h b/public/tier1/utlmap.h index 6f933c81b..986d2d9a8 100644 --- a/public/tier1/utlmap.h +++ b/public/tier1/utlmap.h @@ -24,11 +24,11 @@ // This is a useful macro to iterate from start to end in order in a map #define FOR_EACH_MAP( mapName, iteratorName ) \ - for ( int iteratorName = mapName.FirstInorder(); iteratorName != mapName.InvalidIndex(); iteratorName = mapName.NextInorder( iteratorName ) ) + for ( int iteratorName = (mapName).FirstInorder(); iteratorName != (mapName).InvalidIndex(); iteratorName = (mapName).NextInorder( iteratorName ) ) // faster iteration, but in an unspecified order #define FOR_EACH_MAP_FAST( mapName, iteratorName ) \ - for ( int iteratorName = 0; iteratorName < mapName.MaxElement(); ++iteratorName ) if ( !mapName.IsValidIndex( iteratorName ) ) continue; else + for ( int iteratorName = 0; iteratorName < (mapName).MaxElement(); ++iteratorName ) if ( !(mapName).IsValidIndex( iteratorName ) ) continue; else template class CUtlMap @@ -123,6 +123,8 @@ class CUtlMap void RemoveAll( ) { m_Tree.RemoveAll(); } void Purge( ) { m_Tree.Purge(); } + + void PurgeAndDeleteElements(); // Iteration IndexType_t FirstInorder() const { return m_Tree.FirstInorder(); } @@ -198,6 +200,32 @@ class CUtlMap CTree m_Tree; }; +template< typename K, typename T, typename I > +inline void CUtlMap::PurgeAndDeleteElements() +{ + for ( I i = 0; i < MaxElement(); ++i ) + { + if ( !IsValidIndex( i ) ) + continue; + + delete Element( i ); + } + + Purge(); +} + +template < typename K, typename T, typename I > +void DeepCopyMap( const CUtlMap& pmapIn, CUtlMap *out_pmapOut ) +{ + Assert( out_pmapOut ); + + out_pmapOut->Purge(); + FOR_EACH_MAP_FAST( pmapIn, i ) + { + out_pmapOut->Insert( pmapIn.Key( i ), pmapIn.Element( i ) ); + } +} + //----------------------------------------------------------------------------- #endif // UTLMAP_H diff --git a/public/tier1/utlmemory.h b/public/tier1/utlmemory.h index 5b0c8ffb4..a667f40a6 100644 --- a/public/tier1/utlmemory.h +++ b/public/tier1/utlmemory.h @@ -17,6 +17,7 @@ #include "tier0/dbg.h" #include #include "tier0/platform.h" +#include "mathlib/mathlib.h" #include "tier0/memalloc.h" #include "tier0/memdbgon.h" @@ -264,6 +265,133 @@ class CUtlMemoryFixed char m_Memory[ SIZE*sizeof(T) + nAlignment ]; }; +#ifdef _LINUX +#define REMEMBER_ALLOC_SIZE_FOR_VALGRIND 1 +#endif + +//----------------------------------------------------------------------------- +// The CUtlMemoryConservative class: +// A dynamic memory class that tries to minimize overhead (itself small, no custom grow factor) +//----------------------------------------------------------------------------- +template< typename T > +class CUtlMemoryConservative +{ + +public: + // constructor, destructor + CUtlMemoryConservative( int nGrowSize = 0, int nInitSize = 0 ) : m_pMemory( NULL ) + { +#ifdef REMEMBER_ALLOC_SIZE_FOR_VALGRIND + m_nCurAllocSize = 0; +#endif + + } + CUtlMemoryConservative( T* pMemory, int numElements ) { Assert( 0 ); } + ~CUtlMemoryConservative() { if ( m_pMemory ) free( m_pMemory ); } + + // Can we use this index? + bool IsIdxValid( int i ) const { return ( IsDebug() ) ? ( i >= 0 && i < NumAllocated() ) : ( i >= 0 ); } + static int InvalidIndex() { return -1; } + + // Gets the base address + T* Base() { return m_pMemory; } + const T* Base() const { return m_pMemory; } + + // element access + T& operator[]( int i ) { Assert( IsIdxValid(i) ); return Base()[i]; } + const T& operator[]( int i ) const { Assert( IsIdxValid(i) ); return Base()[i]; } + T& Element( int i ) { Assert( IsIdxValid(i) ); return Base()[i]; } + const T& Element( int i ) const { Assert( IsIdxValid(i) ); return Base()[i]; } + + // Attaches the buffer to external memory.... + void SetExternalBuffer( T* pMemory, int numElements ) { Assert( 0 ); } + + // Size + FORCEINLINE void RememberAllocSize( size_t sz ) + { +#ifdef REMEMBER_ALLOC_SIZE_FOR_VALGRIND + m_nCurAllocSize = sz; +#endif + } + + size_t AllocSize( void ) const + { +#ifdef REMEMBER_ALLOC_SIZE_FOR_VALGRIND + return m_nCurAllocSize; +#else + return ( m_pMemory ) ? g_pMemAlloc->GetSize( m_pMemory ) : 0; +#endif + } + + int NumAllocated() const + { + return AllocSize() / sizeof( T ); + } + int Count() const + { + return NumAllocated(); + } + + FORCEINLINE void ReAlloc( size_t sz ) + { + m_pMemory = (T*)realloc( m_pMemory, sz ); + RememberAllocSize( sz ); + } + // Grows the memory, so that at least allocated + num elements are allocated + void Grow( int num = 1 ) + { + int nCurN = NumAllocated(); + ReAlloc( ( nCurN + num ) * sizeof( T ) ); + } + + // Makes sure we've got at least this much memory + void EnsureCapacity( int num ) + { + size_t nSize = sizeof( T ) * MAX( num, Count() ); + ReAlloc( nSize ); + } + + // Memory deallocation + void Purge() + { + free( m_pMemory ); + RememberAllocSize( 0 ); + m_pMemory = NULL; + } + + // Purge all but the given number of elements + void Purge( int numElements ) { ReAlloc( numElements * sizeof(T) ); } + + // is the memory externally allocated? + bool IsExternallyAllocated() const { return false; } + + // Set the size by which the memory grows + void SetGrowSize( int size ) {} + + class Iterator_t + { + public: + Iterator_t( int i, int _limit ) : index( i ), limit( _limit ) {} + int index; + int limit; + bool operator==( const Iterator_t it ) const { return index == it.index; } + bool operator!=( const Iterator_t it ) const { return index != it.index; } + }; + Iterator_t First() const { int limit = NumAllocated(); return Iterator_t( limit ? 0 : InvalidIndex(), limit ); } + Iterator_t Next( const Iterator_t &it ) const { return Iterator_t( ( it.index + 1 < it.limit ) ? it.index + 1 : InvalidIndex(), it.limit ); } + int GetIndex( const Iterator_t &it ) const { return it.index; } + bool IsIdxAfter( int i, const Iterator_t &it ) const { return i > it.index; } + bool IsValidIterator( const Iterator_t &it ) const { return IsIdxValid( it.index ) && ( it.index < it.limit ); } + Iterator_t InvalidIterator() const { return Iterator_t( InvalidIndex(), 0 ); } + +private: + T *m_pMemory; +#ifdef REMEMBER_ALLOC_SIZE_FOR_VALGRIND + size_t m_nCurAllocSize; +#endif + +}; + //----------------------------------------------------------------------------- // constructor, destructor //----------------------------------------------------------------------------- diff --git a/public/tier1/utlrbtree.h b/public/tier1/utlrbtree.h index b9b49eb8b..76e7b9d95 100644 --- a/public/tier1/utlrbtree.h +++ b/public/tier1/utlrbtree.h @@ -27,6 +27,16 @@ class CDefOps #define DefLessFunc( type ) CDefOps< type >::LessFunc +template +class CDefLess +{ +public: + CDefLess() {} + CDefLess( int i ) {} + inline bool operator()( const T &lhs, const T &rhs ) const { return ( lhs < rhs ); } + inline bool operator!() const { return false; } +}; + //------------------------------------- inline bool StringLessThan( const char * const &lhs, const char * const &rhs) { return ( strcmp( lhs, rhs) < 0 ); } diff --git a/public/tier1/utlstring.h b/public/tier1/utlstring.h index 6c4274015..d043352c7 100644 --- a/public/tier1/utlstring.h +++ b/public/tier1/utlstring.h @@ -125,6 +125,8 @@ class CUtlString // Strips the trailing slash void StripTrailingSlash(); + + void ToLower(); CUtlString &operator=( const CUtlString &src ); CUtlString &operator=( const char *src ); @@ -140,6 +142,9 @@ class CUtlString CUtlString &operator+=( char c ); CUtlString &operator+=( int rhs ); CUtlString &operator+=( double rhs ); + + void Append( const char *pchAddition ) + { this->operator+=(pchAddition); } int Format( const char *pFormat, ... ); @@ -147,6 +152,15 @@ class CUtlString CUtlBinaryBlock m_Storage; }; +inline void CUtlString::ToLower() +{ + if ( IsEmpty() ) + { + return; + } + + V_strlower( (char *)m_Storage.Get() ); +} //----------------------------------------------------------------------------- // Inline methods @@ -156,5 +170,121 @@ inline bool CUtlString::IsEmpty() const return Length() == 0; } +template < typename T > +class StringFuncs +{ +public: + static T *Duplicate( const T *pValue ); + // Note that this function takes a character count, and does not guarantee null-termination. + static void Copy( T *out_pOut, const T *pIn, int iLengthInChars ); + static int Compare( const T *pLhs, const T *pRhs ); + static int CaselessCompare( const T *pLhs, const T *pRhs ); + static int Length( const T *pValue ); + static const T *FindChar( const T *pStr, const T cSearch ); + static const T *EmptyString(); + static const T *NullDebugString(); +}; + +template < > +class StringFuncs +{ +public: + static char *Duplicate( const char *pValue ) { return strdup( pValue ); } + // Note that this function takes a character count, and does not guarantee null-termination. + static void Copy( OUT_CAP(iLengthInChars) char *out_pOut, const char *pIn, int iLengthInChars ) { strncpy( out_pOut, pIn, iLengthInChars ); } + static int Compare( const char *pLhs, const char *pRhs ) { return strcmp( pLhs, pRhs ); } + static int CaselessCompare( const char *pLhs, const char *pRhs ) { return Q_strcasecmp( pLhs, pRhs ); } + static int Length( const char *pValue ) { return (int)strlen( pValue ); } + static const char *FindChar( const char *pStr, const char cSearch ) { return strchr( pStr, cSearch ); } + static const char *EmptyString() { return ""; } + static const char *NullDebugString() { return "(null)"; } +}; + +template < > +class StringFuncs +{ +public: + static wchar_t *Duplicate( const wchar_t *pValue ) { return wcsdup( pValue ); } + // Note that this function takes a character count, and does not guarantee null-termination. + static void Copy( OUT_CAP(iLengthInChars) wchar_t *out_pOut, const wchar_t *pIn, int iLengthInChars ) { wcsncpy( out_pOut, pIn, iLengthInChars ); } + static int Compare( const wchar_t *pLhs, const wchar_t *pRhs ) { return wcscmp( pLhs, pRhs ); } + static int CaselessCompare( const wchar_t *pLhs, const wchar_t *pRhs ); // no implementation? + static int Length( const wchar_t *pValue ) { return (int)wcslen( pValue ); } + static const wchar_t *FindChar( const wchar_t *pStr, const wchar_t cSearch ) { return wcschr( pStr, cSearch ); } + static const wchar_t *EmptyString() { return L""; } + static const wchar_t *NullDebugString() { return L"(null)"; } +}; + +template < typename T = char > +class CUtlConstStringBase +{ +public: + CUtlConstStringBase() : m_pString( NULL ) {} + explicit CUtlConstStringBase( const T *pString ) : m_pString( NULL ) { Set( pString ); } + CUtlConstStringBase( const CUtlConstStringBase& src ) : m_pString( NULL ) { Set( src.m_pString ); } + ~CUtlConstStringBase() { Set( NULL ); } + + void Set( const T *pValue ); + void Clear() { Set( NULL ); } + + const T *Get() const { return m_pString ? m_pString : StringFuncs::EmptyString(); } + operator const T*() const { return m_pString ? m_pString : StringFuncs::EmptyString(); } + + bool IsEmpty() const { return m_pString == NULL; } // Note: empty strings are never stored by Set + + int Compare( const T *rhs ) const; + + // Logical ops + bool operator<( const T *rhs ) const { return Compare( rhs ) < 0; } + bool operator==( const T *rhs ) const { return Compare( rhs ) == 0; } + bool operator!=( const T *rhs ) const { return Compare( rhs ) != 0; } + bool operator<( const CUtlConstStringBase &rhs ) const { return Compare( rhs.m_pString ) < 0; } + bool operator==( const CUtlConstStringBase &rhs ) const { return Compare( rhs.m_pString ) == 0; } + bool operator!=( const CUtlConstStringBase &rhs ) const { return Compare( rhs.m_pString ) != 0; } + + // If these are not defined, CUtlConstString as rhs will auto-convert + // to const char* and do logical operations on the raw pointers. Ugh. + inline friend bool operator<( const T *lhs, const CUtlConstStringBase &rhs ) { return rhs.Compare( lhs ) > 0; } + inline friend bool operator==( const T *lhs, const CUtlConstStringBase &rhs ) { return rhs.Compare( lhs ) == 0; } + inline friend bool operator!=( const T *lhs, const CUtlConstStringBase &rhs ) { return rhs.Compare( lhs ) != 0; } + + CUtlConstStringBase &operator=( const T *src ) { Set( src ); return *this; } + CUtlConstStringBase &operator=( const CUtlConstStringBase &src ) { Set( src.m_pString ); return *this; } + + // Defining AltArgumentType_t is a hint to containers that they should + // implement Find/Insert/Remove functions that take const char* params. + typedef const T *AltArgumentType_t; + +protected: + const T *m_pString; +}; + +template < typename T > +void CUtlConstStringBase::Set( const T *pValue ) +{ + if ( pValue != m_pString ) + { + free( ( void* ) m_pString ); + m_pString = pValue && pValue[0] ? StringFuncs::Duplicate( pValue ) : NULL; + } +} + +template < typename T > +int CUtlConstStringBase::Compare( const T *rhs ) const +{ + // Empty or null RHS? + if ( !rhs || !rhs[0] ) + return m_pString ? 1 : 0; + + // Empty *this, non-empty RHS? + if ( !m_pString ) + return -1; + + // Neither empty + return StringFuncs::Compare( m_pString, rhs ); +} + +typedef CUtlConstStringBase CUtlConstString; +typedef CUtlConstStringBase CUtlConstWideString; #endif // UTLSTRING_H diff --git a/public/tier1/utlvector.h b/public/tier1/utlvector.h index 3dd9186e9..f555ae267 100644 --- a/public/tier1/utlvector.h +++ b/public/tier1/utlvector.h @@ -25,8 +25,10 @@ #include "tier1/strtools.h" #define FOR_EACH_VEC( vecName, iteratorName ) \ - for ( int iteratorName = 0; iteratorName < vecName.Count(); iteratorName++ ) - + for ( int iteratorName = 0; iteratorName < (vecName).Count(); iteratorName++ ) +#define FOR_EACH_VEC_BACK( vecName, iteratorName ) \ + for ( int iteratorName = (vecName).Count()-1; iteratorName >= 0; iteratorName-- ) + //----------------------------------------------------------------------------- // The CUtlVector class: // A growable array class which doubles in size by default. @@ -41,6 +43,8 @@ class CUtlVector typedef A CAllocator; public: typedef T ElemType_t; + typedef T* iterator; + typedef const T* const_iterator; // constructor, destructor CUtlVector( int growSize = 0, int initSize = 0 ); @@ -69,6 +73,11 @@ class CUtlVector int Count() const; int Size() const; // don't use me! + iterator begin() { return Base(); } + const_iterator begin() const { return Base(); } + iterator end() { return Base() + Count(); } + const_iterator end() const { return Base() + Count(); } + // Is element index valid? bool IsValidIndex( int i ) const; static int InvalidIndex(); @@ -119,6 +128,7 @@ class CUtlVector void FastRemove( int elem ); // doesn't preserve order void Remove( int elem ); // preserves order, shifts elements bool FindAndRemove( const T& src ); // removes first occurrence of src, preserves order, shifts elements + bool FindAndFastRemove( const T& src ); void RemoveMultiple( int elem, int num ); // preserves order, shifts elements void RemoveAll(); // doesn't deallocate memory @@ -224,6 +234,273 @@ class CUtlVectorFixedGrowable : public CUtlVector< T, CUtlMemoryFixedGrowable +class CUtlVectorConservative : public CUtlVector< T, CUtlMemoryConservative > +{ + typedef CUtlVector< T, CUtlMemoryConservative > BaseClass; +public: + + // constructor, destructor + CUtlVectorConservative( int growSize = 0, int initSize = 0 ) : BaseClass( growSize, initSize ) {} + CUtlVectorConservative( T* pMemory, int numElements ) : BaseClass( pMemory, numElements ) {} +}; + + +//----------------------------------------------------------------------------- +// The CUtlVectorUltra Conservative class: +// A array class with a very conservative allocation scheme, with customizable allocator +// Especialy useful if you have a lot of vectors that are sparse, or if you're +// carefully packing holders of vectors +//----------------------------------------------------------------------------- +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4200) // warning C4200: nonstandard extension used : zero-sized array in struct/union +#pragma warning(disable : 4815 ) // warning C4815: 'staticData' : zero-sized array in stack object will have no elements +#endif + +class CUtlVectorUltraConservativeAllocator +{ +public: + static void *Alloc( size_t nSize ) + { + return malloc( nSize ); + } + + static void *Realloc( void *pMem, size_t nSize ) + { + return realloc( pMem, nSize ); + } + + static void Free( void *pMem ) + { + free( pMem ); + } + + static size_t GetSize( void *pMem ) + { + return mallocsize( pMem ); + } + +}; + +template +class CUtlVectorUltraConservative : private A +{ +public: + CUtlVectorUltraConservative() + { + m_pData = StaticData(); + } + + ~CUtlVectorUltraConservative() + { + RemoveAll(); + } + + int Count() const + { + return m_pData->m_Size; + } + + static int InvalidIndex() + { + return -1; + } + + inline bool IsValidIndex( int i ) const + { + return (i >= 0) && (i < Count()); + } + + T& operator[]( int i ) + { + Assert( IsValidIndex( i ) ); + return m_pData->m_Elements[i]; + } + + const T& operator[]( int i ) const + { + Assert( IsValidIndex( i ) ); + return m_pData->m_Elements[i]; + } + + T& Element( int i ) + { + Assert( IsValidIndex( i ) ); + return m_pData->m_Elements[i]; + } + + const T& Element( int i ) const + { + Assert( IsValidIndex( i ) ); + return m_pData->m_Elements[i]; + } + + void EnsureCapacity( int num ) + { + int nCurCount = Count(); + if ( num <= nCurCount ) + { + return; + } + if ( m_pData == StaticData() ) + { + m_pData = (Data_t *)A::Alloc( sizeof(int) + ( num * sizeof(T) ) ); + m_pData->m_Size = 0; + } + else + { + int nNeeded = sizeof(int) + ( num * sizeof(T) ); + int nHave = A::GetSize( m_pData ); + if ( nNeeded > nHave ) + { + m_pData = (Data_t *)A::Realloc( m_pData, nNeeded ); + } + } + } + + int AddToTail( const T& src ) + { + int iNew = Count(); + EnsureCapacity( Count() + 1 ); + m_pData->m_Elements[iNew] = src; + m_pData->m_Size++; + return iNew; + } + + void RemoveAll() + { + if ( Count() ) + { + for (int i = m_pData->m_Size; --i >= 0; ) + { + Destruct(&m_pData->m_Elements[i]); + } + } + if ( m_pData != StaticData() ) + { + A::Free( m_pData ); + m_pData = StaticData(); + + } + } + + void PurgeAndDeleteElements() + { + if ( m_pData != StaticData() ) + { + for( int i=0; i < m_pData->m_Size; i++ ) + { + delete Element(i); + } + RemoveAll(); + } + } + + void FastRemove( int elem ) + { + Assert( IsValidIndex(elem) ); + + Destruct( &Element(elem) ); + if (Count() > 0) + { + if ( elem != m_pData->m_Size -1 ) + memcpy( &Element(elem), &Element(m_pData->m_Size-1), sizeof(T) ); + --m_pData->m_Size; + } + if ( !m_pData->m_Size ) + { + A::Free( m_pData ); + m_pData = StaticData(); + } + } + + void Remove( int elem ) + { + Destruct( &Element(elem) ); + ShiftElementsLeft(elem); + --m_pData->m_Size; + if ( !m_pData->m_Size ) + { + A::Free( m_pData ); + m_pData = StaticData(); + } + } + + int Find( const T& src ) const + { + int nCount = Count(); + for ( int i = 0; i < nCount; ++i ) + { + if (Element(i) == src) + return i; + } + return -1; + } + + bool FindAndRemove( const T& src ) + { + int elem = Find( src ); + if ( elem != -1 ) + { + Remove( elem ); + return true; + } + return false; + } + + + bool FindAndFastRemove( const T& src ) + { + int elem = Find( src ); + if ( elem != -1 ) + { + FastRemove( elem ); + return true; + } + return false; + } + + struct Data_t + { + int m_Size; + T m_Elements[]; + }; + + Data_t *m_pData; +private: + void ShiftElementsLeft( int elem, int num = 1 ) + { + int Size = Count(); + Assert( IsValidIndex(elem) || ( Size == 0 ) || ( num == 0 )); + int numToMove = Size - elem - num; + if ((numToMove > 0) && (num > 0)) + { + Q_memmove( &Element(elem), &Element(elem+num), numToMove * sizeof(T) ); + +#ifdef _DEBUG + Q_memset( &Element(Size-num), 0xDD, num * sizeof(T) ); +#endif + } + } + + + + static Data_t *StaticData() + { + static Data_t staticData; + Assert( staticData.m_Size == 0 ); + return &staticData; + } +}; + +#ifdef _MSC_VER +#pragma warning(pop) +#endif //----------------------------------------------------------------------------- // The CCopyableUtlVector class: @@ -714,6 +991,18 @@ bool CUtlVector::FindAndRemove( const T& src ) return false; } +template< typename T, class A > +bool CUtlVector::FindAndFastRemove( const T& src ) +{ + int elem = Find( src ); + if ( elem != -1 ) + { + FastRemove( elem ); + return true; + } + return false; +} + template< typename T, class A > void CUtlVector::RemoveMultiple( int elem, int num ) { @@ -790,5 +1079,75 @@ void CUtlVector::Validate( CValidator &validator, char *pchName ) } #endif // DBGFLAG_VALIDATE +template class CUtlVectorAutoPurge : public CUtlVector< T, CUtlMemory< T, int> > +{ +public: + ~CUtlVectorAutoPurge( void ) + { + this->PurgeAndDeleteElements(); + } + +}; + +// easy string list class with dynamically allocated strings. For use with V_SplitString, etc. +// Frees the dynamic strings in destructor. +class CUtlStringList : public CUtlVectorAutoPurge< char *> +{ +public: + void CopyAndAddToTail( char const *pString ) // clone the string and add to the end + { + char *pNewStr = new char[1 + strlen( pString )]; + V_strcpy( pNewStr, pString ); + AddToTail( pNewStr ); + } + + static int __cdecl SortFunc( char * const * sz1, char * const * sz2 ) + { + return strcmp( *sz1, *sz2 ); + } + + CUtlStringList(){} + + CUtlStringList( char const *pString, char const *pSeparator ) + { + SplitString( pString, pSeparator ); + } + + CUtlStringList( char const *pString, const char **pSeparators, int nSeparators ) + { + SplitString2( pString, pSeparators, nSeparators ); + } + + void SplitString( char const *pString, char const *pSeparator ) + { + V_SplitString( pString, pSeparator, *this ); + } + + void SplitString2( char const *pString, const char **pSeparators, int nSeparators ) + { + V_SplitString2( pString, pSeparators, nSeparators, *this ); + } +private: + CUtlStringList( const CUtlStringList &other ); // copying directly will cause double-release of the same strings; maybe we need to do a deep copy, but unless and until such need arises, this will guard against double-release +}; + + + +// placing it here a few days before Cert to minimize disruption to the rest of codebase +class CSplitString: public CUtlVector > +{ +public: + CSplitString(const char *pString, const char *pSeparator); + CSplitString(const char *pString, const char **pSeparators, int nSeparators); + ~CSplitString(); + // + // NOTE: If you want to make Construct() public and implement Purge() here, you'll have to free m_szBuffer there + // +private: + void Construct(const char *pString, const char **pSeparators, int nSeparators); + void PurgeAndDeleteElements(); +private: + char *m_szBuffer; // a copy of original string, with '\0' instead of separators +}; #endif // CCVECTOR_H diff --git a/public/vcollide.h b/public/vcollide.h index 13af7e46f..3eace8dbc 100644 --- a/public/vcollide.h +++ b/public/vcollide.h @@ -21,6 +21,7 @@ struct vcollide_t // VPhysicsSolids CPhysCollide **solids; char *pKeyValues; + void *pUserData; }; #endif // VCOLLIDE_H diff --git a/public/vcollide_parse.h b/public/vcollide_parse.h index 50bd49094..dcd57658c 100644 --- a/public/vcollide_parse.h +++ b/public/vcollide_parse.h @@ -15,11 +15,12 @@ struct solid_t { - int index; char name[512]; char parent[512]; char surfaceprop[512]; Vector massCenterOverride; + int index; + int contents; objectparams_t params; }; @@ -37,6 +38,26 @@ struct fluid_t } }; +struct ragdollcollisionrules_t +{ + void Defaults( IPhysics *pPhysics, IPhysicsCollisionSet *pSetIn ) + { + pCollisionSet = pSetIn; + bSelfCollisions = true; + } + int bSelfCollisions; + IPhysicsCollisionSet *pCollisionSet; +}; + +struct ragdollanimatedfriction_t +{ + float minFriction; + float maxFriction; + float timeIn; + float timeOut; + float timeHold; +}; + //----------------------------------------------------------------------------- // Purpose: Pass this into the parser to handle the keys that vphysics does not // parse. @@ -63,6 +84,8 @@ class IVPhysicsKeyParser virtual void ParseCustom( void *pCustom, IVPhysicsKeyHandler *unknownKeyHandler ) = 0; virtual void ParseVehicle( vehicleparams_t *pVehicle, IVPhysicsKeyHandler *unknownKeyHandler ) = 0; virtual void SkipBlock( void ) = 0; + virtual void ParseCollisionRules( ragdollcollisionrules_t *pRules, IVPhysicsKeyHandler *unknownKeyHandler ) = 0; + virtual void ParseRagdollAnimatedFriction( ragdollanimatedfriction_t *pFriction, IVPhysicsKeyHandler *unknownKeyHandler ) = 0; }; #endif // VCOLLIDE_PARSE_H diff --git a/public/vphysics/constraints.h b/public/vphysics/constraints.h index 36677e49e..d101d7ff4 100644 --- a/public/vphysics/constraints.h +++ b/public/vphysics/constraints.h @@ -287,6 +287,14 @@ struct constraint_lengthparams_t minLength = rigid ? totalLength : 0; } + void Init( IPhysicsObject *pRef, IPhysicsObject *pAttached, float flLength, bool rigid = false ) + { + objectPosition[0] = vec3_origin; + objectPosition[1] = vec3_origin; + totalLength = flLength; + minLength = rigid ? totalLength : 0; + } + inline void Defaults() { constraint.Defaults(); diff --git a/public/vphysics_interface.h b/public/vphysics_interface.h index 544312427..a4e2b1032 100644 --- a/public/vphysics_interface.h +++ b/public/vphysics_interface.h @@ -1,9 +1,9 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: Public interfaces to vphysics DLL // // $NoKeywords: $ -//=============================================================================// +//===========================================================================// #ifndef VPHYSICS_INTERFACE_H #define VPHYSICS_INTERFACE_H @@ -17,7 +17,7 @@ #include "mathlib/vector.h" #include "mathlib/vector4d.h" #include "vcollide.h" - +#include "tier3/tier3.h" // ------------------------------------------------------------------------------------ // UNITS: @@ -696,6 +696,12 @@ enum callbackflags CALLBACK_MARKED_FOR_TEST = 0x8000, // debug -- marked object is being debugged }; +enum collisionhints +{ + COLLISION_HINT_DEBRIS = 0x0001, + COLLISION_HINT_STATICSOLID = 0x0002, +}; + abstract_class IPhysicsObject { public: @@ -777,7 +783,7 @@ abstract_class IPhysicsObject // Get the radius if this is a sphere object (zero if this is a polygonal mesh) virtual float GetSphereRadius() const = 0; // Set the radius on a sphere. May need to force recalculation of contact points - virtual void SetSphereRadius( float radius ) = 0; + virtual void SetSphereRadius(float radius) = 0; virtual float GetEnergy() const = 0; virtual Vector GetMassCenterLocalSpace() const = 0; diff --git a/public/vstdlib/coroutine.h b/public/vstdlib/coroutine.h new file mode 100644 index 000000000..797324df9 --- /dev/null +++ b/public/vstdlib/coroutine.h @@ -0,0 +1,69 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: setjmp/longjmp based cooperative multitasking system +// +//============================================================================= + +#ifndef COROUTINE_H +#define COROUTINE_H +#pragma once + +#include "vstdlib/vstdlib.h" + +// enable this to do coroutine tracing +// this will tell coroutine API users to set coroutine names +// #define COROUTINE_TRACE + +//----------------------------------------------------------------------------- +// Purpose: handles running coroutines +// setjmp/longjmp based cooperative multitasking system +//----------------------------------------------------------------------------- + +// coroutine callback +typedef void (__cdecl *CoroutineFunc_t )(void *); + +// handle to a coroutine +typedef int32 HCoroutine; + +// creates a new coroutine +// no coroutine code is executed until Coroutine_Continue() is called +VSTDLIB_INTERFACE HCoroutine Coroutine_Create( CoroutineFunc_t pFunc, void *pvParam ); + +// continues the specified coroutine +// returns true if the coroutine is still running, false otherwise +VSTDLIB_INTERFACE bool Coroutine_Continue( HCoroutine hCoroutine, const char *pchName = NULL ); + +// cancels a currently running coroutine +VSTDLIB_INTERFACE void Coroutine_Cancel( HCoroutine hCoroutine ); + +// 'load' a coroutine only to debug it - immediately breaks into debugger +// when continued, pops back to the prior coroutine +VSTDLIB_INTERFACE void Coroutine_DebugBreak( HCoroutine hCoroutine ); + +// Load a coroutine and generate an assert. Used to get a minidump of a job +VSTDLIB_INTERFACE void Coroutine_DebugAssert( HCoroutine hCoroutine, const char *pchMsg ); + +// called from the coroutine to return control to the main thread +VSTDLIB_INTERFACE void Coroutine_YieldToMain(); + +// returns true if the code is currently running inside of a coroutine +VSTDLIB_INTERFACE bool Coroutine_IsActive(); + +// returns a handle the currently active coroutine +VSTDLIB_INTERFACE HCoroutine Coroutine_GetCurrentlyActive(); + +// call when a thread is quiting to release any per-thread memory +VSTDLIB_INTERFACE void Coroutine_ReleaseThreadMemory(); + +// runs a self-test of the coroutine system +VSTDLIB_INTERFACE bool Coroutine_Test(); + +// memory validation +VSTDLIB_INTERFACE void Coroutine_ValidateGlobals( class CValidator &validator ); + +// for debugging purposes - returns stack depth of current coroutine +VSTDLIB_INTERFACE size_t Coroutine_GetStackDepth(); + + + +#endif // COROUTINE_H diff --git a/public/vstdlib/osversion.h b/public/vstdlib/osversion.h new file mode 100644 index 000000000..ecc68ae53 --- /dev/null +++ b/public/vstdlib/osversion.h @@ -0,0 +1,60 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef OSVERSION_H +#define OSVERSION_H +#pragma once + +#include "vstdlib/vstdlib.h" + +// OS types we know about +// Must be in ascending capability order, we use this for min OS requirements +enum EOSType +{ + k_eOSUnknown = -1, + k_eMacOSUnknown = -102, + k_eMacOS104 = -101, + k_eMacOS105 = -100, + k_eMacOS1058 = -99, + k_eMacOS106 = -95, + k_eMacOS1063 = -94, + k_eMacOS107 = -90, + // k_eMacOSMax = -1 + k_eLinuxUnknown = -203, + k_eLinux22 = -202, + k_eLinux24 = -201, + k_eLinux26 = -200, + // k_eLinuxMax = -103 + k_eWinUnknown = 0, + k_eWin311 = 1, + k_eWin95, + k_eWin98, + k_eWinME, + k_eWinNT, + k_eWin2000, + k_eWinXP, + k_eWin2003, + k_eWinVista, + k_eWindows7, + k_eWin2008, + k_eWinMAX, + k_eOSTypeMax = k_eWinMAX + 11 // win types + other ifdef'd types +}; + +VSTDLIB_INTERFACE const char *GetNameFromOSType( EOSType eOSType ); +VSTDLIB_INTERFACE const char *GetOSDetailString( char *pchOutBuf, int cchOutBuf ); +VSTDLIB_INTERFACE EOSType GetOSType(); +VSTDLIB_INTERFACE bool OSTypesAreCompatible( EOSType eOSTypeDetected, EOSType eOSTypeRequired ); +VSTDLIB_INTERFACE const char *GetPlatformName( bool *pbIs64Bit ); + +#endif // OSVERSION_H diff --git a/tier1/checksum_sha1.cpp b/tier1/checksum_sha1.cpp new file mode 100644 index 000000000..ee6e27c29 --- /dev/null +++ b/tier1/checksum_sha1.cpp @@ -0,0 +1,299 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Implementation of SHA-1 +// +//============================================================================= + +/* + 100% free public domain implementation of the SHA-1 + algorithm by Dominik Reichl + + + === Test Vectors (from FIPS PUB 180-1) === + + SHA1("abc") = + A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D + + SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") = + 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 + + SHA1(A million repetitions of "a") = + 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +#if !defined(_MINIMUM_BUILD_) +#include "checksum_sha1.h" +#else +// +// This path is build in the CEG/DRM projects where we require that no CRT references are made ! +// +#include // memcpy, memset etc... will be inlined. +#include "tier1/checksum_sha1.h" +#endif + +#define MAX_FILE_READ_BUFFER 8000 + +// Rotate x bits to the left +#ifndef ROL32 +#define ROL32(_val32, _nBits) (((_val32)<<(_nBits))|((_val32)>>(32-(_nBits)))) +#endif + +#ifdef SHA1_LITTLE_ENDIAN + #define SHABLK0(i) (m_block->l[i] = \ + (ROL32(m_block->l[i],24) & 0xFF00FF00) | (ROL32(m_block->l[i],8) & 0x00FF00FF)) +#else + #define SHABLK0(i) (m_block->l[i]) +#endif + +#define SHABLK(i) (m_block->l[i&15] = ROL32(m_block->l[(i+13)&15] ^ m_block->l[(i+8)&15] \ + ^ m_block->l[(i+2)&15] ^ m_block->l[i&15],1)) + +// SHA-1 rounds +#define _R0(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); } +#define _R1(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); } +#define _R2(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5); w=ROL32(w,30); } +#define _R3(v,w,x,y,z,i) { z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5); w=ROL32(w,30); } +#define _R4(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5); w=ROL32(w,30); } + +#ifdef _MINIMUM_BUILD_ +Minimum_CSHA1::Minimum_CSHA1() +#else +CSHA1::CSHA1() +#endif +{ + m_block = (SHA1_WORKSPACE_BLOCK *)m_workspace; + + Reset(); +} +#ifdef _MINIMUM_BUILD_ +Minimum_CSHA1::~Minimum_CSHA1() +#else +CSHA1::~CSHA1() +#endif +{ + // Reset(); +} +#ifdef _MINIMUM_BUILD_ +void Minimum_CSHA1::Reset() +#else +void CSHA1::Reset() +#endif +{ + // SHA1 initialization constants + m_state[0] = 0x67452301; + m_state[1] = 0xEFCDAB89; + m_state[2] = 0x98BADCFE; + m_state[3] = 0x10325476; + m_state[4] = 0xC3D2E1F0; + + m_count[0] = 0; + m_count[1] = 0; +} + +#ifdef _MINIMUM_BUILD_ +void Minimum_CSHA1::Transform(unsigned long state[5], unsigned char buffer[64]) +#else +void CSHA1::Transform(unsigned long state[5], unsigned char buffer[64]) +#endif +{ + unsigned long a = 0, b = 0, c = 0, d = 0, e = 0; + + memcpy(m_block, buffer, 64); + + // Copy state[] to working vars + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + // 4 rounds of 20 operations each. Loop unrolled. + _R0(a,b,c,d,e, 0); _R0(e,a,b,c,d, 1); _R0(d,e,a,b,c, 2); _R0(c,d,e,a,b, 3); + _R0(b,c,d,e,a, 4); _R0(a,b,c,d,e, 5); _R0(e,a,b,c,d, 6); _R0(d,e,a,b,c, 7); + _R0(c,d,e,a,b, 8); _R0(b,c,d,e,a, 9); _R0(a,b,c,d,e,10); _R0(e,a,b,c,d,11); + _R0(d,e,a,b,c,12); _R0(c,d,e,a,b,13); _R0(b,c,d,e,a,14); _R0(a,b,c,d,e,15); + _R1(e,a,b,c,d,16); _R1(d,e,a,b,c,17); _R1(c,d,e,a,b,18); _R1(b,c,d,e,a,19); + _R2(a,b,c,d,e,20); _R2(e,a,b,c,d,21); _R2(d,e,a,b,c,22); _R2(c,d,e,a,b,23); + _R2(b,c,d,e,a,24); _R2(a,b,c,d,e,25); _R2(e,a,b,c,d,26); _R2(d,e,a,b,c,27); + _R2(c,d,e,a,b,28); _R2(b,c,d,e,a,29); _R2(a,b,c,d,e,30); _R2(e,a,b,c,d,31); + _R2(d,e,a,b,c,32); _R2(c,d,e,a,b,33); _R2(b,c,d,e,a,34); _R2(a,b,c,d,e,35); + _R2(e,a,b,c,d,36); _R2(d,e,a,b,c,37); _R2(c,d,e,a,b,38); _R2(b,c,d,e,a,39); + _R3(a,b,c,d,e,40); _R3(e,a,b,c,d,41); _R3(d,e,a,b,c,42); _R3(c,d,e,a,b,43); + _R3(b,c,d,e,a,44); _R3(a,b,c,d,e,45); _R3(e,a,b,c,d,46); _R3(d,e,a,b,c,47); + _R3(c,d,e,a,b,48); _R3(b,c,d,e,a,49); _R3(a,b,c,d,e,50); _R3(e,a,b,c,d,51); + _R3(d,e,a,b,c,52); _R3(c,d,e,a,b,53); _R3(b,c,d,e,a,54); _R3(a,b,c,d,e,55); + _R3(e,a,b,c,d,56); _R3(d,e,a,b,c,57); _R3(c,d,e,a,b,58); _R3(b,c,d,e,a,59); + _R4(a,b,c,d,e,60); _R4(e,a,b,c,d,61); _R4(d,e,a,b,c,62); _R4(c,d,e,a,b,63); + _R4(b,c,d,e,a,64); _R4(a,b,c,d,e,65); _R4(e,a,b,c,d,66); _R4(d,e,a,b,c,67); + _R4(c,d,e,a,b,68); _R4(b,c,d,e,a,69); _R4(a,b,c,d,e,70); _R4(e,a,b,c,d,71); + _R4(d,e,a,b,c,72); _R4(c,d,e,a,b,73); _R4(b,c,d,e,a,74); _R4(a,b,c,d,e,75); + _R4(e,a,b,c,d,76); _R4(d,e,a,b,c,77); _R4(c,d,e,a,b,78); _R4(b,c,d,e,a,79); + + // Add the working vars back into state[] + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + + // Wipe variables + a = b = c = d = e = 0; +} + +// Use this function to hash in binary data and strings +#ifdef _MINIMUM_BUILD_ +void Minimum_CSHA1::Update(unsigned char *data, unsigned int len) +#else +void CSHA1::Update(unsigned char *data, unsigned int len) +#endif +{ + unsigned long i = 0, j; + + j = (m_count[0] >> 3) & 63; + + if((m_count[0] += len << 3) < (len << 3)) m_count[1]++; + + m_count[1] += (len >> 29); + + if((j + len) > 63) + { + memcpy(&m_buffer[j], data, (i = 64 - j)); + Transform(m_state, m_buffer); + + for (; i+63 < len; i += 64) + Transform(m_state, &data[i]); + + j = 0; + } + else i = 0; + + memcpy(&m_buffer[j], &data[i], len - i); +} + +#if !defined(_MINIMUM_BUILD_) +// Hash in file contents +bool CSHA1::HashFile(char *szFileName) +{ + unsigned long ulFileSize = 0, ulRest = 0, ulBlocks = 0; + unsigned long i = 0; + unsigned char uData[MAX_FILE_READ_BUFFER]; + FILE *fIn = NULL; + + if(szFileName == NULL) return(false); + + if((fIn = fopen(szFileName, "rb")) == NULL) return(false); + + fseek(fIn, 0, SEEK_END); + ulFileSize = ftell(fIn); + fseek(fIn, 0, SEEK_SET); + + ulRest = ulFileSize % MAX_FILE_READ_BUFFER; + ulBlocks = ulFileSize / MAX_FILE_READ_BUFFER; + + for(i = 0; i < ulBlocks; i++) + { + fread(uData, 1, MAX_FILE_READ_BUFFER, fIn); + Update(uData, MAX_FILE_READ_BUFFER); + } + + if(ulRest != 0) + { + fread(uData, 1, ulRest, fIn); + Update(uData, ulRest); + } + + fclose(fIn); + fIn = NULL; + + return(true); +} +#endif + +#ifdef _MINIMUM_BUILD_ +void Minimum_CSHA1::Final() +#else +void CSHA1::Final() +#endif +{ + unsigned long i = 0; + unsigned char finalcount[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + for (i = 0; i < 8; i++) + finalcount[i] = (unsigned char)((m_count[(i >= 4 ? 0 : 1)] + >> ((3 - (i & 3)) * 8) ) & 255); // Endian independent + + Update((unsigned char *)"\200", 1); + + while ((m_count[0] & 504) != 448) + Update((unsigned char *)"\0", 1); + + Update(finalcount, 8); // Cause a SHA1Transform() + + for (i = 0; i < k_cubHash; i++) + { + m_digest[i] = (unsigned char)((m_state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255); + } + + // Wipe variables for security reasons + i = 0; + memset(m_buffer, 0, sizeof(m_buffer) ); + memset(m_state, 0, sizeof(m_state) ); + memset(m_count, 0, sizeof(m_count) ); + memset(finalcount, 0, sizeof( finalcount) ); + + Transform(m_state, m_buffer); +} + +#if !defined(_MINIMUM_BUILD_) +// Get the final hash as a pre-formatted string +void CSHA1::ReportHash(char *szReport, unsigned char uReportType) +{ + unsigned char i = 0; + char szTemp[12]; + + if(szReport == NULL) return; + + if(uReportType == REPORT_HEX) + { + sprintf(szTemp, "%02X", m_digest[0]); + strcat(szReport, szTemp); + + for(i = 1; i < k_cubHash; i++) + { + sprintf(szTemp, " %02X", m_digest[i]); + strcat(szReport, szTemp); + } + } + else if(uReportType == REPORT_DIGIT) + { + sprintf(szTemp, "%u", m_digest[0]); + strcat(szReport, szTemp); + + for(i = 1; i < k_cubHash; i++) + { + sprintf(szTemp, " %u", m_digest[i]); + strcat(szReport, szTemp); + } + } + else strcpy(szReport, "Error: Unknown report type!"); +} +#endif // _MINIMUM_BUILD_ + +// Get the raw message digest +#ifdef _MINIMUM_BUILD_ +void Minimum_CSHA1::GetHash(unsigned char *uDest) +#else +void CSHA1::GetHash(unsigned char *uDest) +#endif +{ + memcpy(uDest, m_digest, k_cubHash); +} + +#ifndef _MINIMUM_BUILD_ +// utility hash comparison function +bool HashLessFunc( SHADigest_t const &lhs, SHADigest_t const &rhs ) +{ + int iRes = memcmp( &lhs, &rhs, sizeof( SHADigest_t ) ); + return ( iRes < 0 ); +} +#endif diff --git a/tier1/reliabletimer.cpp b/tier1/reliabletimer.cpp new file mode 100644 index 000000000..af8b8421a --- /dev/null +++ b/tier1/reliabletimer.cpp @@ -0,0 +1,93 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#include "tier1/reliabletimer.h" + +int64 CReliableTimer::sm_nPerformanceFrequency = 0; +bool CReliableTimer::sm_bUseQPC = false; + +#ifdef _WIN32 +#include "winlite.h" +#endif + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +CReliableTimer::CReliableTimer() +{ + m_nPerformanceCounterStart = 0; + m_nPerformanceCounterEnd = 0; + m_nPerformanceCounterLimit = 0; + +#ifdef _WIN32 + // calculate performance frequency the first time we use a timer + if ( 0 == sm_nPerformanceFrequency ) + { + // Are we on a bad CPU? + sm_bUseQPC = false; // todo + const CPUInformation &cpu = *GetCPUInformation(); + sm_bUseQPC = ( ( 0 == Q_stricmp( cpu.m_szProcessorID, "AuthenticAMD" ) ) + && ( cpu.m_nPhysicalProcessors > 1 ) + && !cpu.m_bSSE41 ); + + if ( sm_bUseQPC ) + { + LARGE_INTEGER li; + QueryPerformanceFrequency( &li ); + sm_nPerformanceFrequency = li.QuadPart; + } + else + { + sm_nPerformanceFrequency = g_ClockSpeed; + } + } +#elif defined(_PS3) + // On PowerPC, the time base register increment frequency is implementation dependent, and doesn't have to be constant. + // On PS3, measured it to be just shy of 80Mhz on the PPU and doesn't seem to change + if ( sm_nPerformanceFrequency == 0 ) + sm_nPerformanceFrequency = sys_time_get_timebase_frequency(); +#else + // calculate performance frequency the first time we use a timer + if ( 0 == sm_nPerformanceFrequency ) + { + sm_nPerformanceFrequency = g_ClockSpeed; + } +#endif +} + + +//----------------------------------------------------------------------------- +// Purpose: Returns current QueryPerformanceCounter value +//----------------------------------------------------------------------------- +int64 CReliableTimer::GetPerformanceCountNow() +{ + //VPROF_BUDGET( "CReliableTimer::GetPerformanceCountNow", VPROF_BUDGETGROUP_OTHER_UNACCOUNTED ); +#ifdef _WIN32 + if ( sm_bUseQPC ) + { + LARGE_INTEGER li = {0}; + QueryPerformanceCounter( &li ); + return li.QuadPart; + } + else + { + CCycleCount CycleCount; + CycleCount.Sample(); + return CycleCount.GetLongCycles(); + } +#elif defined( _PS3 ) + // use handy macro to grab tb + uint64 ulNow; + SYS_TIMEBASE_GET( ulNow ); + return ulNow; +#else + uint64 un64; + __asm__ __volatile__ ( + "rdtsc\n\t" + : "=A" (un64) ); + return (int64)un64; +#endif +}