General:
* Upgraded Steamworks SDK to v1.29 * Fixed mod compatibility problem with Multiplayer Base that was introduced in September. * In Hammer, while using the Vertex Tool, pressing CTRL+B will snap selected vertices to the grid. Virtual Reality: * Mods that support virtual reality now need to have a line in gameinfo.txt that says “supportsvr 1”. This indicates to gameui and engine that certain UI should be enabled. * VR-enabled mods will now start up in VR mode when launched from Steam’s VR mode. Windows: * Upgraded to Visual Studio 2013. If you need to build projects for VS 2010, add /2010 to your VPC command line. OSX: * Upgraded to XCode 5.
This commit is contained in:
@@ -106,9 +106,8 @@ public:
|
||||
// Gets a material bound to a surface texture ID
|
||||
virtual IMaterial *DrawGetTextureMaterial( int id ) = 0;
|
||||
|
||||
// The matching method is in ISurface, but we can't add anything there and remain mod-compatible.
|
||||
// So this goes here instead.
|
||||
virtual void GetFullscreenViewportAndRenderTarget( int & x, int & y, int & w, int & h, ITexture **ppRenderTarget ) = 0;
|
||||
virtual void SetFullscreenViewportAndRenderTarget( int x, int y, int w, int h, ITexture *pRenderTarget ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4075,7 +4075,8 @@ ZRESULT TUnzip::Find(const TCHAR *name, bool ic, int *index, ZIPENTRY *ze)
|
||||
return ZR_NOTFOUND;
|
||||
}
|
||||
if (currentfile!=-1)
|
||||
unzCloseCurrentFile(uf); currentfile=-1;
|
||||
unzCloseCurrentFile(uf);
|
||||
currentfile=-1;
|
||||
int i = (int)uf->num_file;
|
||||
if (index!=NULL)
|
||||
*index=i;
|
||||
|
||||
@@ -2705,7 +2705,8 @@ ZRESULT TZip::Add(const char *odstzn, void *src,unsigned int len, DWORD flags)
|
||||
while (*d != 0)
|
||||
{
|
||||
if (*d == '\\')
|
||||
*d = '/'; d++;
|
||||
*d = '/';
|
||||
d++;
|
||||
}
|
||||
bool isdir = (flags==ZIP_FOLDER);
|
||||
bool needs_trailing_slash = (isdir && dstzn[strlen(dstzn)-1]!='/');
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
// BUGBUG: Reconcile with or derive this from the engine's internal definition!
|
||||
// FIXME: I added an extra bit because I needed to make it signed
|
||||
#define SP_MODEL_INDEX_BITS 12
|
||||
#define SP_MODEL_INDEX_BITS 13
|
||||
|
||||
// How many bits to use to encode an edict.
|
||||
#define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts
|
||||
|
||||
@@ -130,6 +130,7 @@ private:
|
||||
virtual void OnPaint3D();
|
||||
virtual void PrePaint3D( IMatRenderContext *pRenderContext ) { };
|
||||
virtual void PostPaint3D( IMatRenderContext *pRenderContext ) { };
|
||||
virtual void RenderingRootModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { };
|
||||
virtual void RenderingMergedModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { };
|
||||
|
||||
void OnMouseDoublePressed( vgui::MouseCode code );
|
||||
|
||||
@@ -455,7 +455,7 @@ public:
|
||||
SetX( ix );
|
||||
SetY( iy );
|
||||
SetZ( iz );
|
||||
SetZ( iw );
|
||||
SetW( iw );
|
||||
}
|
||||
|
||||
const Type& operator=( const Type &val )
|
||||
|
||||
@@ -150,7 +150,9 @@ public:
|
||||
// ----------------------------------------------------------------------
|
||||
virtual bool Activate() = 0;
|
||||
virtual void Deactivate() = 0;
|
||||
|
||||
|
||||
virtual bool ShouldForceVRMode() = 0;
|
||||
virtual void SetShouldForceVRMode() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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 "steam/isteamclient.h"
|
||||
#include "steam/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
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to app data in Steam
|
||||
//
|
||||
@@ -59,10 +59,19 @@ public:
|
||||
|
||||
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( DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order
|
||||
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/<appid>//?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;
|
||||
|
||||
#ifdef _PS3
|
||||
// Result returned in a RegisterActivationCodeResponse_t callresult
|
||||
@@ -70,7 +79,7 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION005"
|
||||
#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION006"
|
||||
|
||||
// callbacks
|
||||
#if defined( VALVE_CALLBACK_PACK_SMALL )
|
||||
@@ -123,5 +132,18 @@ struct AppProofOfPurchaseKeyResponse_t
|
||||
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/<appid>//?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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: Main interface for loading and accessing Steamworks API's from the
|
||||
// Steam client.
|
||||
@@ -17,6 +17,10 @@
|
||||
// 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.
|
||||
@@ -83,10 +87,14 @@ class ISteamApps;
|
||||
class ISteamNetworking;
|
||||
class ISteamRemoteStorage;
|
||||
class ISteamScreenshots;
|
||||
class ISteamMusic;
|
||||
class ISteamGameServerStats;
|
||||
class ISteamPS3OverlayRender;
|
||||
class ISteamHTTP;
|
||||
class ISteamUnifiedMessages;
|
||||
class ISteamController;
|
||||
class ISteamUGC;
|
||||
class ISteamAppList;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Interface to creating a new steam instance, or to
|
||||
@@ -189,9 +197,20 @@ public:
|
||||
// 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;
|
||||
};
|
||||
|
||||
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient012"
|
||||
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient014"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Base values for callback identifiers, each callback must
|
||||
@@ -228,6 +247,15 @@ 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 };
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -236,21 +264,18 @@ enum { k_iClientNetworkDeviceManagerCallbacks = 3100 };
|
||||
// Do not change any of these.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class CSteamCallback
|
||||
struct SteamCallback_t
|
||||
{
|
||||
public:
|
||||
virtual const char *GetCallbackName() const = 0;
|
||||
virtual uint32 GetCallbackID() const = 0;
|
||||
virtual uint8 *GetFixedData() const = 0;
|
||||
virtual uint32 GetFixedSize() const = 0;
|
||||
virtual uint32 GetNumMemberVariables() const = 0;
|
||||
virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const = 0;
|
||||
SteamCallback_t() {}
|
||||
};
|
||||
|
||||
#define DEFINE_CALLBACK( callbackname, callbackid ) \
|
||||
struct callbackname##_t { \
|
||||
struct callbackname : SteamCallback_t { \
|
||||
enum { k_iCallback = callbackid }; \
|
||||
static callbackname##_t *GetNullPointer() { return 0; }
|
||||
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 ; \
|
||||
@@ -269,64 +294,60 @@ struct callbackname##_t { \
|
||||
*pszName = #varname; *pszType = #vartype; }
|
||||
|
||||
|
||||
#define END_CALLBACK_INTERNAL_BEGIN( callbackname, numvars ) }; \
|
||||
class C##callbackname : public CSteamCallback { \
|
||||
public: callbackname##_t m_Data; \
|
||||
C##callbackname () { memset( &m_Data, 0, sizeof(m_Data) ); } \
|
||||
virtual const char *GetCallbackName() const { return #callbackname; } \
|
||||
virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \
|
||||
virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \
|
||||
virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \
|
||||
virtual uint32 GetNumMemberVariables() const { return numvars; } \
|
||||
virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { \
|
||||
#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 : m_Data.GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true;
|
||||
#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true;
|
||||
|
||||
#define END_CALLBACK_INTERNAL_END() }; }; };
|
||||
#define END_CALLBACK_INTERNAL_END() }; } };
|
||||
|
||||
#define END_DEFINE_CALLBACK_0( callbackname ) }; \
|
||||
class C##callbackname : public CSteamCallback { \
|
||||
public: callbackname##_t m_Data; \
|
||||
virtual const char *GetCallbackName() const { return #callbackname; } \
|
||||
virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \
|
||||
virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \
|
||||
virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \
|
||||
virtual uint32 GetNumMemberVariables() const { return 0; } \
|
||||
virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { return false; } \
|
||||
}; \
|
||||
#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( callbackname ) \
|
||||
END_CALLBACK_INTERNAL_BEGIN( callbackname, 1 ) \
|
||||
#define END_DEFINE_CALLBACK_1() \
|
||||
END_CALLBACK_INTERNAL_BEGIN( 1 ) \
|
||||
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||
END_CALLBACK_INTERNAL_END()
|
||||
|
||||
#define END_DEFINE_CALLBACK_2( callbackname ) \
|
||||
END_CALLBACK_INTERNAL_BEGIN( callbackname, 2 ) \
|
||||
#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( callbackname ) \
|
||||
END_CALLBACK_INTERNAL_BEGIN( callbackname, 3 ) \
|
||||
#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( callbackname ) \
|
||||
END_CALLBACK_INTERNAL_BEGIN( callbackname, 4 ) \
|
||||
#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( callbackname ) \
|
||||
END_CALLBACK_INTERNAL_BEGIN( callbackname, 6 ) \
|
||||
|
||||
#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 ) \
|
||||
@@ -335,8 +356,8 @@ public: callbackname##_t m_Data; \
|
||||
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
|
||||
END_CALLBACK_INTERNAL_END()
|
||||
|
||||
#define END_DEFINE_CALLBACK_7( callbackname ) \
|
||||
END_CALLBACK_INTERNAL_BEGIN( callbackname, 7 ) \
|
||||
#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 ) \
|
||||
@@ -346,4 +367,29 @@ public: callbackname##_t m_Data; \
|
||||
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
|
||||
END_CALLBACK_INTERNAL_END()
|
||||
|
||||
#define END_DEFINE_CALLBACK_8() \
|
||||
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_SWITCH( 7 ) \
|
||||
END_CALLBACK_INTERNAL_END()
|
||||
|
||||
#define END_DEFINE_CALLBACK_9() \
|
||||
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_SWITCH( 7 ) \
|
||||
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
||||
END_CALLBACK_INTERNAL_END()
|
||||
|
||||
#endif // ISTEAMCLIENT_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to valve controller
|
||||
//
|
||||
@@ -11,6 +11,7 @@
|
||||
#endif
|
||||
|
||||
#include "isteamclient.h"
|
||||
#include "steamcontrollerpublic.h"
|
||||
|
||||
// callbacks
|
||||
#if defined( VALVE_CALLBACK_PACK_SMALL )
|
||||
@@ -21,16 +22,44 @@
|
||||
#error isteamclient.h must be included
|
||||
#endif
|
||||
|
||||
#define MAX_STEAM_CONTROLLERS 16
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
enum ESteamControllerPad
|
||||
{
|
||||
k_ESteamControllerPad_Left,
|
||||
k_ESteamControllerPad_Right
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Functions for accessing stats, achievements, and leaderboard information
|
||||
// Purpose: Native Steam controller support API
|
||||
//-----------------------------------------------------------------------------
|
||||
class ISteamController
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
//
|
||||
// Native controller support API
|
||||
//
|
||||
|
||||
// Must call init and shutdown when starting/ending use of the interface
|
||||
virtual bool Init( const char *pchAbsolutePathToControllerConfigVDF ) = 0;
|
||||
virtual bool Shutdown() = 0;
|
||||
|
||||
// Pump callback/callresult events, SteamAPI_RunCallbacks will do this for you,
|
||||
// normally never need to call directly.
|
||||
virtual void RunFrame() = 0;
|
||||
|
||||
// Get the state of the specified controller, returns false if that controller is not connected
|
||||
virtual bool GetControllerState( uint32 unControllerIndex, SteamControllerState_t *pState ) = 0;
|
||||
|
||||
// Trigger a haptic pulse on the controller
|
||||
virtual void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0;
|
||||
|
||||
// Set the override mode which is used to choose to use different base/legacy bindings from your config file
|
||||
virtual void SetOverrideMode( const char *pchMode ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMCONTROLLER_INTERFACE_VERSION "STEAMCONTROLLER_INTERFACE_VERSION"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright (C) 1996-2008, Valve Corporation, All rights reserved. =====
|
||||
//
|
||||
// Purpose: interface to both friends list data and general information about users
|
||||
//
|
||||
@@ -203,6 +203,9 @@ public:
|
||||
// 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 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;
|
||||
|
||||
// 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;
|
||||
@@ -340,7 +343,7 @@ public:
|
||||
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 *, CSteamID * ) = 0;
|
||||
virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, CSteamID *psteamidChatter ) = 0;
|
||||
virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0;
|
||||
|
||||
// interact with the Steam (game overlay / desktop)
|
||||
@@ -360,7 +363,7 @@ public:
|
||||
virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends013"
|
||||
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends014"
|
||||
|
||||
// callbacks
|
||||
#if defined( VALVE_CALLBACK_PACK_SMALL )
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to steam for game servers
|
||||
//
|
||||
@@ -56,10 +56,7 @@ public:
|
||||
/// @see SteamServersConnected_t
|
||||
/// @see SteamServerConnectFailure_t
|
||||
/// @see SteamServersDisconnected_t
|
||||
virtual void LogOn(
|
||||
const char *pszAccountName,
|
||||
const char *pszPassword
|
||||
) = 0;
|
||||
virtual void LogOn( const char *pszToken ) = 0;
|
||||
|
||||
/// Login to a generic, anonymous account.
|
||||
///
|
||||
@@ -121,7 +118,7 @@ public:
|
||||
/// 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;
|
||||
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
|
||||
@@ -129,7 +126,7 @@ public:
|
||||
/// acknowledged)
|
||||
///
|
||||
/// @see k_cbMaxGameServerGameData
|
||||
virtual void SetGameData( const char *pchGameData) = 0;
|
||||
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;
|
||||
@@ -192,15 +189,10 @@ public:
|
||||
// returns false if we're not connected to the steam servers and thus cannot ask
|
||||
virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0;
|
||||
|
||||
//
|
||||
// Query steam for server data
|
||||
//
|
||||
|
||||
// Ask for the gameplay stats for the server. Results returned in a callback
|
||||
// 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;
|
||||
|
||||
// Gets the reputation score for the game server. This API also checks if the server or some
|
||||
// other server on the same IP is banned from the Steam master servers.
|
||||
virtual SteamAPICall_t GetServerReputation( ) = 0;
|
||||
|
||||
// Returns the public IP of the server according to Steam, useful when the server is
|
||||
@@ -255,7 +247,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer011"
|
||||
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012"
|
||||
|
||||
// game server flags
|
||||
const uint32 k_unServerFlagNone = 0x00;
|
||||
@@ -284,7 +276,8 @@ const uint32 k_unServerFlagPrivate = 0x20; // server shouldn't list on master
|
||||
struct GSClientApprove_t
|
||||
{
|
||||
enum { k_iCallback = k_iSteamGameServerCallbacks + 1 };
|
||||
CSteamID m_SteamID;
|
||||
CSteamID m_SteamID; // SteamID of approved player
|
||||
CSteamID m_OwnerSteamID; // SteamID of original owner for game license
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to steam managing game server/client match making
|
||||
//
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
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;
|
||||
virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
|
||||
|
||||
///////
|
||||
// Game lobby functions
|
||||
@@ -563,6 +563,7 @@ struct FavoritesListChanged_t
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@@ -725,6 +726,21 @@ struct PSNGameBootInviteResult_t
|
||||
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 )
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ============
|
||||
|
||||
#ifndef ISTEAMMUSIC_H
|
||||
#define ISTEAMMUSIC_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "steam/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
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: public interface to user remote file storage in Steam
|
||||
//
|
||||
@@ -41,6 +41,7 @@ struct SteamParamStringArray_t
|
||||
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;
|
||||
|
||||
@@ -87,21 +88,23 @@ 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_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,
|
||||
|
||||
// Update k_EWorkshopFileTypeMax if you add values
|
||||
k_EWorkshopFileTypeMax = 12
|
||||
k_EWorkshopFileTypeMax = 14
|
||||
|
||||
};
|
||||
|
||||
@@ -135,6 +138,28 @@ enum EWorkshopVideoProvider
|
||||
k_EWorkshopVideoProviderYoutube = 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
k_WorkshopForceLoadPublishedFileDetailsFromCache = -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
|
||||
@@ -200,7 +225,7 @@ class ISteamRemoteStorage
|
||||
// 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 ) = 0;
|
||||
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;
|
||||
@@ -235,8 +260,8 @@ class ISteamRemoteStorage
|
||||
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 -1 will use cached data if it exists, no matter how old it is.
|
||||
// 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
|
||||
@@ -258,7 +283,7 @@ class ISteamRemoteStorage
|
||||
virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION011"
|
||||
#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION012"
|
||||
|
||||
|
||||
// callbacks
|
||||
@@ -342,6 +367,7 @@ 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
|
||||
};
|
||||
|
||||
|
||||
@@ -480,6 +506,7 @@ struct RemoteStorageGetPublishedFileDetailsResult_t
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
@@ -491,6 +518,8 @@ struct RemoteStorageEnumerateWorkshopFilesResult_t
|
||||
int32 m_nTotalResultCount;
|
||||
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
|
||||
float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ];
|
||||
AppId_t m_nAppId;
|
||||
uint32 m_unStartIndex;
|
||||
};
|
||||
|
||||
|
||||
@@ -603,6 +632,18 @@ struct RemoteStoragePublishFileProgress_t
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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
|
||||
};
|
||||
|
||||
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
//====== 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,
|
||||
};
|
||||
|
||||
// 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,
|
||||
};
|
||||
|
||||
|
||||
const uint32 kNumUGCResultsPerPage = 50;
|
||||
|
||||
// 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
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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 SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
|
||||
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 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;
|
||||
|
||||
// Request full details for one piece of UGC
|
||||
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION002"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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: k_iClientUGCCallbacks + 3 to k_iClientUGCCallbacks + 6 in use
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
#endif // ISTEAMUGC_H
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to user account information in Steam
|
||||
//
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
// 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;
|
||||
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.
|
||||
@@ -158,6 +158,14 @@ public:
|
||||
// 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;
|
||||
|
||||
#ifdef _PS3
|
||||
// Initiates PS3 Logon request using just PSN ticket.
|
||||
//
|
||||
@@ -197,7 +205,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#define STEAMUSER_INTERFACE_VERSION "SteamUser016"
|
||||
#define STEAMUSER_INTERFACE_VERSION "SteamUser017"
|
||||
|
||||
|
||||
// callbacks
|
||||
@@ -287,6 +295,7 @@ struct ValidateAuthTicketResponse_t
|
||||
enum { k_iCallback = k_iSteamUserCallbacks + 43 };
|
||||
CSteamID m_SteamID;
|
||||
EAuthSessionResponse m_eAuthSessionResponse;
|
||||
CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to utility functions in Steam
|
||||
//
|
||||
@@ -149,17 +149,20 @@ public:
|
||||
#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 ) = 0;
|
||||
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;
|
||||
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;
|
||||
};
|
||||
|
||||
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils006"
|
||||
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils007"
|
||||
|
||||
|
||||
// callbacks
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -32,6 +32,11 @@ 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; }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== Copyright 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -20,9 +20,12 @@
|
||||
#include "isteamnetworking.h"
|
||||
#include "isteamremotestorage.h"
|
||||
#include "isteamscreenshots.h"
|
||||
#include "isteammusic.h"
|
||||
#include "isteamhttp.h"
|
||||
#include "isteamunifiedmessages.h"
|
||||
#include "isteamcontroller.h"
|
||||
#include "isteamugc.h"
|
||||
#include "isteamapplist.h"
|
||||
|
||||
#if defined( _PS3 )
|
||||
#include "steamps3params.h"
|
||||
@@ -59,10 +62,10 @@
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
|
||||
// S_API void SteamAPI_Init(); (see below)
|
||||
S_API void SteamAPI_Shutdown();
|
||||
S_API void S_CALLTYPE SteamAPI_Shutdown();
|
||||
|
||||
// checks if a local Steam client is running
|
||||
S_API bool SteamAPI_IsSteamRunning();
|
||||
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.
|
||||
@@ -75,14 +78,14 @@ S_API bool SteamAPI_IsSteamRunning();
|
||||
//
|
||||
// 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 SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID );
|
||||
S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID );
|
||||
|
||||
// crash dump recording functions
|
||||
S_API void SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID );
|
||||
S_API void SteamAPI_SetMiniDumpComment( const char *pchMsg );
|
||||
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 *SteamClient();
|
||||
S_API ISteamClient *S_CALLTYPE SteamClient();
|
||||
|
||||
|
||||
//
|
||||
@@ -96,29 +99,33 @@ S_API ISteamClient *SteamClient();
|
||||
// functions below to get at the Steam interfaces.
|
||||
//
|
||||
#ifdef VERSION_SAFE_STEAM_API_INTERFACES
|
||||
S_API bool SteamAPI_InitSafe();
|
||||
S_API bool S_CALLTYPE SteamAPI_InitSafe();
|
||||
#else
|
||||
|
||||
#if defined(_PS3)
|
||||
S_API bool SteamAPI_Init( SteamPS3Params_t *pParams );
|
||||
S_API bool S_CALLTYPE SteamAPI_Init( SteamPS3Params_t *pParams );
|
||||
#else
|
||||
S_API bool SteamAPI_Init();
|
||||
S_API bool S_CALLTYPE SteamAPI_Init();
|
||||
#endif
|
||||
|
||||
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 ISteamNetworking *SteamNetworking();
|
||||
S_API ISteamMatchmakingServers *SteamMatchmakingServers();
|
||||
S_API ISteamRemoteStorage *SteamRemoteStorage();
|
||||
S_API ISteamScreenshots *SteamScreenshots();
|
||||
S_API ISteamHTTP *SteamHTTP();
|
||||
S_API ISteamUnifiedMessages *SteamUnifiedMessages();
|
||||
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();
|
||||
#ifdef _PS3
|
||||
S_API ISteamPS3OverlayRender * SteamPS3OverlayRender();
|
||||
S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender();
|
||||
#endif
|
||||
#endif // VERSION_SAFE_STEAM_API_INTERFACES
|
||||
|
||||
@@ -132,16 +139,16 @@ S_API ISteamPS3OverlayRender * SteamPS3OverlayRender();
|
||||
// to as many functions/objects as are registered to it
|
||||
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
|
||||
S_API void SteamAPI_RunCallbacks();
|
||||
S_API void S_CALLTYPE 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 );
|
||||
S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback );
|
||||
S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback );
|
||||
// functions used by the utility CCallResult objects to receive async call results
|
||||
S_API void SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
|
||||
S_API void SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
|
||||
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 );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -397,6 +404,10 @@ public:
|
||||
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; }
|
||||
#ifdef _PS3
|
||||
ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; }
|
||||
#endif
|
||||
@@ -415,6 +426,9 @@ private:
|
||||
ISteamHTTP *m_pSteamHTTP;
|
||||
ISteamUnifiedMessages*m_pSteamUnifiedMessages;
|
||||
ISteamController *m_pController;
|
||||
ISteamUGC *m_pSteamUGC;
|
||||
ISteamAppList *m_pSteamAppList;
|
||||
ISteamMusic *m_pSteamMusic;
|
||||
#ifdef _PS3
|
||||
ISteamPS3OverlayRender *m_pSteamPS3OverlayRender;
|
||||
#endif
|
||||
@@ -438,7 +452,11 @@ inline void CSteamAPIContext::Clear()
|
||||
m_pSteamRemoteStorage = NULL;
|
||||
m_pSteamHTTP = NULL;
|
||||
m_pSteamScreenshots = NULL;
|
||||
m_pSteamMusic = NULL;
|
||||
m_pSteamUnifiedMessages = NULL;
|
||||
m_pController = NULL;
|
||||
m_pSteamUGC = NULL;
|
||||
m_pSteamAppList = NULL;
|
||||
#ifdef _PS3
|
||||
m_pSteamPS3OverlayRender = NULL;
|
||||
#endif
|
||||
@@ -501,6 +519,24 @@ inline bool CSteamAPIContext::Init()
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef _PS3
|
||||
m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender();
|
||||
#endif
|
||||
@@ -512,13 +548,13 @@ inline bool CSteamAPIContext::Init()
|
||||
|
||||
#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 )
|
||||
// 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 SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback );
|
||||
S_API void SteamAPI_SetBreakpadAppID( uint32 unAppID );
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -20,7 +20,7 @@
|
||||
// interface layer, no need to include anything about the implementation.
|
||||
|
||||
#include "steamtypes.h"
|
||||
|
||||
#include "steamuniverse.h"
|
||||
|
||||
// General result codes
|
||||
enum EResult
|
||||
@@ -102,7 +102,13 @@ enum EResult
|
||||
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_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
|
||||
};
|
||||
|
||||
// Error codes for use with the voice functions
|
||||
@@ -178,18 +184,6 @@ typedef enum
|
||||
} EUserHasLicenseForAppResult;
|
||||
|
||||
|
||||
// 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
|
||||
};
|
||||
|
||||
// Steam account types
|
||||
enum EAccountType
|
||||
{
|
||||
@@ -227,15 +221,21 @@ enum EAppReleaseState
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
enum EAppOwernshipFlags
|
||||
enum EAppOwnershipFlags
|
||||
{
|
||||
k_EAppOwernshipFlags_None = 0, // unknown
|
||||
k_EAppOwernshipFlags_OwnsLicense = 1, // owns license for this game
|
||||
k_EAppOwernshipFlags_FreeLicense = 2, // not paid for game
|
||||
k_EAppOwernshipFlags_RegionRestricted = 4, // owns app, but not allowed to play in current region
|
||||
k_EAppOwernshipFlags_LowViolence = 8, // only low violence version
|
||||
k_EAppOwernshipFlags_InvalidPlatform = 16, // app not supported on current platform
|
||||
k_EAppOwernshipFlags_DeviceLicense = 32, // license was granted by authorized local device
|
||||
k_EAppOwnershipFlags_None = 0x000, // unknown
|
||||
k_EAppOwnershipFlags_OwnsLicense = 0x001, // owns license for this game
|
||||
k_EAppOwnershipFlags_FreeLicense = 0x002, // not paid for game
|
||||
k_EAppOwnershipFlags_RegionRestricted = 0x004, // owns app, but not allowed to play in current region
|
||||
k_EAppOwnershipFlags_LowViolence = 0x008, // only low violence version
|
||||
k_EAppOwnershipFlags_InvalidPlatform = 0x010, // app not supported on current platform
|
||||
k_EAppOwnershipFlags_SharedLicense = 0x020, // license was granted by authorized local device
|
||||
k_EAppOwnershipFlags_FreeWeekend = 0x040, // owned by a free weekend licenses
|
||||
k_EAppOwnershipFlags_LicenseLocked = 0x080, // shared license is locked (in use) by other user
|
||||
k_EAppOwnershipFlags_LicensePending = 0x100, // owns app, but transaction is still pending. Can't install or play
|
||||
k_EAppOwnershipFlags_LicenseExpired = 0x200, // doesn't own app anymore since license expired
|
||||
k_EAppOwnershipFlags_LicensePermanent = 0x400, // permanent license, not borrowed, or guest or freeweekend etc
|
||||
k_EAppOwnershipFlags_LicenseRecurring = 0x800, // Recurring license, user is charged periodically
|
||||
};
|
||||
|
||||
|
||||
@@ -253,7 +253,8 @@ enum EAppType
|
||||
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_Shortcut = 0x40000000, // just a shortcut, client side only
|
||||
k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace
|
||||
};
|
||||
@@ -449,6 +450,12 @@ public:
|
||||
{
|
||||
SetFromUint64( ulSteamID );
|
||||
}
|
||||
#ifdef INT64_DIFFERENT_FROM_INT64_T
|
||||
CSteamID( uint64_t ulSteamID )
|
||||
{
|
||||
SetFromUint64( (uint64)ulSteamID );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -463,7 +470,7 @@ public:
|
||||
m_steamid.m_comp.m_EUniverse = eUniverse;
|
||||
m_steamid.m_comp.m_EAccountType = eAccountType;
|
||||
|
||||
if ( eAccountType == k_EAccountTypeClan )
|
||||
if ( eAccountType == k_EAccountTypeClan || eAccountType == k_EAccountTypeGameServer )
|
||||
{
|
||||
m_steamid.m_comp.m_unAccountInstance = 0;
|
||||
}
|
||||
@@ -720,6 +727,9 @@ public:
|
||||
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
|
||||
|
||||
const char * RenderLink() const; // renders this steam ID to an admin console link string
|
||||
static const char * RenderLink( 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.
|
||||
@@ -845,6 +855,12 @@ public:
|
||||
{
|
||||
m_ulGameID = ulGameID;
|
||||
}
|
||||
#ifdef INT64_DIFFERENT_FROM_INT64_T
|
||||
CGameID( uint64_t ulGameID )
|
||||
{
|
||||
m_ulGameID = (uint64)ulGameID;
|
||||
}
|
||||
#endif
|
||||
|
||||
explicit CGameID( int32 nAppID )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//========= Copyright © 1996-2013, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose: Controller related public types/constants
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef STEAMCONTROLLERPUBLIC_H
|
||||
#define STEAMCONTROLLERPUBLIC_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#if defined( STEAM ) || defined( ISTEAMCONTROLLER_H )
|
||||
// This file should only be included by the Steam build or directly from
|
||||
// isteamcontroller.h.
|
||||
#include "steamtypes.h"
|
||||
#else
|
||||
// Otherwise, we assume it's a firmware build, which doesn't deal with all the
|
||||
// things that exist in steamtypes.h, and hardcode the typedefs we need.
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned __int64 uint64;
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
// Safe to add new bitfields at the end of this list for new buttons/actions,
|
||||
// but never re-use or re-number an existing flag as old client code will be
|
||||
// confused.
|
||||
#define STEAM_RIGHT_TRIGGER_MASK 0x0000000000000001l
|
||||
#define STEAM_LEFT_TRIGGER_MASK 0x0000000000000002l
|
||||
#define STEAM_RIGHT_BUMPER_MASK 0x0000000000000004l
|
||||
#define STEAM_LEFT_BUMPER_MASK 0x0000000000000008l
|
||||
#define STEAM_BUTTON_0_MASK 0x0000000000000010l
|
||||
#define STEAM_BUTTON_1_MASK 0x0000000000000020l
|
||||
#define STEAM_BUTTON_2_MASK 0x0000000000000040l
|
||||
#define STEAM_BUTTON_3_MASK 0x0000000000000080l
|
||||
#define STEAM_TOUCH_0_MASK 0x0000000000000100l
|
||||
#define STEAM_TOUCH_1_MASK 0x0000000000000200l
|
||||
#define STEAM_TOUCH_2_MASK 0x0000000000000400l
|
||||
#define STEAM_TOUCH_3_MASK 0x0000000000000800l
|
||||
#define STEAM_BUTTON_MENU_MASK 0x0000000000001000l
|
||||
#define STEAM_BUTTON_STEAM_MASK 0x0000000000002000l
|
||||
#define STEAM_BUTTON_ESCAPE_MASK 0x0000000000004000l
|
||||
#define STEAM_BUTTON_BACK_LEFT_MASK 0x0000000000008000l
|
||||
#define STEAM_BUTTON_BACK_RIGHT_MASK 0x0000000000010000l
|
||||
#define STEAM_BUTTON_LEFTPAD_CLICKED_MASK 0x0000000000020000l
|
||||
#define STEAM_BUTTON_RIGHTPAD_CLICKED_MASK 0x0000000000040000l
|
||||
#define STEAM_LEFTPAD_FINGERDOWN_MASK 0x0000000000080000l
|
||||
#define STEAM_RIGHTPAD_FINGERDOWN_MASK 0x0000000000100000l
|
||||
|
||||
// Only add fields to the end of this struct, or if you need to change it in a larger
|
||||
// way add a new message id and new struct completely so as to not break old clients.
|
||||
typedef struct
|
||||
{
|
||||
// If packet num matches that on your prior call, then the controller state hasn't been changed since
|
||||
// your last call and there is no need to process it
|
||||
uint32 unPacketNum;
|
||||
|
||||
// bit flags for each of the buttons
|
||||
uint64 ulButtons;
|
||||
|
||||
// Left pad coordinates
|
||||
short sLeftPadX;
|
||||
short sLeftPadY;
|
||||
|
||||
// Right pad coordinates
|
||||
short sRightPadX;
|
||||
short sRightPadY;
|
||||
|
||||
} SteamControllerState_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif // STEAMCONTROLLERPUBLIC_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//====== 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.
|
||||
@@ -20,13 +20,13 @@ enum EHTTPMethod
|
||||
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_EHTTPMethodOPTIONS,
|
||||
k_EHTTPMethodPUT,
|
||||
k_EHTTPMethodDELETE,
|
||||
// k_EHTTPMethodTRACE,
|
||||
// k_EHTTPMethodCONNECT
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -10,6 +10,8 @@
|
||||
#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;
|
||||
@@ -43,6 +45,9 @@ 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 *)
|
||||
@@ -59,6 +64,16 @@ 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;
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,242 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace vr
|
||||
{
|
||||
|
||||
#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.
|
||||
#pragma pack( push, 4 )
|
||||
#else
|
||||
#pragma pack( push, 8 )
|
||||
#endif
|
||||
|
||||
|
||||
// right-handed system
|
||||
// +y is up
|
||||
// +x is to the right
|
||||
// -z is going away from you
|
||||
// Distance unit is meters
|
||||
struct HmdMatrix34_t
|
||||
{
|
||||
float m[3][4];
|
||||
};
|
||||
|
||||
struct HmdMatrix44_t
|
||||
{
|
||||
float m[4][4];
|
||||
};
|
||||
|
||||
|
||||
/** Used to return the post-distortion UVs for each color channel.
|
||||
* UVs range from 0 to 1 with 0,0 in the upper left corner of the
|
||||
* source render target. The 0,0 to 1,1 range covers a single eye. */
|
||||
struct DistortionCoordinates_t
|
||||
{
|
||||
float rfRed[2];
|
||||
float rfGreen[2];
|
||||
float rfBlue[2];
|
||||
};
|
||||
|
||||
|
||||
enum Hmd_Eye
|
||||
{
|
||||
Eye_Left = 0,
|
||||
Eye_Right = 1
|
||||
};
|
||||
|
||||
enum GraphicsAPIConvention
|
||||
{
|
||||
API_DirectX = 0, // Normalized Z goes from 0 at the viewer to 1 at the far clip plane
|
||||
API_OpenGL = 1, // Normalized Z goes from 1 at the viewer to -1 at the far clip plane
|
||||
};
|
||||
|
||||
enum HmdTrackingResult
|
||||
{
|
||||
TrackingResult_Uninitialized = 1,
|
||||
|
||||
TrackingResult_Calibrating_InProgress = 100,
|
||||
TrackingResult_Calibrating_OutOfRange = 101,
|
||||
|
||||
TrackingResult_Running_OK = 200,
|
||||
TrackingResult_Running_OutOfRange = 201,
|
||||
};
|
||||
|
||||
class IHmd
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// Display Methods
|
||||
// ------------------------------------
|
||||
|
||||
/** Size and position that the window needs to be on the VR display. */
|
||||
virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
|
||||
|
||||
/** Suggested size for the intermediate render target that the distortion pulls from. */
|
||||
virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
|
||||
|
||||
/** Gets the viewport in the frame buffer to draw the output of the distortion into */
|
||||
virtual void GetEyeOutputViewport( Hmd_Eye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
|
||||
|
||||
/** The projection matrix for the specified eye */
|
||||
virtual HmdMatrix44_t GetProjectionMatrix( Hmd_Eye eEye, float fNearZ, float fFarZ, GraphicsAPIConvention eProjType ) = 0;
|
||||
|
||||
/** The components necessary to build your own projection matrix in case your
|
||||
* application is doing something fancy like infinite Z */
|
||||
virtual void GetProjectionRaw( Hmd_Eye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0;
|
||||
|
||||
/** Returns the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in
|
||||
* the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. */
|
||||
virtual DistortionCoordinates_t ComputeDistortion( Hmd_Eye eEye, float fU, float fV ) = 0;
|
||||
|
||||
/** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head
|
||||
* space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection.
|
||||
* Normally View and Eye^-1 will be multiplied together and treated as View in your application.
|
||||
*/
|
||||
virtual HmdMatrix34_t GetHeadFromEyePose( Hmd_Eye eEye ) = 0;
|
||||
|
||||
/** For use in simple VR apps, this method returns the concatenation of the
|
||||
* tracking pose and the eye matrix to get a full view matrix for each eye.
|
||||
* This is ( GetEyeMatrix() ) * (GetWorldFromHeadPose() ^ -1 ) */
|
||||
virtual bool GetViewMatrix( float fSecondsFromNow, HmdMatrix44_t *pMatLeftView, HmdMatrix44_t *pMatRightView, HmdTrackingResult *peResult ) = 0;
|
||||
|
||||
/** [D3D9 Only]
|
||||
* Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such
|
||||
* a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error.
|
||||
*/
|
||||
virtual int32_t GetD3D9AdapterIndex() = 0;
|
||||
|
||||
/** [D3D10/11 Only]
|
||||
* Returns the adapter index and output index that the user should pass into EnumAdapters adn EnumOutputs
|
||||
* to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1.
|
||||
*/
|
||||
virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0;
|
||||
|
||||
// ------------------------------------
|
||||
// Tracking Methods
|
||||
// ------------------------------------
|
||||
|
||||
/** The pose that the tracker thinks that the HMD will be in at the specified
|
||||
* number of seconds into the future. Pass 0 to get the current state.
|
||||
*
|
||||
* This is roughly analogous to the inverse of the view matrix in most applications, though
|
||||
* many games will need to do some additional rotation or translation on top of the rotation
|
||||
* and translation provided by the head pose.
|
||||
*
|
||||
* If this function returns true the pose has been populated with a pose that can be used by the application.
|
||||
* Check peResult for details about the pose, including messages that should be displayed to the user.
|
||||
*/
|
||||
virtual bool GetTrackerFromHeadPose( float fPredictedSecondsFromNow, HmdMatrix34_t *pmPose, HmdTrackingResult *peResult ) = 0;
|
||||
|
||||
/** Passes back the pose matrix from the last successful call to GetWorldFromHeadPose(). Returns true if that matrix is
|
||||
* valid (because there has been a previous successful pose.) */
|
||||
virtual bool GetLastTrackerFromHeadPose( HmdMatrix34_t *pmPose ) = 0;
|
||||
|
||||
/** Returns true if the tracker for this HMD will drift the Yaw component of its pose over time regardless of
|
||||
* actual head motion. This is true for gyro-based trackers with no ground truth. */
|
||||
virtual bool WillDriftInYaw() = 0;
|
||||
|
||||
/** Sets the zero pose for the tracker coordinate system. After this call all WorldFromHead poses will be relative
|
||||
* to the pose whenever this was called. The new zero coordinate system will not change the fact that the Y axis is
|
||||
* up in the real world, so the next pose returned from GetWorldFromHeadPose after a call to ZeroTracker may not be
|
||||
* exactly an identity matrix. */
|
||||
virtual void ZeroTracker() = 0;
|
||||
|
||||
/** Returns the zero pose for the tracker coordinate system. If the tracker has never had a valid pose, this
|
||||
* will be an identity matrix. */
|
||||
virtual HmdMatrix34_t GetTrackerZeroPose() = 0;
|
||||
|
||||
// ------------------------------------
|
||||
// Administrative methods
|
||||
// ------------------------------------
|
||||
|
||||
/** The ID of the driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If
|
||||
* the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes
|
||||
* will be enough to fit any ID. */
|
||||
virtual uint32_t GetDriverId( char *pchBuffer, uint32_t unBufferLen ) = 0;
|
||||
|
||||
/** The ID of this display within its driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If
|
||||
* the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes
|
||||
* will be enough to fit any ID. */
|
||||
virtual uint32_t GetDisplayId( char *pchBuffer, uint32_t unBufferLen ) = 0;
|
||||
};
|
||||
|
||||
static const char * const IHmd_Version = "IHmd_004";
|
||||
|
||||
/** error codes returned by Vr_Init */
|
||||
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_IPC_ServerInitFailed = 300,
|
||||
HmdError_IPC_ConnectFailed = 301,
|
||||
HmdError_IPC_SharedStateInitFailed = 302,
|
||||
|
||||
};
|
||||
|
||||
|
||||
// figure out how to import from the VR API dll
|
||||
#if defined(_WIN32)
|
||||
|
||||
#ifdef VR_API_EXPORT
|
||||
#define VR_INTERFACE extern "C" __declspec( dllexport )
|
||||
#else
|
||||
#define VR_INTERFACE extern "C" __declspec( dllimport )
|
||||
#endif
|
||||
|
||||
#elif defined(GNUC) || defined(COMPILER_GCC)
|
||||
|
||||
#ifdef VR_API_EXPORT
|
||||
#define VR_INTERFACE extern "C" __attribute__((visibility("default")))
|
||||
#else
|
||||
#define VR_INTERFACE extern "C"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "Unsupported Platform."
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/** Finds the active installation of the VR API and initializes it. The priority for figuring
|
||||
* out where to load vrclient from are:
|
||||
* 1. The convar "VR_OVERRIDE", which should contain an absolute path to the root of
|
||||
* an vr API directory.
|
||||
* 2. The pchVROverride argument. This should be an absolute path or a path relative to
|
||||
* the current executable.
|
||||
* 3. The path "./vr" relative to the current executable's path.
|
||||
*
|
||||
* Each of these paths are to the "root" of the VR API install. That's the directory with
|
||||
* the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself.
|
||||
*/
|
||||
VR_INTERFACE IHmd *VR_Init( HmdError *peError );
|
||||
|
||||
/** unloads vrclient.dll. Any interface pointers from the interface are
|
||||
* invalid after this point */
|
||||
VR_INTERFACE void VR_Shutdown( );
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
}
|
||||
@@ -13,44 +13,6 @@
|
||||
// Include the annotation header file.
|
||||
#include <sal.h>
|
||||
|
||||
// /Analyze warnings can only be suppressed when using a compiler that supports them, which VS 2010
|
||||
// Professional does not.
|
||||
|
||||
// We don't care about these warnings because they are bugs that can only occur during resource
|
||||
// exhaustion or other unexpected API failure, which we are nowhere near being able to handle.
|
||||
#pragma warning(disable : 6308) // warning C6308: 'realloc' might return null pointer: assigning null pointer to 's_ppTestCases', which is passed as an argument to 'realloc', will cause the original memory block to be leaked
|
||||
#pragma warning(disable : 6255) // warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
|
||||
#pragma warning(disable : 6387) // warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'GetProcAddress'
|
||||
#pragma warning(disable : 6309) // warning C6309: Argument '1' is null: this does not adhere to function specification of 'GetProcAddress'
|
||||
#pragma warning(disable : 6011) // warning C6011: Dereferencing NULL pointer 'm_ppTestCases'
|
||||
#pragma warning(disable : 6211) // warning C6211: Leaking memory 'newKeyValue' due to an exception. Consider using a local catch block to clean up memory
|
||||
#pragma warning(disable : 6031) // warning C6031: Return value ignored: '_getcwd'
|
||||
|
||||
// These warnings are because /analyze doesn't like our use of constants, especially things like IsPC()
|
||||
#pragma warning(disable : 6326) // warning C6326: Potential comparison of a constant with another constant
|
||||
#pragma warning(disable : 6239) // warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?
|
||||
#pragma warning(disable : 6285) // warning C6285: (<non-zero constant> || <non-zero constant>) is always a non-zero constant. Did you intend to use the bitwise-and operator?
|
||||
#pragma warning(disable : 6237) // warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and might have side effects
|
||||
#pragma warning(disable : 6235) // warning C6235: (<non-zero constant> || <expression>) is always a non-zero constant
|
||||
#pragma warning(disable : 6240) // warning C6240: (<expression> && <non-zero constant>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?
|
||||
|
||||
// These warnings aren't really important:
|
||||
#pragma warning(disable : 6323) // warning C6323: Use of arithmetic operator on Boolean type(s)
|
||||
|
||||
// Miscellaneous other /analyze warnings. We should consider fixing these at some point.
|
||||
//#pragma warning(disable : 6204) // warning C6204: Possible buffer overrun in call to 'memcpy': use of unchecked parameter 'src'
|
||||
//#pragma warning(disable : 6262) // warning C6262: Function uses '16464' bytes of stack: exceeds /analyze:stacksize'16384'. Consider moving some data to heap
|
||||
// This is a serious warning. Don't suppress it.
|
||||
//#pragma warning(disable : 6263) // warning C6263: Using _alloca in a loop: this can quickly overflow stack
|
||||
// 6328 is also used for passing __int64 to printf when int is expected so we can't suppress it.
|
||||
//#pragma warning(disable : 6328) // warning C6328: 'char' passed as parameter '1' when 'unsigned char' is required in call to 'V_isdigit'
|
||||
// /analyze doesn't like GCOMPILER_ASSERT's implementation of compile-time asserts
|
||||
#pragma warning(disable : 6326) // warning C6326: Potential comparison of a constant with another constant
|
||||
#pragma warning(disable : 6335) // warning C6335: Leaking process information handle 'pi.hThread'
|
||||
#pragma warning(disable : 6320) // warning C6320: Exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This might mask exceptions that were not intended to be handled
|
||||
#pragma warning(disable : 6250) // warning C6250: Calling 'VirtualFree' without the MEM_RELEASE flag might free memory but not address descriptors (VADs). This causes address space leaks
|
||||
#pragma warning(disable : 6384) // ientity2_class_h_schema_gen.cpp(76): warning C6384: Dividing sizeof a pointer by another value
|
||||
|
||||
// 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))
|
||||
|
||||
+21
-23
@@ -285,7 +285,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
|
||||
|
||||
#define AssertFatal( _exp ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), ((void)0), true )
|
||||
#define AssertFatalOnce( _exp ) _AssertMsgOnce( _exp, _T("Assertion Failed: ") _T(#_exp), true )
|
||||
#define AssertFatalMsg( _exp, _msg ) _AssertMsg( _exp, _msg, ((void)0), true )
|
||||
#define AssertFatalMsg( _exp, _msg, ... ) _AssertMsg( _exp, (const tchar *)CDbgFmtMsg( _msg, ##__VA_ARGS__ ), ((void)0), true )
|
||||
#define AssertFatalMsgOnce( _exp, _msg ) _AssertMsgOnce( _exp, _msg, true )
|
||||
#define AssertFatalFunc( _exp, _f ) _AssertMsg( _exp, _T("Assertion Failed: " _T(#_exp), _f, true )
|
||||
#define AssertFatalEquals( _exp, _expectedValue ) AssertFatalMsg2( (_exp) == (_expectedValue), _T("Expected %d but got %d!"), (_expectedValue), (_exp) )
|
||||
@@ -293,16 +293,15 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
|
||||
#define VerifyFatal( _exp ) AssertFatal( _exp )
|
||||
#define VerifyEqualsFatal( _exp, _expectedValue ) AssertFatalEquals( _exp, _expectedValue )
|
||||
|
||||
#define AssertFatalMsg1( _exp, _msg, a1 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1 )))
|
||||
#define AssertFatalMsg2( _exp, _msg, a1, a2 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2 )))
|
||||
#define AssertFatalMsg3( _exp, _msg, a1, a2, a3 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3 )))
|
||||
#define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4 )))
|
||||
#define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5 )))
|
||||
#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 )))
|
||||
#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 )))
|
||||
#define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7 )))
|
||||
#define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8 )))
|
||||
#define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 )))
|
||||
#define AssertFatalMsg1( _exp, _msg, a1 ) AssertFatalMsg( _exp, _msg, a1 )
|
||||
#define AssertFatalMsg2( _exp, _msg, a1, a2 ) AssertFatalMsg( _exp, _msg, a1, a2 )
|
||||
#define AssertFatalMsg3( _exp, _msg, a1, a2, a3 ) AssertFatalMsg( _exp, _msg, a1, a2, a3 )
|
||||
#define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4 )
|
||||
#define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5 )
|
||||
#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6 )
|
||||
#define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 )
|
||||
#define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 )
|
||||
#define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 )
|
||||
|
||||
#else // DBGFLAG_ASSERTFATAL
|
||||
|
||||
@@ -322,7 +321,6 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
|
||||
#define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) ((void)0)
|
||||
#define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) ((void)0)
|
||||
#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0)
|
||||
#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0)
|
||||
#define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) ((void)0)
|
||||
#define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) ((void)0)
|
||||
#define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) ((void)0)
|
||||
@@ -336,7 +334,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
|
||||
#define Assert( _exp ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), ((void)0), false )
|
||||
#define AssertMsg( _exp, _msg ) _AssertMsg( _exp, _msg, ((void)0), false )
|
||||
#define AssertMsg( _exp, _msg, ... ) _AssertMsg( _exp, (const tchar *)CDbgFmtMsg( _msg, ##__VA_ARGS__ ), ((void)0), false )
|
||||
#define AssertOnce( _exp ) _AssertMsgOnce( _exp, _T("Assertion Failed: ") _T(#_exp), false )
|
||||
#define AssertMsgOnce( _exp, _msg ) _AssertMsgOnce( _exp, _msg, false )
|
||||
#define AssertFunc( _exp, _f ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), _f, false )
|
||||
@@ -349,21 +347,21 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
|
||||
#define VerifyEquals( _exp, _expectedValue ) AssertEquals( _exp, _expectedValue )
|
||||
#define DbgVerify( _exp ) Assert( _exp )
|
||||
|
||||
#define AssertMsg1( _exp, _msg, a1 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1 )) )
|
||||
#define AssertMsg2( _exp, _msg, a1, a2 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2 )) )
|
||||
#define AssertMsg3( _exp, _msg, a1, a2, a3 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3 )) )
|
||||
#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4 )) )
|
||||
#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5 )) )
|
||||
#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 )) )
|
||||
#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7 )) )
|
||||
#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8 )) )
|
||||
#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 )) )
|
||||
#define AssertMsg1( _exp, _msg, a1 ) AssertMsg( _exp, _msg, a1 )
|
||||
#define AssertMsg2( _exp, _msg, a1, a2 ) AssertMsg( _exp, _msg, a1, a2 )
|
||||
#define AssertMsg3( _exp, _msg, a1, a2, a3 ) AssertMsg( _exp, _msg, a1, a2, a3 )
|
||||
#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertMsg( _exp, _msg, a1, a2, a3, a4 )
|
||||
#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5 )
|
||||
#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6 )
|
||||
#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 )
|
||||
#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 )
|
||||
#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 )
|
||||
|
||||
#else // DBGFLAG_ASSERT
|
||||
|
||||
#define Assert( _exp ) ((void)0)
|
||||
#define AssertOnce( _exp ) ((void)0)
|
||||
#define AssertMsg( _exp, _msg ) ((void)0)
|
||||
#define AssertMsg( _exp, _msg, ... ) ((void)0)
|
||||
#define AssertMsgOnce( _exp, _msg ) ((void)0)
|
||||
#define AssertFunc( _exp, _f ) ((void)0)
|
||||
#define AssertEquals( _exp, _expectedValue ) ((void)0)
|
||||
|
||||
@@ -499,10 +499,10 @@ public:
|
||||
CLimitTimer() {}
|
||||
CLimitTimer( uint64 cMicroSecDuration ) { SetLimit( cMicroSecDuration ); }
|
||||
void SetLimit( uint64 m_cMicroSecDuration );
|
||||
bool BLimitReached();
|
||||
bool BLimitReached() const;
|
||||
|
||||
int CMicroSecOverage();
|
||||
uint64 CMicroSecLeft();
|
||||
int CMicroSecOverage() const;
|
||||
uint64 CMicroSecLeft() const;
|
||||
|
||||
private:
|
||||
uint64 m_lCycleLimit;
|
||||
@@ -526,7 +526,7 @@ inline void CLimitTimer::SetLimit( uint64 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( );
|
||||
@@ -538,7 +538,7 @@ inline bool CLimitTimer::BLimitReached( )
|
||||
// Purpose: If we're over our specified time period, return the amount of the overage.
|
||||
// Output: # of microseconds since we reached our specified time period.
|
||||
//-----------------------------------------------------------------------------
|
||||
inline int CLimitTimer::CMicroSecOverage()
|
||||
inline int CLimitTimer::CMicroSecOverage() const
|
||||
{
|
||||
CCycleCount cycleCount;
|
||||
cycleCount.Sample();
|
||||
@@ -555,7 +555,7 @@ inline int CLimitTimer::CMicroSecOverage()
|
||||
// Purpose: If we're under our specified time period, return the amount under.
|
||||
// Output: # of microseconds until we reached our specified time period, 0 if we've passed it
|
||||
//-----------------------------------------------------------------------------
|
||||
inline uint64 CLimitTimer::CMicroSecLeft()
|
||||
inline uint64 CLimitTimer::CMicroSecLeft() const
|
||||
{
|
||||
CCycleCount cycleCount;
|
||||
cycleCount.Sample();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// $Header: $
|
||||
// $NoKeywords: $
|
||||
@@ -45,31 +45,49 @@ public:
|
||||
template <class T, class LessFunc = CUtlSortVectorDefaultLess<T>, class BaseVector = CUtlVector<T> >
|
||||
class CUtlSortVector : public BaseVector
|
||||
{
|
||||
typedef BaseVector BaseClass;
|
||||
public:
|
||||
|
||||
// constructor
|
||||
/// 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<T, LessFunc> & );
|
||||
@@ -79,10 +97,9 @@ protected:
|
||||
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 );
|
||||
@@ -121,6 +138,10 @@ protected:
|
||||
bool m_bNeedsSort;
|
||||
|
||||
private:
|
||||
private:
|
||||
template< typename TKey >
|
||||
int FindLessOrEqual( const TKey& search, bool *pFound ) const;
|
||||
|
||||
void QuickSort( LessFunc& less, int X, int I );
|
||||
};
|
||||
|
||||
@@ -176,6 +197,43 @@ int CUtlSortVector<T, LessFunc, BaseVector>::InsertNoSort( const T& src )
|
||||
return lastElement;
|
||||
}
|
||||
|
||||
/// inserts (copy constructs) an element in sorted order into the list if it isn't already in the list
|
||||
template <class T, class LessFunc, class BaseVector>
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::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<T>( &this->Element(pos), src );
|
||||
return pos;
|
||||
}
|
||||
|
||||
template <class T, class LessFunc, class BaseVector>
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::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 <class T, class LessFunc, class BaseVector>
|
||||
void CUtlSortVector<T, LessFunc, BaseVector>::QuickSort( LessFunc& less, int nLower, int nUpper )
|
||||
{
|
||||
@@ -218,7 +276,8 @@ void CUtlSortVector<T, LessFunc, BaseVector>::RedoSort( bool bForceSort /*= fals
|
||||
// finds a particular element
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class LessFunc, class BaseVector>
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::Find( const T& src ) const
|
||||
template < typename TKey >
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::Find( const TKey& src ) const
|
||||
{
|
||||
AssertFatal( !m_bNeedsSort );
|
||||
|
||||
@@ -245,11 +304,34 @@ int CUtlSortVector<T, LessFunc, BaseVector>::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<T, LessFunc, BaseVector>::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 <class T, class LessFunc, class BaseVector>
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::FindLessOrEqual( const T& src ) const
|
||||
template < typename TKey >
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::FindLessOrEqual( const TKey& src, bool *pFound ) const
|
||||
{
|
||||
AssertFatal( !m_bNeedsSort );
|
||||
|
||||
@@ -268,14 +350,26 @@ int CUtlSortVector<T, LessFunc, BaseVector>::FindLessOrEqual( const T& src ) con
|
||||
}
|
||||
else
|
||||
{
|
||||
*pFound = true;
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
|
||||
*pFound = false;
|
||||
return end;
|
||||
}
|
||||
|
||||
template <class T, class LessFunc, class BaseVector>
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::FindLess( const T& src ) const
|
||||
template < typename TKey >
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::FindLessOrEqual( const TKey& src ) const
|
||||
{
|
||||
bool bFound;
|
||||
return FindLessOrEqual( src, &bFound );
|
||||
}
|
||||
|
||||
template <class T, class LessFunc, class BaseVector>
|
||||
template < typename TKey >
|
||||
int CUtlSortVector<T, LessFunc, BaseVector>::FindLess( const TKey& src ) const
|
||||
{
|
||||
AssertFatal( !m_bNeedsSort );
|
||||
|
||||
|
||||
@@ -66,7 +66,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
|
||||
@@ -265,7 +265,7 @@ friend class CCvar;
|
||||
public:
|
||||
typedef ConCommandBase BaseClass;
|
||||
|
||||
ConCommand( const char *pName, FnCommandCallbackV1_t callback,
|
||||
ConCommand( const char *pName, FnCommandCallbackVoid_t callback,
|
||||
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||
ConCommand( const char *pName, FnCommandCallback_t callback,
|
||||
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||
@@ -295,7 +295,7 @@ private:
|
||||
// Call this function when executing the command
|
||||
union
|
||||
{
|
||||
FnCommandCallbackV1_t m_fnCommandCallbackV1;
|
||||
FnCommandCallbackVoid_t m_fnCommandCallbackV1;
|
||||
FnCommandCallback_t m_fnCommandCallback;
|
||||
ICommandCallback *m_pCommandCallback;
|
||||
};
|
||||
|
||||
@@ -31,28 +31,52 @@
|
||||
int result; \
|
||||
va_list arg_ptr; \
|
||||
bool bTruncated = false; \
|
||||
static unsigned int scAsserted = 0; \
|
||||
static int scAsserted = 0; \
|
||||
\
|
||||
va_start(arg_ptr, lastArg); \
|
||||
result = Q_vsnprintfRet( (szBuf), nBufSize, (*(ppszFormat)), arg_ptr, &bTruncated ); \
|
||||
result = V_vsnprintfRet( (szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr, &bTruncated ); \
|
||||
va_end(arg_ptr); \
|
||||
\
|
||||
(szBuf)[(nBufSize)-1] = 0; \
|
||||
if ( bTruncated && !(bQuietTruncation) && scAsserted < 5 ) \
|
||||
{ \
|
||||
Assert( !bTruncated ); \
|
||||
Warning( "FmtStrVSNPrintf truncated to %d without QUIET_TRUNCATION specified!\n", ( int )( nBufSize ) ); \
|
||||
AssertMsg( 0, "FmtStrVSNPrintf truncated without QUIET_TRUNCATION specified!\n" ); \
|
||||
scAsserted++; \
|
||||
} \
|
||||
m_nLength = nPrevLen + result; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
// using macro to be compatable with GCC
|
||||
#define FmtStrVSNPrintfNoLengthFixup( szBuf, nBufSize, bQuietTruncation, ppszFormat, nPrevLen, lastArg ) \
|
||||
do \
|
||||
{ \
|
||||
int result; \
|
||||
va_list arg_ptr; \
|
||||
bool bTruncated = false; \
|
||||
static int scAsserted = 0; \
|
||||
\
|
||||
va_start(arg_ptr, lastArg); \
|
||||
result = V_vsnprintfRet( (szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr, &bTruncated ); \
|
||||
va_end(arg_ptr); \
|
||||
\
|
||||
(szBuf)[(nBufSize)-1] = 0; \
|
||||
if ( bTruncated && !(bQuietTruncation) && scAsserted < 5 ) \
|
||||
{ \
|
||||
Warning( "FmtStrVSNPrintf truncated to %d without QUIET_TRUNCATION specified!\n", ( int )( nBufSize ) ); \
|
||||
AssertMsg( 0, "FmtStrVSNPrintf truncated without QUIET_TRUNCATION specified!\n" ); \
|
||||
scAsserted++; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Purpose: String formatter with specified size
|
||||
//
|
||||
|
||||
template <int SIZE_BUF>
|
||||
template <int SIZE_BUF, bool QUIET_TRUNCATION = false >
|
||||
class CFmtStrN
|
||||
{
|
||||
public:
|
||||
@@ -80,14 +104,36 @@ public:
|
||||
// Explicit reformat
|
||||
const char *sprintf(PRINTF_FORMAT_STRING const char *pszFormat, ...) FMTFUNCTION( 2, 3 )
|
||||
{
|
||||
FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, &pszFormat, 0, pszFormat );
|
||||
InitQuietTruncation();
|
||||
FmtStrVSNPrintf(m_szBuf, SIZE_BUF, m_bQuietTruncation, &pszFormat, 0, pszFormat );
|
||||
return m_szBuf;
|
||||
}
|
||||
|
||||
// Use this for va_list formatting
|
||||
const char *sprintf_argv(const char *pszFormat, va_list arg_ptr)
|
||||
{
|
||||
int result;
|
||||
bool bTruncated = false;
|
||||
static int s_nWarned = 0;
|
||||
|
||||
InitQuietTruncation();
|
||||
result = V_vsnprintfRet( m_szBuf, SIZE_BUF - 1, pszFormat, arg_ptr, &bTruncated );
|
||||
m_szBuf[SIZE_BUF - 1] = 0;
|
||||
if ( bTruncated && !m_bQuietTruncation && ( s_nWarned < 5 ) )
|
||||
{
|
||||
Warning( "CFmtStr truncated to %d without QUIET_TRUNCATION specified!\n", SIZE_BUF );
|
||||
AssertMsg( 0, "CFmtStr truncated without QUIET_TRUNCATION specified!\n" );
|
||||
s_nWarned++;
|
||||
}
|
||||
m_nLength = V_strlen( m_szBuf );
|
||||
return m_szBuf;
|
||||
}
|
||||
|
||||
// Use this for pass-through formatting
|
||||
void VSprintf(const char **ppszFormat, ...)
|
||||
{
|
||||
FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, ppszFormat, 0, ppszFormat);
|
||||
InitQuietTruncation();
|
||||
FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, ppszFormat, 0, ppszFormat );
|
||||
}
|
||||
|
||||
// Compatible API with CUtlString for converting to const char*
|
||||
@@ -97,14 +143,17 @@ public:
|
||||
operator const char *() const { return m_szBuf; }
|
||||
char *Access() { return m_szBuf; }
|
||||
|
||||
CFmtStrN<SIZE_BUF> & operator=( const char *pchValue )
|
||||
// Access template argument
|
||||
static inline int GetMaxLength() { return SIZE_BUF-1; }
|
||||
|
||||
CFmtStrN<SIZE_BUF,QUIET_TRUNCATION> & operator=( const char *pchValue )
|
||||
{
|
||||
V_strncpy( m_szBuf, pchValue, SIZE_BUF );
|
||||
m_nLength = V_strlen( m_szBuf );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CFmtStrN<SIZE_BUF> & operator+=( const char *pchValue )
|
||||
CFmtStrN<SIZE_BUF,QUIET_TRUNCATION> & operator+=( const char *pchValue )
|
||||
{
|
||||
Append( pchValue );
|
||||
return *this;
|
||||
@@ -112,13 +161,19 @@ public:
|
||||
|
||||
int Length() const { return m_nLength; }
|
||||
|
||||
void SetLength( int nLength )
|
||||
{
|
||||
m_nLength = Min( nLength, SIZE_BUF - 1 );
|
||||
m_szBuf[m_nLength] = '\0';
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
m_szBuf[0] = 0;
|
||||
m_nLength = 0;
|
||||
}
|
||||
|
||||
void AppendFormat(PRINTF_FORMAT_STRING const char *pchFormat, ... ) FMTFUNCTION( 2, 3 )
|
||||
void AppendFormat( PRINTF_FORMAT_STRING const char *pchFormat, ... )
|
||||
{
|
||||
char *pchEnd = m_szBuf + m_nLength;
|
||||
FmtStrVSNPrintf( pchEnd, SIZE_BUF - m_nLength, m_bQuietTruncation, &pchFormat, m_nLength, pchFormat );
|
||||
@@ -163,14 +218,12 @@ public:
|
||||
|
||||
void AppendIndent( uint32 unCount, char chIndent = '\t' );
|
||||
|
||||
void SetQuietTruncation( bool bQuiet ) { m_bQuietTruncation = bQuiet; }
|
||||
|
||||
protected:
|
||||
virtual void InitQuietTruncation()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bQuietTruncation = false;
|
||||
#else
|
||||
m_bQuietTruncation = true; // Force quiet for release builds
|
||||
#endif
|
||||
m_bQuietTruncation = QUIET_TRUNCATION;
|
||||
}
|
||||
|
||||
bool m_bQuietTruncation;
|
||||
@@ -183,16 +236,14 @@ private:
|
||||
|
||||
// Version which will not assert if strings are truncated
|
||||
|
||||
template <int SIZE_BUF>
|
||||
class CFmtStrQuietTruncationN : public CFmtStrN<SIZE_BUF>
|
||||
template < int SIZE_BUF >
|
||||
class CFmtStrQuietTruncationN : public CFmtStrN<SIZE_BUF, true >
|
||||
{
|
||||
protected:
|
||||
virtual void InitQuietTruncation() { this->m_bQuietTruncation = true; }
|
||||
};
|
||||
|
||||
|
||||
template< int SIZE_BUF >
|
||||
void CFmtStrN<SIZE_BUF>::AppendIndent( uint32 unCount, char chIndent )
|
||||
template< int SIZE_BUF, bool QUIET_TRUNCATION >
|
||||
void CFmtStrN< SIZE_BUF, QUIET_TRUNCATION >::AppendIndent( uint32 unCount, char chIndent )
|
||||
{
|
||||
Assert( Length() + unCount < SIZE_BUF );
|
||||
if( Length() + unCount >= SIZE_BUF )
|
||||
@@ -204,8 +255,8 @@ void CFmtStrN<SIZE_BUF>::AppendIndent( uint32 unCount, char chIndent )
|
||||
m_szBuf[ m_nLength ] = '\0';
|
||||
}
|
||||
|
||||
template< int SIZE_BUF >
|
||||
void CFmtStrN<SIZE_BUF>::AppendFormatV( const char *pchFormat, va_list args )
|
||||
template< int SIZE_BUF, bool QUIET_TRUNCATION >
|
||||
void CFmtStrN< SIZE_BUF, QUIET_TRUNCATION >::AppendFormatV( const char *pchFormat, va_list args )
|
||||
{
|
||||
int cubPrinted = V_vsnprintf( m_szBuf+Length(), SIZE_BUF - Length(), pchFormat, args );
|
||||
m_nLength += cubPrinted;
|
||||
|
||||
@@ -30,19 +30,27 @@
|
||||
|
||||
typedef void (*MemoryPoolReportFunc_t)( PRINTF_FORMAT_STRING char const* pMsg, ... );
|
||||
|
||||
// Ways a memory pool can grow when it needs to make a new blob:
|
||||
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 CUtlMemoryPool
|
||||
{
|
||||
public:
|
||||
// Ways the memory pool can grow when it needs to make a new blob.
|
||||
// !KLUDGE! For legacy code support, import the global enum into this scope
|
||||
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
|
||||
// get larger and larger each time it allocates one).
|
||||
GROW_SLOW=2 // New blob size is numElements.
|
||||
GROW_NONE=UTLMEMORYPOOL_GROW_NONE,
|
||||
GROW_FAST=UTLMEMORYPOOL_GROW_FAST,
|
||||
GROW_SLOW=UTLMEMORYPOOL_GROW_SLOW
|
||||
};
|
||||
|
||||
CUtlMemoryPool( int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 );
|
||||
CUtlMemoryPool( int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 );
|
||||
~CUtlMemoryPool();
|
||||
|
||||
void* Alloc(); // Allocate the element size you specified in the constructor.
|
||||
@@ -103,7 +111,7 @@ protected:
|
||||
class CMemoryPoolMT : public CUtlMemoryPool
|
||||
{
|
||||
public:
|
||||
CMemoryPoolMT(int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {}
|
||||
CMemoryPoolMT(int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {}
|
||||
|
||||
|
||||
void* Alloc() { AUTO_LOCK( m_mutex ); return CUtlMemoryPool::Alloc(); }
|
||||
|
||||
@@ -765,6 +765,29 @@ private:
|
||||
|
||||
};
|
||||
|
||||
// Encodes a string (or binary data) in URL encoding format, see rfc1738 section 2.2.
|
||||
// Dest buffer should be 3 times the size of source buffer to guarantee it has room to encode.
|
||||
void Q_URLEncodeRaw( OUT_Z_CAP(nDestLen) char *pchDest, int nDestLen, const char *pchSource, int nSourceLen );
|
||||
|
||||
// Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2.
|
||||
// Dest buffer should be at least as large as source buffer to gurantee room for decode.
|
||||
// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed.
|
||||
//
|
||||
// Returns the amount of space actually used in the output buffer.
|
||||
size_t Q_URLDecodeRaw( OUT_CAP(nDecodeDestLen) char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen );
|
||||
|
||||
// Encodes a string (or binary data) in URL encoding format, this isn't the strict rfc1738 format, but instead uses + for spaces.
|
||||
// This is for historical reasons and HTML spec foolishness that lead to + becoming a de facto standard for spaces when encoding form data.
|
||||
// Dest buffer should be 3 times the size of source buffer to guarantee it has room to encode.
|
||||
void Q_URLEncode( OUT_Z_CAP(nDestLen) char *pchDest, int nDestLen, const char *pchSource, int nSourceLen );
|
||||
|
||||
// Decodes a string (or binary data) in URL encoding format, this isn't the strict rfc1738 format, but instead uses + for spaces.
|
||||
// This is for historical reasons and HTML spec foolishness that lead to + becoming a de facto standard for spaces when encoding form data.
|
||||
// Dest buffer should be at least as large as source buffer to gurantee room for decode.
|
||||
// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed.
|
||||
//
|
||||
// Returns the amount of space actually used in the output buffer.
|
||||
size_t Q_URLDecode( OUT_CAP(nDecodeDestLen) char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen );
|
||||
|
||||
|
||||
// NOTE: This is for backward compatability!
|
||||
|
||||
@@ -247,15 +247,16 @@ void CUtlBlockMemory<T,I>::ChangeSize( int nBlocks )
|
||||
|
||||
UTLBLOCKMEMORY_TRACK_ALLOC(); // this must stay after the recalculation of m_nBlocks, since it implicitly uses the new value
|
||||
|
||||
// free old blocks if shrinking
|
||||
for ( int i = m_nBlocks; i < nBlocksOld; ++i )
|
||||
{
|
||||
UTLBLOCKMEMORY_TRACK_FREE();
|
||||
free( (void*)m_pMemory[ i ] );
|
||||
}
|
||||
|
||||
if ( m_pMemory )
|
||||
{
|
||||
// free old blocks if shrinking
|
||||
// Only possible if m_pMemory is non-NULL (and avoids PVS-Studio warning)
|
||||
for ( int i = m_nBlocks; i < nBlocksOld; ++i )
|
||||
{
|
||||
UTLBLOCKMEMORY_TRACK_FREE();
|
||||
free( (void*)m_pMemory[ i ] );
|
||||
}
|
||||
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
m_pMemory = (T**)realloc( m_pMemory, m_nBlocks * sizeof(T*) );
|
||||
Assert( m_pMemory );
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//========= Copyright, Valve Corporation, All rights reserved. ================//
|
||||
//
|
||||
// std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef UTLPAIR_H
|
||||
#define UTLPAIR_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
// std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes
|
||||
template<typename T1, typename T2>
|
||||
class CUtlPair
|
||||
{
|
||||
public:
|
||||
CUtlPair() {}
|
||||
CUtlPair( T1 t1, T2 t2 ) : first( t1 ), second( t2 ) {}
|
||||
|
||||
bool operator<( const CUtlPair<T1,T2> &rhs ) const {
|
||||
if ( first != rhs.first )
|
||||
return first < rhs.first;
|
||||
return second < rhs.second;
|
||||
}
|
||||
|
||||
bool operator==( const CUtlPair<T1,T2> &rhs ) const {
|
||||
return first == rhs.first && second == rhs.second;
|
||||
}
|
||||
|
||||
T1 first;
|
||||
T2 second;
|
||||
};
|
||||
|
||||
// utility to make a CUtlPair without having to specify template parameters
|
||||
template<typename T1, typename T2>
|
||||
inline CUtlPair<T1,T2> MakeUtlPair( T1 t1, T2 t2 )
|
||||
{
|
||||
return CUtlPair<T1,T2>(t1, t2);
|
||||
}
|
||||
|
||||
//// HashItem() overload that works automatically with our hash containers
|
||||
//template<typename T1, typename T2>
|
||||
//inline uint32 HashItem( const CUtlPair<T1,T2> &item )
|
||||
//{
|
||||
// return HashItem( (uint64)HashItem( item.first ) + ((uint64)HashItem( item.second ) << 32) );
|
||||
//}
|
||||
|
||||
|
||||
#endif // UTLPAIR_H
|
||||
@@ -332,6 +332,7 @@ public:
|
||||
void Clear() { Set( NULL ); }
|
||||
|
||||
const T *Get() const { return m_pString ? m_pString : StringFuncs<T>::EmptyString(); }
|
||||
operator const T*() const { return m_pString ? m_pString : StringFuncs<T>::EmptyString(); }
|
||||
|
||||
bool IsEmpty() const { return m_pString == NULL; } // Note: empty strings are never stored by Set
|
||||
|
||||
|
||||
@@ -80,6 +80,12 @@ public:
|
||||
int Count() const;
|
||||
int Size() const; // don't use me!
|
||||
|
||||
/// are there no elements? For compatibility with lists.
|
||||
inline bool IsEmpty( void ) const
|
||||
{
|
||||
return ( Count() == 0 );
|
||||
}
|
||||
|
||||
// Is element index valid?
|
||||
bool IsValidIndex( int i ) const;
|
||||
static int InvalidIndex();
|
||||
|
||||
@@ -1,299 +1,299 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// glmgrbasics.h
|
||||
// types, common headers, forward declarations, utilities
|
||||
//
|
||||
//===============================================================================
|
||||
|
||||
#ifndef GLMBASICS_H
|
||||
#define GLMBASICS_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef OSX
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/CGLRenderers.h>
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
#include <OpenGL/CGLProfiler.h>
|
||||
//#include <ApplicationServices/ApplicationServices.h>
|
||||
#elif defined(LINUX)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#include "bitmap/imageformat.h"
|
||||
#include "bitvec.h"
|
||||
#include "tier1/checksum_md5.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "tier1/convar.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "dxabstract_types.h"
|
||||
|
||||
// types
|
||||
struct GLMRect;
|
||||
typedef void *PseudoGLContextPtr;
|
||||
|
||||
|
||||
// 3-d integer box (used for texture lock/unlock etc)
|
||||
struct GLMRegion
|
||||
{
|
||||
int xmin,xmax;
|
||||
int ymin,ymax;
|
||||
int zmin,zmax;
|
||||
};
|
||||
|
||||
struct GLMRect // follows GL convention - if coming from the D3D rect you will need to fiddle the Y's
|
||||
{
|
||||
int xmin; // left
|
||||
int ymin; // bottom
|
||||
int xmax; // right
|
||||
int ymax; // top
|
||||
};
|
||||
|
||||
// macros
|
||||
|
||||
//#define GLMassert(x) assert(x)
|
||||
|
||||
// forward decls
|
||||
class GLMgr; // singleton
|
||||
class GLMContext; // GL context
|
||||
class CGLMContextTester; // testing class
|
||||
class CGLMTex;
|
||||
class CGLMFBO;
|
||||
class CGLMProgram;
|
||||
class CGLMBuffer;
|
||||
|
||||
|
||||
// utilities
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// D3D codes
|
||||
eD3D_DEVTYPE,
|
||||
eD3D_FORMAT,
|
||||
eD3D_RTYPE,
|
||||
eD3D_USAGE,
|
||||
eD3D_RSTATE, // render state
|
||||
eD3D_SIO, // D3D shader bytecode
|
||||
eD3D_VTXDECLUSAGE,
|
||||
|
||||
// CGL codes
|
||||
eCGL_RENDID,
|
||||
|
||||
// OpenGL error codes
|
||||
eGL_ERROR,
|
||||
|
||||
// OpenGL enums
|
||||
eGL_ENUM,
|
||||
eGL_RENDERER
|
||||
|
||||
} GLMThing_t;
|
||||
|
||||
const char* GLMDecode( GLMThing_t type, unsigned long value ); // decode a numeric const
|
||||
const char* GLMDecodeMask( GLMThing_t type, unsigned long value ); // decode a bitmask
|
||||
|
||||
void GLMStop( void ); // aka Debugger()
|
||||
void GLMCheckError( bool noStop = false, bool noLog= false );
|
||||
void GLMEnableTrace( bool on );
|
||||
|
||||
// expose these in release now
|
||||
// Mimic PIX events so we can decorate debug spew
|
||||
void GLMBeginPIXEvent( const char *str );
|
||||
void GLMEndPIXEvent( void );
|
||||
|
||||
//===============================================================================
|
||||
// knob twiddling
|
||||
float GLMKnob( char *knobname, float *setvalue ); // Pass NULL to not-set the knob value
|
||||
float GLMKnobToggle( char *knobname );
|
||||
|
||||
//===============================================================================
|
||||
// other stuff
|
||||
|
||||
// helpers for CGLSetOption - no op if no profiler
|
||||
void GLMProfilerClearTrace( void );
|
||||
void GLMProfilerEnableTrace( bool enable );
|
||||
|
||||
// helpers for CGLSetParameter - no op if no profiler
|
||||
void GLMProfilerDumpState( void );
|
||||
|
||||
|
||||
//===============================================================================
|
||||
// classes
|
||||
|
||||
// helper class making function tracking easier to wire up
|
||||
#if GLMDEBUG
|
||||
class GLMFuncLogger
|
||||
{
|
||||
public:
|
||||
|
||||
// simple function log
|
||||
GLMFuncLogger( const char *funcName )
|
||||
{
|
||||
m_funcName = funcName;
|
||||
m_earlyOut = false;
|
||||
|
||||
GLMPrintf( ">%s", m_funcName );
|
||||
};
|
||||
|
||||
// more advanced version lets you pass args (i.e. called parameters or anything else of interest)
|
||||
// no macro for this one, since no easy way to pass through the args as well as the funcname
|
||||
GLMFuncLogger( const char *funcName, char *fmt, ... )
|
||||
{
|
||||
m_funcName = funcName;
|
||||
m_earlyOut = false;
|
||||
|
||||
// this acts like GLMPrintf here
|
||||
// all the indent policy is down in GLMPrintfVA
|
||||
// which means we need to inject a ">" at the front of the format string to make this work... sigh.
|
||||
|
||||
char modifiedFmt[2000];
|
||||
modifiedFmt[0] = '>';
|
||||
strcpy( modifiedFmt+1, fmt );
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs, fmt);
|
||||
GLMPrintfVA( modifiedFmt, vargs );
|
||||
va_end( vargs );
|
||||
}
|
||||
|
||||
~GLMFuncLogger( )
|
||||
{
|
||||
if (m_earlyOut)
|
||||
{
|
||||
GLMPrintf( "<%s (early out)", m_funcName );
|
||||
}
|
||||
else
|
||||
{
|
||||
GLMPrintf( "<%s", m_funcName );
|
||||
}
|
||||
};
|
||||
|
||||
void EarlyOut( void )
|
||||
{
|
||||
m_earlyOut = true;
|
||||
};
|
||||
|
||||
const char *m_funcName; // set at construction time
|
||||
bool m_earlyOut;
|
||||
};
|
||||
|
||||
// handy macro to go with the function tracking class
|
||||
#define GLM_FUNC GLMFuncLogger _logger_ ( __FUNCTION__ )
|
||||
#else
|
||||
#define GLM_FUNC
|
||||
#endif
|
||||
|
||||
|
||||
// class to keep an in-memory mirror of a file which may be getting edited during run
|
||||
class CGLMFileMirror
|
||||
{
|
||||
public:
|
||||
CGLMFileMirror( char *fullpath ); // just associates mirror with file. if file exists it will be read.
|
||||
//if non existent it will be created with size zero
|
||||
~CGLMFileMirror( );
|
||||
|
||||
bool HasData( void ); // see if data avail
|
||||
void GetData( char **dataPtr, uint *dataSizePtr ); // read it out
|
||||
void SetData( char *data, uint dataSize ); // put data in (and write it to disk)
|
||||
bool PollForChanges( void ); // check disk copy. If different, read it back in and return true.
|
||||
|
||||
void UpdateStatInfo( void ); // make sure stat info is current for our file
|
||||
void ReadFile( void );
|
||||
void WriteFile( void );
|
||||
|
||||
void OpenInEditor( bool foreground=false ); // pass TRUE if you would like the editor to pop to foreground
|
||||
|
||||
/// how about a "wait for change" method..
|
||||
|
||||
char *m_path; // fullpath to file
|
||||
bool m_exists;
|
||||
struct stat m_stat; // stat results for the file (last time checked)
|
||||
|
||||
char *m_data; // content of file
|
||||
uint m_size; // length of content
|
||||
|
||||
};
|
||||
|
||||
// class based on the file mirror, that makes it easy to edit them outside the app.
|
||||
|
||||
// it receives an initial block of text from the engine, and hashes it. ("orig")
|
||||
// it munges it by duplicating all the text after the "!!" line, and appending it in commented form. ("munged")
|
||||
// a mirror file is activated, using a filename based on the hash from the orig text.
|
||||
// if there is already content on disk matching that filename, use that content *unless* the 'blitz' parameter is set.
|
||||
// (i.e. engine is instructing this subsystem to wipe out any old/modified variants of the text)
|
||||
|
||||
|
||||
class CGLMEditableTextItem
|
||||
{
|
||||
public:
|
||||
CGLMEditableTextItem( char *text, uint size, bool forceOverwrite, char *prefix, char *suffix = NULL ); // create a text blob from text source, optional filename suffix
|
||||
~CGLMEditableTextItem( );
|
||||
|
||||
bool HasData( void );
|
||||
bool PollForChanges( void ); // return true if stale i.e. you need to get a new edition
|
||||
void GetCurrentText( char **textOut, uint *sizeOut ); // query for read access to the active blob (could be the original, could be external edited copy)
|
||||
void OpenInEditor( bool foreground=false ); // call user attention to this text
|
||||
|
||||
// internal methods
|
||||
void GenHashOfOrigText( void );
|
||||
void GenBaseNameAndFullPath( char *prefix, char *suffix );
|
||||
void GenMungedText( bool fromMirror );
|
||||
|
||||
// members
|
||||
// orig
|
||||
uint m_origSize;
|
||||
char *m_origText; // what was submitted
|
||||
unsigned char m_origDigest[MD5_DIGEST_LENGTH]; // digest of what was submitted
|
||||
|
||||
// munged
|
||||
uint m_mungedSize;
|
||||
char *m_mungedText; // re-processed edition, initial content submission to the file mirror
|
||||
|
||||
// mirror
|
||||
char *m_mirrorBaseName; // generated from the hash of the orig text, plus the label / prefix
|
||||
char *m_mirrorFullPath; // base name
|
||||
CGLMFileMirror *m_mirror; // file mirror itself. holds "official" copy for GetCurrentText to return.
|
||||
};
|
||||
|
||||
|
||||
// debug font
|
||||
extern unsigned char g_glmDebugFontMap[16384];
|
||||
|
||||
// class for cracking multi-part text blobs
|
||||
// sections are demarcated by beginning-of-line markers submitted in a table by the caller
|
||||
|
||||
struct GLMTextSection
|
||||
{
|
||||
int m_markerIndex; // based on table of markers passed in to constructor
|
||||
uint m_textOffset; // where is the text - offset
|
||||
int m_textLength; // how big is the section
|
||||
};
|
||||
|
||||
class CGLMTextSectioner
|
||||
{
|
||||
public:
|
||||
CGLMTextSectioner( char *text, int textSize, char **markers ); // constructor finds all the sections
|
||||
~CGLMTextSectioner( );
|
||||
|
||||
int Count( void ); // how many sections found
|
||||
void GetSection( int index, uint *offsetOut, uint *lengthOut, int *markerIndexOut );
|
||||
// find section, size, what marker
|
||||
// note that more than one section can be marked similarly.
|
||||
// so policy isn't made here, you walk the sections and decide what to do if there are dupes.
|
||||
|
||||
//members
|
||||
|
||||
//section table
|
||||
CUtlVector< GLMTextSection > m_sectionTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// glmgrbasics.h
|
||||
// types, common headers, forward declarations, utilities
|
||||
//
|
||||
//===============================================================================
|
||||
|
||||
#ifndef GLMBASICS_H
|
||||
#define GLMBASICS_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef OSX
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/CGLRenderers.h>
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
//#include <OpenGL/CGLProfiler.h>
|
||||
//#include <ApplicationServices/ApplicationServices.h>
|
||||
#elif defined(LINUX)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#include "bitmap/imageformat.h"
|
||||
#include "bitvec.h"
|
||||
#include "tier1/checksum_md5.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "tier1/convar.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "dxabstract_types.h"
|
||||
|
||||
// types
|
||||
struct GLMRect;
|
||||
typedef void *PseudoGLContextPtr;
|
||||
|
||||
|
||||
// 3-d integer box (used for texture lock/unlock etc)
|
||||
struct GLMRegion
|
||||
{
|
||||
int xmin,xmax;
|
||||
int ymin,ymax;
|
||||
int zmin,zmax;
|
||||
};
|
||||
|
||||
struct GLMRect // follows GL convention - if coming from the D3D rect you will need to fiddle the Y's
|
||||
{
|
||||
int xmin; // left
|
||||
int ymin; // bottom
|
||||
int xmax; // right
|
||||
int ymax; // top
|
||||
};
|
||||
|
||||
// macros
|
||||
|
||||
//#define GLMassert(x) assert(x)
|
||||
|
||||
// forward decls
|
||||
class GLMgr; // singleton
|
||||
class GLMContext; // GL context
|
||||
class CGLMContextTester; // testing class
|
||||
class CGLMTex;
|
||||
class CGLMFBO;
|
||||
class CGLMProgram;
|
||||
class CGLMBuffer;
|
||||
|
||||
|
||||
// utilities
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// D3D codes
|
||||
eD3D_DEVTYPE,
|
||||
eD3D_FORMAT,
|
||||
eD3D_RTYPE,
|
||||
eD3D_USAGE,
|
||||
eD3D_RSTATE, // render state
|
||||
eD3D_SIO, // D3D shader bytecode
|
||||
eD3D_VTXDECLUSAGE,
|
||||
|
||||
// CGL codes
|
||||
eCGL_RENDID,
|
||||
|
||||
// OpenGL error codes
|
||||
eGL_ERROR,
|
||||
|
||||
// OpenGL enums
|
||||
eGL_ENUM,
|
||||
eGL_RENDERER
|
||||
|
||||
} GLMThing_t;
|
||||
|
||||
const char* GLMDecode( GLMThing_t type, unsigned long value ); // decode a numeric const
|
||||
const char* GLMDecodeMask( GLMThing_t type, unsigned long value ); // decode a bitmask
|
||||
|
||||
void GLMStop( void ); // aka Debugger()
|
||||
void GLMCheckError( bool noStop = false, bool noLog= false );
|
||||
void GLMEnableTrace( bool on );
|
||||
|
||||
// expose these in release now
|
||||
// Mimic PIX events so we can decorate debug spew
|
||||
void GLMBeginPIXEvent( const char *str );
|
||||
void GLMEndPIXEvent( void );
|
||||
|
||||
//===============================================================================
|
||||
// knob twiddling
|
||||
//float GLMKnob( char *knobname, float *setvalue ); // Pass NULL to not-set the knob value
|
||||
//float GLMKnobToggle( char *knobname );
|
||||
|
||||
//===============================================================================
|
||||
// other stuff
|
||||
|
||||
// helpers for CGLSetOption - no op if no profiler
|
||||
void GLMProfilerClearTrace( void );
|
||||
void GLMProfilerEnableTrace( bool enable );
|
||||
|
||||
// helpers for CGLSetParameter - no op if no profiler
|
||||
void GLMProfilerDumpState( void );
|
||||
|
||||
|
||||
//===============================================================================
|
||||
// classes
|
||||
|
||||
// helper class making function tracking easier to wire up
|
||||
#if GLMDEBUG
|
||||
class GLMFuncLogger
|
||||
{
|
||||
public:
|
||||
|
||||
// simple function log
|
||||
GLMFuncLogger( const char *funcName )
|
||||
{
|
||||
m_funcName = funcName;
|
||||
m_earlyOut = false;
|
||||
|
||||
GLMPrintf( ">%s", m_funcName );
|
||||
};
|
||||
|
||||
// more advanced version lets you pass args (i.e. called parameters or anything else of interest)
|
||||
// no macro for this one, since no easy way to pass through the args as well as the funcname
|
||||
GLMFuncLogger( const char *funcName, char *fmt, ... )
|
||||
{
|
||||
m_funcName = funcName;
|
||||
m_earlyOut = false;
|
||||
|
||||
// this acts like GLMPrintf here
|
||||
// all the indent policy is down in GLMPrintfVA
|
||||
// which means we need to inject a ">" at the front of the format string to make this work... sigh.
|
||||
|
||||
char modifiedFmt[2000];
|
||||
modifiedFmt[0] = '>';
|
||||
strcpy( modifiedFmt+1, fmt );
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs, fmt);
|
||||
GLMPrintfVA( modifiedFmt, vargs );
|
||||
va_end( vargs );
|
||||
}
|
||||
|
||||
~GLMFuncLogger( )
|
||||
{
|
||||
if (m_earlyOut)
|
||||
{
|
||||
GLMPrintf( "<%s (early out)", m_funcName );
|
||||
}
|
||||
else
|
||||
{
|
||||
GLMPrintf( "<%s", m_funcName );
|
||||
}
|
||||
};
|
||||
|
||||
void EarlyOut( void )
|
||||
{
|
||||
m_earlyOut = true;
|
||||
};
|
||||
|
||||
const char *m_funcName; // set at construction time
|
||||
bool m_earlyOut;
|
||||
};
|
||||
|
||||
// handy macro to go with the function tracking class
|
||||
#define GLM_FUNC GLMFuncLogger _logger_ ( __FUNCTION__ )
|
||||
#else
|
||||
#define GLM_FUNC
|
||||
#endif
|
||||
|
||||
|
||||
// class to keep an in-memory mirror of a file which may be getting edited during run
|
||||
class CGLMFileMirror
|
||||
{
|
||||
public:
|
||||
CGLMFileMirror( char *fullpath ); // just associates mirror with file. if file exists it will be read.
|
||||
//if non existent it will be created with size zero
|
||||
~CGLMFileMirror( );
|
||||
|
||||
bool HasData( void ); // see if data avail
|
||||
void GetData( char **dataPtr, uint *dataSizePtr ); // read it out
|
||||
void SetData( char *data, uint dataSize ); // put data in (and write it to disk)
|
||||
bool PollForChanges( void ); // check disk copy. If different, read it back in and return true.
|
||||
|
||||
void UpdateStatInfo( void ); // make sure stat info is current for our file
|
||||
void ReadFile( void );
|
||||
void WriteFile( void );
|
||||
|
||||
void OpenInEditor( bool foreground=false ); // pass TRUE if you would like the editor to pop to foreground
|
||||
|
||||
/// how about a "wait for change" method..
|
||||
|
||||
char *m_path; // fullpath to file
|
||||
bool m_exists;
|
||||
struct stat m_stat; // stat results for the file (last time checked)
|
||||
|
||||
char *m_data; // content of file
|
||||
uint m_size; // length of content
|
||||
|
||||
};
|
||||
|
||||
// class based on the file mirror, that makes it easy to edit them outside the app.
|
||||
|
||||
// it receives an initial block of text from the engine, and hashes it. ("orig")
|
||||
// it munges it by duplicating all the text after the "!!" line, and appending it in commented form. ("munged")
|
||||
// a mirror file is activated, using a filename based on the hash from the orig text.
|
||||
// if there is already content on disk matching that filename, use that content *unless* the 'blitz' parameter is set.
|
||||
// (i.e. engine is instructing this subsystem to wipe out any old/modified variants of the text)
|
||||
|
||||
|
||||
class CGLMEditableTextItem
|
||||
{
|
||||
public:
|
||||
CGLMEditableTextItem( char *text, uint size, bool forceOverwrite, char *prefix, char *suffix = NULL ); // create a text blob from text source, optional filename suffix
|
||||
~CGLMEditableTextItem( );
|
||||
|
||||
bool HasData( void );
|
||||
bool PollForChanges( void ); // return true if stale i.e. you need to get a new edition
|
||||
void GetCurrentText( char **textOut, uint *sizeOut ); // query for read access to the active blob (could be the original, could be external edited copy)
|
||||
void OpenInEditor( bool foreground=false ); // call user attention to this text
|
||||
|
||||
// internal methods
|
||||
void GenHashOfOrigText( void );
|
||||
void GenBaseNameAndFullPath( char *prefix, char *suffix );
|
||||
void GenMungedText( bool fromMirror );
|
||||
|
||||
// members
|
||||
// orig
|
||||
uint m_origSize;
|
||||
char *m_origText; // what was submitted
|
||||
unsigned char m_origDigest[MD5_DIGEST_LENGTH]; // digest of what was submitted
|
||||
|
||||
// munged
|
||||
uint m_mungedSize;
|
||||
char *m_mungedText; // re-processed edition, initial content submission to the file mirror
|
||||
|
||||
// mirror
|
||||
char *m_mirrorBaseName; // generated from the hash of the orig text, plus the label / prefix
|
||||
char *m_mirrorFullPath; // base name
|
||||
CGLMFileMirror *m_mirror; // file mirror itself. holds "official" copy for GetCurrentText to return.
|
||||
};
|
||||
|
||||
|
||||
// debug font
|
||||
extern unsigned char g_glmDebugFontMap[16384];
|
||||
|
||||
// class for cracking multi-part text blobs
|
||||
// sections are demarcated by beginning-of-line markers submitted in a table by the caller
|
||||
|
||||
struct GLMTextSection
|
||||
{
|
||||
int m_markerIndex; // based on table of markers passed in to constructor
|
||||
uint m_textOffset; // where is the text - offset
|
||||
int m_textLength; // how big is the section
|
||||
};
|
||||
|
||||
class CGLMTextSectioner
|
||||
{
|
||||
public:
|
||||
CGLMTextSectioner( char *text, int textSize, char **markers ); // constructor finds all the sections
|
||||
~CGLMTextSectioner( );
|
||||
|
||||
int Count( void ); // how many sections found
|
||||
void GetSection( int index, uint *offsetOut, uint *lengthOut, int *markerIndexOut );
|
||||
// find section, size, what marker
|
||||
// note that more than one section can be marked similarly.
|
||||
// so policy isn't made here, you walk the sections and decide what to do if there are dupes.
|
||||
|
||||
//members
|
||||
|
||||
//section table
|
||||
CUtlVector< GLMTextSection > m_sectionTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -387,7 +387,7 @@ public:
|
||||
virtual IHTMLChromeController *AccessChromeHTMLController() = 0;
|
||||
|
||||
// the origin of the viewport on the framebuffer (Which might not be 0,0 for stereo)
|
||||
virtual void SetFullscreenViewportAndRenderTarget( int x, int y, int w, int h, ITexture *pRenderTarget ) = 0;
|
||||
virtual void SetFullscreenViewport( int x, int y, int w, int h ) = 0; // this uses NULL for the render target.
|
||||
virtual void GetFullscreenViewport( int & x, int & y, int & w, int & h ) = 0;
|
||||
virtual void PushFullscreenViewport() = 0;
|
||||
virtual void PopFullscreenViewport() = 0;
|
||||
|
||||
@@ -99,6 +99,9 @@ public:
|
||||
// enables VR mode
|
||||
virtual void SetVRMode( bool bVRMode ) = 0;
|
||||
virtual bool GetVRMode() = 0;
|
||||
|
||||
// add a tick signal like above, but to the head of the list of tick signals
|
||||
virtual void AddTickSignalToHead( VPANEL panel, int intervalMilliseconds = 0 ) = 0;
|
||||
};
|
||||
|
||||
#define VGUI_IVGUI_INTERFACE_VERSION "VGUI_ivgui008"
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace vgui
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: A list of variable height child panels
|
||||
// each list item consists of a label-panel pair. Height of the item is
|
||||
// determined from the lable.
|
||||
// each list item consists of a label-panel pair. Height of the item is
|
||||
// determined from the label.
|
||||
//-----------------------------------------------------------------------------
|
||||
class PanelListPanel : public EditablePanel
|
||||
{
|
||||
@@ -83,6 +83,8 @@ public:
|
||||
return &m_SortedItems;
|
||||
}
|
||||
|
||||
int ComputeVPixelsNeeded();
|
||||
|
||||
protected:
|
||||
// overrides
|
||||
virtual void OnSizeChanged(int wide, int tall);
|
||||
@@ -92,7 +94,7 @@ protected:
|
||||
virtual void OnMouseWheeled(int delta);
|
||||
|
||||
private:
|
||||
int ComputeVPixelsNeeded();
|
||||
|
||||
|
||||
enum { DEFAULT_HEIGHT = 24, PANELBUFFER = 5 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user