Add files via upload

This commit is contained in:
0TheSpy
2022-11-12 14:43:02 +03:00
committed by GitHub
parent f2a6cb14d4
commit 1b58b8e3e6
65 changed files with 12570 additions and 180 deletions

View File

@ -23,10 +23,11 @@ public:
virtual void UpdateProgressBar(float, char const*, bool) = 0;
virtual void SetShowProgressText(bool) = 0;
virtual void UpdateSecondaryProgressBar(float, wchar_t const*) = 0;
virtual void SetProgressLevelName(char const*) = 0;
virtual void SetProgressLevelName(char const*) = 0;
virtual void ShowMessageDialog(unsigned int, IPanel*) = 0;
virtual void ShowMessageDialog(char const*, char const*) = 0;
virtual void CreateCommandMsgBox(char const*, char const*, bool, bool, char const*, char const*, char const*, char const*, char const*) = 0;
//virtual void CreateCommandMsgBox(char const*, char const*, bool, bool, char const*, char const*, char const*, char const*) = 0;
virtual void CreateCommandMsgBoxInSlot(ECommandMsgBoxSlot, char const*, char const*, bool, bool, char const*, char const*, char const*, char const*) = 0;
virtual void SetLoadingBackgroundDialog(unsigned long long) = 0;
virtual void OnConnectToServer2(char const*, int, int, int) = 0;
@ -44,5 +45,6 @@ public:
virtual void StopProgressBar(bool, char const*, char const*) = 0;
virtual void SetProgressBarStatusText(char const*, bool) = 0;
virtual void SetSecondaryProgressBar(float) = 0;
virtual void SetSecondaryProgressBarText(wchar_t const*) = 0;
virtual void SetSecondaryProgressBarText(wchar_t const*) = 0;
};

View File

@ -24,6 +24,8 @@ namespace vgui
virtual void LoadControlSettings(const char* dialogResourceName, const char* pathID = NULL, KeyValues* pPreloadedKeyValues = NULL, KeyValues* pConditions = NULL);
virtual void ApplySettings(KeyValues* inResourceData);
virtual void PerformLayout();
virtual void LoadUserConfig(const char* configName, int dialogID = 0);
virtual void SaveUserConfig();

View File

@ -0,0 +1,193 @@
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: Declaration of FileOpenDialog class, a generic open/save as file dialog
//
// $NoKeywords: $
//===========================================================================//
#ifndef FILEOPENDIALOG_H
#define FILEOPENDIALOG_H
#ifdef _WIN32
#pragma once
#endif
#include "Frame.h"
namespace vgui
{
class FileCompletionEdit; // local
class InputDialog;
//-----------------------------------------------------------------------------
// Purpose: generic open/save as file dialog, by default deletes itself on close
//-----------------------------------------------------------------------------
enum FileOpenDialogType_t
{
FOD_SAVE = 0,
FOD_OPEN,
FOD_SELECT_DIRECTORY,
};
struct FileData_t
{
CUtlString m_FileAttributes;
CUtlString m_CreationTime;
int64 m_nCreationTime;
CUtlString m_LastAccessTime;
CUtlString m_LastWriteTime;
int64 m_nLastWriteTime;
int64 m_nFileSize;
CUtlString m_FileName;
CUtlString m_FullPath;
wchar_t m_FileType[ 80 ];
bool m_bDirectory;
void PrepareKV( KeyValues *kv );
};
class FileOpenDialog : public vgui::Frame
{
DECLARE_CLASS_SIMPLE( FileOpenDialog, Frame );
public:
// NOTE: Backward compat constructor
FileOpenDialog( Panel *parent, const char *title, bool bOpenFile, KeyValues *pContextKeyValues = 0 );
// The context keyvalues are added to all messages sent by this dialog if they are specified
FileOpenDialog( Panel *parent, const char *title, FileOpenDialogType_t type, KeyValues *pContextKeyValues = 0 );
~FileOpenDialog();
// Set the directory the file search starts in
void SetStartDirectory(const char *dir);
// Sets the start directory context (and resets the start directory in the process)
// NOTE: If you specify a startdir context, then if you've already opened
// a file with that same start dir context before, it will start in the
// same directory it ended up in.
void SetStartDirectoryContext( const char *pContext, const char *pDefaultDir );
// Add filters for the drop down combo box
// The filter info, if specified, gets sent back to the app in the FileSelected message
void AddFilter( const char *filter, const char *filterName, bool bActive, const char *pFilterInfo = NULL );
// Activate the dialog
// NOTE: The argument is there for backward compat
void DoModal( bool bUnused = false );
// Get the directory this is currently in
void GetCurrentDirectory( char *buf, int bufSize );
// Get the last selected file name
void GetSelectedFileName( char *buf, int bufSize );
/*
messages sent:
"FileSelected"
"fullpath" // specifies the fullpath of the file
"filterinfo" // Returns the filter info associated with the active filter
"FileSelectionCancelled"
*/
static bool FileNameWildCardMatch( char const *pchFileName, char const *pchPattern );
protected:
virtual void OnCommand( const char *command );
virtual void ApplySchemeSettings(IScheme *pScheme);
virtual void OnClose();
virtual void OnKeyCodeTyped(KeyCode code);
// handles the open button being pressed
// checks on what has changed and acts accordingly
MESSAGE_FUNC( OnOpen, "OnOpen" );
MESSAGE_FUNC( OnSelectFolder, "SelectFolder" );
MESSAGE_FUNC( OnFolderUp, "OnFolderUp" );
MESSAGE_FUNC( OnNewFolder, "OnNewFolder" );
MESSAGE_FUNC( OnOpenInExplorer, "OpenInExplorer" );
MESSAGE_FUNC( PopulateFileList, "PopulateFileList" );
MESSAGE_FUNC( PopulateDriveList, "PopulateDriveList" );
MESSAGE_FUNC( PopulateFileNameSearchHistory, "PopulateFileNameSearchHistory" );
// moves the directory structure up
virtual void MoveUpFolder();
// validates that the current path is valid
virtual void ValidatePath();
// handles an item in the list being selected
MESSAGE_FUNC( OnItemSelected, "ItemSelected" );
MESSAGE_FUNC( OnListItemSelected, "ListItemSelected" )
{
OnItemSelected();
}
// changes directories in response to selecting drives from the combo box
MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv );
MESSAGE_FUNC( OnInputCanceled, "InputCanceled" );
MESSAGE_FUNC_PARAMS( OnInputCompleted, "InputCompleted", data );
MESSAGE_FUNC( OnMatchStringSelected, "OnMatchStringSelected" );
private:
// Necessary because we have 2 constructors
void Init( const char *title, KeyValues *pContextKeyValues );
// Does the specified extension match something in the filter list?
bool ExtensionMatchesFilter( const char *pExt );
// Choose the first non *.* filter in the filter list
void ChooseExtension( char *pExt, int nBufLen );
// Saves the file to the start dir context
void SaveFileToStartDirContext( const char *pFullPath );
// Posts a file selected message
void PostFileSelectedMessage( const char *pFileName );
// Creates a new folder
void NewFolder( char const *folderName );
void BuildFileList();
void FilterFileList();
bool PassesFilter( FileData_t *fd );
int CountSubstringMatches();
void AddSearchHistoryString( char const *str );
vgui::ComboBox *m_pFullPathEdit;
vgui::ListPanel *m_pFileList;
vgui::ComboBox *m_pFileNameCombo;
vgui::ComboBox *m_pFileTypeCombo;
vgui::Button *m_pOpenButton;
vgui::Button *m_pCancelButton;
vgui::Button *m_pFolderUpButton;
vgui::Button *m_pNewFolderButton;
vgui::Button *m_pOpenInExplorerButton;
vgui::Label *m_pFileTypeLabel;
KeyValues *m_pContextKeyValues;
char m_szLastPath[1024];
unsigned short m_nStartDirContext;
FileOpenDialogType_t m_DialogType;
bool m_bFileSelected : 1;
VPANEL m_SaveModal;
vgui::DHANDLE< vgui::InputDialog > m_hInputDialog;
CUtlVector< FileData_t > m_Files;
CUtlVector< FileData_t * > m_Filtered;
CUtlVector< CUtlString > m_SearchHistory;
CUtlString m_CurrentSubstringFilter;
};
} // namespace vgui
#endif // FILEOPENDIALOG_H

View File

@ -32,6 +32,18 @@ public:
gameeventmanager->AddListener(this, name, bServerSide);
}
void ListenForAllGameEvents()
{
#ifdef CLIENT_DLL
bool bServerSide = false;
#else
bool bServerSide = true;
#endif
gameeventmanager->AddListenerGlobal(this, bServerSide);
}
void StopListeningForAllEvents()
{
if (m_bRegisteredForEvents)
@ -43,6 +55,8 @@ public:
}
virtual void FireGameEvent(IGameEvent* event) = 0;
int m_nDebugID;
virtual int GetEventDebugID(void);
private:

View File

@ -16,6 +16,8 @@
class SVC_GameEventList;
class CLC_ListenEvents;
//#include "netmessages.h"
class CGameEventCallback
{
public:

331
SpyCustom/sdk/HTML.h Normal file
View File

@ -0,0 +1,331 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Creates a HTML control
//
// $NoKeywords: $
//=============================================================================//
#ifndef HTML_H
#define HTML_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui.h"
#include "IImage.h"
#include "Panel.h"
#include "PHandle.h"
#include "FileOpenDialog.h"
#include "TextEntry.h"
#ifndef VERSION_SAFE_STEAM_API_INTERFACES
#define VERSION_SAFE_STEAM_API_INTERFACES
#endif
#include "steam_api.h"
#include "utlmap.h"
namespace vgui
{
//-----------------------------------------------------------------------------
// Purpose: Control to display HTML content
// This control utilises a hidden IE window to render a HTML page for you.
// It can load any valid URL (i.e local files or web pages), you cannot dynamically change the
// content however (internally to the control that is).
//-----------------------------------------------------------------------------
class HTML: public Panel
{
DECLARE_CLASS_SIMPLE( HTML, Panel );
// TODO::STYLE
//DECLARE_STYLE_BASE( "HTML" );
public:
HTML( Panel *parent,const char *name, bool allowJavaScript = false, bool bPopupWindow = false, HHTMLBrowser unBrowserHandleToDelete = INVALID_HTMLBROWSER );
~HTML();
// IHTML pass through functions
virtual void OpenURL( const char *URL, const char *pchPostData );
virtual bool StopLoading();
virtual bool Refresh();
virtual void OnMove();
virtual void RunJavascript( const char *pchScript );
virtual void GoBack();
virtual void GoForward();
virtual bool BCanGoBack();
virtual bool BCanGoFoward();
// event functions you can override and specialize behavior of
virtual bool OnStartRequest( const char *url, const char *target, const char *pchPostData, bool bIsRedirect );
virtual void OnFinishRequest(const char *url, const char *pageTitle ) {}
virtual void OnSetHTMLTitle( const char *pchTitle ) {}
virtual void OnLinkAtPosition( const char *pchURL ) {}
virtual void OnURLChanged( const char *url, const char *pchPostData, bool bIsRedirect ) {}
virtual bool OnOpenNewTab( const char *pchURL, bool bForeground ) { return false; }
// configuration
virtual void SetScrollbarsEnabled(bool state);
virtual void SetContextMenuEnabled(bool state);
virtual void SetViewSourceEnabled( bool state );
virtual void NewWindowsOnly( bool state );
bool IsScrolledToBottom();
bool IsScrollbarVisible();
// url handlers, lets you have web page links fire vgui events
// use to have custom web page links, eg. "steam://open/subscriptionpage"
// message contains "CustomURL", "url"
virtual void AddCustomURLHandler(const char *customProtocolName, vgui::Panel *target);
// overridden to paint our special web browser texture
virtual void Paint();
// pass messages to the texture component to tell it about resizes
virtual void OnSizeChanged(int wide,int tall);
// pass mouse clicks through
virtual void OnMousePressed(MouseCode code);
virtual void OnMouseReleased(MouseCode code);
virtual void OnCursorMoved(int x,int y);
virtual void OnMouseDoublePressed(MouseCode code);
virtual void OnKeyTyped(wchar_t unichar);
virtual void OnKeyCodeTyped(KeyCode code);
virtual void OnKeyCodeReleased(KeyCode code);
virtual void PerformLayout();
virtual void OnMouseWheeled(int delta);
virtual void PostChildPaint();
/* message posting:
"HTMLSliderMoved" - indicates the scrollbar has moved
"OnURLChanged" - indicates a new URL is being loaded
"url"
"postdata"
"OnFinishRequest" - indicates all url loaded has completed
"HTMLBackRequested" - mouse4 has been pressed on the dialog
"HTMLForwardRequested" - mouse5 has been pressed on the dialog
"SecurityStatus" - indicates the SSL status of the page (disabled,good,bad)
"url"
"secure" - true if an ssl page
"certerror" - true if there is a cert error loading the page
"isevcert" - true if this is an EV style cert
"certname" - name of the entity this cert is issued to
*/
MESSAGE_FUNC_INT( OnSetCursorVGUI, "SetCursor", cursor );
virtual void OnCommand( const char *pchCommand );
void AddHeader( const char *pchHeader, const char *pchValue );
void OnKillFocus();
void OnSetFocus();
void Find( const char *pchSubStr );
void StopFind();
void FindNext();
void FindPrevious();
void ShowFindDialog();
void HideFindDialog();
bool FindDialogVisible();
int HorizontalScrollMax() { return m_scrollHorizontal.m_nMax; }
int VerticalScrollMax() { return m_scrollVertical.m_nMax; }
void GetLinkAtPosition( int x, int y );
#ifdef DBGFLAG_VALIDATE
virtual void Validate( CValidator &validator, const char *pchName )
{
ValidateObj( m_CustomURLHandlers );
BaseClass::Validate( validator, pchName );
}
#endif // DBGFLAG_VALIDATE
void PaintComboBox();
int BrowserGetIndex() { return m_iBrowser; }
protected:
virtual void ApplySchemeSettings( IScheme *pScheme );
friend class HTMLComboBoxHost;
vgui::Menu *m_pContextMenu;
private:
// IHTMLResponses callbacks from the browser engine
ISteamHTMLSurface *SteamHTMLSurface() { return m_SteamAPIContext.SteamHTMLSurface(); }
STEAM_CALLBACK( HTML, BrowserNeedsPaint, HTML_NeedsPaint_t, m_NeedsPaint );
STEAM_CALLBACK( HTML, BrowserStartRequest, HTML_StartRequest_t, m_StartRequest );
STEAM_CALLBACK( HTML, BrowserURLChanged, HTML_URLChanged_t, m_URLChanged );
STEAM_CALLBACK( HTML, BrowserFinishedRequest, HTML_FinishedRequest_t, m_FinishedRequest );
STEAM_CALLBACK( HTML, BrowserHorizontalScrollBarSizeResponse, HTML_HorizontalScroll_t, m_HorizScroll );
STEAM_CALLBACK( HTML, BrowserVerticalScrollBarSizeResponse, HTML_VerticalScroll_t, m_VertScroll );
STEAM_CALLBACK( HTML, BrowserCanGoBackandForward, HTML_CanGoBackAndForward_t, m_CanGoBackForward );
STEAM_CALLBACK( HTML, BrowserSetCursor, HTML_SetCursor_t, m_SetCursor );
STEAM_CALLBACK( HTML, BrowserClose, HTML_CloseBrowser_t, m_Close );
STEAM_CALLBACK( HTML, BrowserFileOpenDialog, HTML_FileOpenDialog_t, m_FileOpenDialog );
STEAM_CALLBACK( HTML, BrowserShowToolTip, HTML_ShowToolTip_t, m_ShowToolTip );
STEAM_CALLBACK( HTML, BrowserUpdateToolTip, HTML_UpdateToolTip_t, m_UpdateToolTip );
STEAM_CALLBACK( HTML, BrowserHideToolTip, HTML_HideToolTip_t, m_HideToolTip );
STEAM_CALLBACK( HTML, BrowserSearchResults, HTML_SearchResults_t, m_SearchResults );
STEAM_CALLBACK( HTML, BrowserLinkAtPositionResponse, HTML_LinkAtPosition_t, m_LinkAtPositionResponse );
STEAM_CALLBACK( HTML, BrowserJSAlert, HTML_JSAlert_t, m_JSAlert );
STEAM_CALLBACK( HTML, BrowserJSConfirm, HTML_JSConfirm_t, m_JSConfirm );
STEAM_CALLBACK( HTML, BrowserPopupHTMLWindow, HTML_NewWindow_t, m_NewWindow );
void OnBrowserReady(HTML_BrowserReady_t *pBrowserReady, bool bIOFailure);
void PostURL( const char *URL, const char *pchPostData );
virtual void BrowserResize();
virtual void CalcScrollBars(int w,int h);
void UpdateSizeAndScrollBars();
MESSAGE_FUNC( OnSliderMoved, "ScrollBarSliderMoved" );
MESSAGE_FUNC_CHARPTR( OnFileSelected, "FileSelected", fullpath );
MESSAGE_FUNC( OnFileSelectionCancelled, "FileSelectionCancelled" );
MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
MESSAGE_FUNC_PTR( OnEditNewLine, "TextNewLine", panel );
int ConvertMouseCodeToCEFCode( MouseCode code );
int TranslateKeyModifiers();
vgui::Panel *m_pInteriorPanel;
vgui::ScrollBar *_hbar,*_vbar;
vgui::DHANDLE<vgui::FileOpenDialog> m_hFileOpenDialog;
class CHTMLFindBar : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CHTMLFindBar, EditablePanel );
public:
CHTMLFindBar( HTML *parent );
void SetText( const char *pchText ) { m_pFindBar->SetText( pchText ); }
void GetText( char *pText, int ccText ) { m_pFindBar->GetText( pText, ccText ); }
void OnCommand( const char *pchCmd );
void ShowCountLabel() { m_pFindCountLabel->SetVisible( true ); }
void HideCountLabel() { m_pFindCountLabel->SetVisible( false ); }
void SetHidden( bool bState ) { m_bHidden = bState; }
bool BIsHidden() { return m_bHidden; }
private:
vgui::TextEntry *m_pFindBar;
vgui::HTML *m_pParent;
vgui::Label *m_pFindCountLabel;
bool m_bHidden;
};
CHTMLFindBar *m_pFindBar;
int m_iMouseX,m_iMouseY; // where the mouse is on the control
int m_iScrollBorderX,m_iScrollBorderY;
int m_iWideLastHTMLSize, m_iTalLastHTMLSize;
int m_iCopyLinkMenuItemID;
bool m_bScrollBarEnabled;
bool m_bContextMenuEnabled;
int m_iScrollbarSize;
bool m_bNewWindowsOnly;
int m_nViewSourceAllowedIndex;
CUtlString m_sDragURL;
int m_iDragStartX, m_iDragStartY;
struct CustomURLHandler_t
{
PHandle hPanel;
char url[32];
};
CUtlVector<CustomURLHandler_t> m_CustomURLHandlers;
int m_iBrowser; // our browser handle
int m_iHTMLTextureID; // vgui texture id
// Track the texture width and height requested so we can tell
// when the size has changed and reallocate the texture.
int m_allocedTextureWidth;
int m_allocedTextureHeight;
int m_iComboBoxTextureID; // vgui texture id of the combo box
int m_allocedComboBoxWidth;
int m_allocedComboBoxHeight;
CUtlString m_sCurrentURL; // the url of our current page
// find in page state
bool m_bInFind;
CUtlString m_sLastSearchString;
bool m_bCanGoBack; // cache of forward and back state
bool m_bCanGoForward;
struct LinkAtPos_t
{
LinkAtPos_t() { m_nX = m_nY = 0; }
uint32 m_nX;
uint32 m_nY;
CUtlString m_sURL;
};
LinkAtPos_t m_LinkAtPos; // cache for link at pos requests, because the request is async
bool m_bRequestingDragURL; // true if we need a response for a drag url loc
bool m_bRequestingCopyLink; // true if we wanted to copy the link under the cursor
struct ScrollData_t
{
ScrollData_t()
{
m_bVisible = false;
m_nX = m_nY = m_nWide = m_nTall = m_nMax = m_nScroll = 0;
}
bool operator==( ScrollData_t const &src ) const
{
return m_bVisible == src.m_bVisible &&
m_nX == src.m_nX &&
m_nY == src.m_nY &&
m_nWide == src.m_nWide &&
m_nTall == src.m_nTall &&
m_nMax == src.m_nMax &&
m_nScroll == src.m_nScroll;
}
bool operator!=( ScrollData_t const &src ) const
{
return !operator==(src);
}
bool m_bVisible; // is the scroll bar visible
int m_nX; /// where cef put the scroll bar
int m_nY;
int m_nWide;
int m_nTall; // how many pixels of scroll in the current scroll knob
int m_nMax; // most amount of pixels we can scroll
int m_nScroll; // currently scrolled amount of pixels
float m_flZoom; // zoom level this scroll bar is for
};
ScrollData_t m_scrollHorizontal; // details of horizontal scroll bar
ScrollData_t m_scrollVertical; // details of vertical scroll bar
float m_flZoom; // current page zoom level
CUtlString m_sPendingURLLoad; // cache of url to load if we get a PostURL before the cef object is mage
CUtlString m_sPendingPostData; // cache of the post data for above
struct CustomCursorCache_t
{
CustomCursorCache_t() {}
CustomCursorCache_t( const void *pchData ) { m_pchData = pchData; }
float m_CacheTime; // the time we cached the cursor
CursorCode m_Cursor; // the vgui handle to it
const void *m_pchData; // the pointer to the cursor char data so we can detect the same cursor being used
bool operator==(const CustomCursorCache_t& rhs) const
{
return m_pchData == rhs.m_pchData ;
}
};
CUtlVector<CustomCursorCache_t> m_vecHCursor;
public:
CSteamAPIContext m_SteamAPIContext;
HHTMLBrowser m_unBrowserHandle;
HHTMLBrowser m_unBrowserHandleToDelete; // Keep track of the browser to delete, cf comments in BrowserPopupHTMLWindow
bool m_bPopupWindow;
CCallResult< HTML, HTML_BrowserReady_t > m_SteamCallResultBrowserReady;
};
} // namespace vgui
#endif // HTML_H

View File

@ -33,6 +33,9 @@
#endif
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CUtlBuffer;
struct DmxElementUnpackStructure_t;
@ -46,6 +49,11 @@ namespace vgui
#if defined( VGUI_USEKEYBINDINGMAPS )
struct PanelKeyBindingMap;
#endif
//-----------------------------------------------------------------------------
// Purpose: Helper functions to construct vgui panels
//
// SETUP_PANEL - will make a panel ready for use right now (i.e setup its colors, borders, fonts, etc)
//
template< class T >
inline T* SETUP_PANEL(T* panel)
{
@ -53,8 +61,16 @@ namespace vgui
return panel;
}
//
// CREATE_PANEL - creates a panel that is ready to use right now
//
// example of use = to set the FG Color of a panel inside of a constructor (i.e before ApplySchemeSettings() has been run on the child)
//
#define CREATE_PANEL(type, parent, name) (SETUP_PANEL(new type(parent, name)))
//-----------------------------------------------------------------------------
// Purpose: Drag/drop support context info (could defined within Panel...)
//-----------------------------------------------------------------------------
#if defined( VGUI_USEDRAGDROP )
struct DragDrop_t;
class Menu;
@ -83,6 +99,7 @@ namespace vgui
SizerAddArgs_t& MinX(int nMinX) { m_nMinX = nMinX; return *this; }
SizerAddArgs_t& MinY(int nMinY) { m_nMinY = nMinY; return *this; }
// IgnoreMemberMin --> MinX and MinY (when set) are the only criteria for minimum size; member-requested min size is ignored
SizerAddArgs_t& IgnoreMemberMin(bool bIgnoreMemberMin = true) { m_bIgnoreMemberMin = bIgnoreMemberMin; return *this; }
SizerAddArgs_t& FixedSize(int nX, int nY)
@ -105,8 +122,8 @@ namespace vgui
enum SizerLayoutDirection_t
{
ESLD_HORIZONTAL,
ESLD_VERTICAL
ESLD_HORIZONTAL, // major axis = X
ESLD_VERTICAL // major axis = Y
};
enum SizerElementType_t
@ -128,6 +145,9 @@ namespace vgui
void SetElementArgs(int nIndex, const SizerAddArgs_t& args) { m_Members[nIndex].Fill(args); }
// The containing panel's layout should be invalidated if members are added to this sizer.
// Inserts a panel/sizer/spacer at the specified index and shifts remaining elements down
void InsertPanel(int nIndex, Panel* pPanel, const SizerAddArgs_t& args);
void InsertSizer(int nIndex, CSizerBase* pSizer, const SizerAddArgs_t& args);
void InsertSpacer(int nIndex, const SizerAddArgs_t& args);
@ -141,6 +161,7 @@ namespace vgui
void GetMinSize(int& OutX, int& OutY);
// Called by Panel on PerformLayout() so that sizer client size computations are up-to-date
void RecursiveInvalidateCachedSize();
virtual void DoLayout(int BaseX, int BaseY, int SizeX, int SizeY) = 0;
@ -149,7 +170,7 @@ namespace vgui
protected:
class CSizerMember
{
friend class CSizerBase;
friend class CSizerBase; // allow CSizerBase to populate the private members directly
public:
SizerElementType_t GetElementType() const;
@ -174,7 +195,7 @@ namespace vgui
Panel* m_pPanel;
CSizerBase* m_pSizer;
int m_nPadding;
int m_nPadding; // if m_pPanel and m_pSizer are both NULL, this is the spacer min size
float m_flExpandFactor;
bool m_bMinorExpand;
bool m_bIgnoreMemberMin;
@ -205,6 +226,9 @@ namespace vgui
};
//-----------------------------------------------------------------------------
// Purpose: Macro to handle Colors that can be overridden in .res files
//-----------------------------------------------------------------------------
struct OverridableColorEntry
{
char const* name() { return m_pszScriptName; }
@ -220,6 +244,9 @@ namespace vgui
AddToOverridableColors( &name, scriptname );
//-----------------------------------------------------------------------------
// Macros for unpacking vgui panels
//-----------------------------------------------------------------------------
#define DECLARE_VGUI_UNPACK() \
DECLARE_DMXELEMENT_UNPACK() \
private: \
@ -245,6 +272,9 @@ namespace vgui
DmxElementUnpackStructure_t *_structName::s_pUnpackParams = _namespace##_structName##_UnpackInit::s_pUnpack;
//-----------------------------------------------------------------------------
// Purpose: For hudanimations.txt scripting of vars
//-----------------------------------------------------------------------------
class IPanelAnimationPropertyConverter
{
public:
@ -260,20 +290,39 @@ namespace vgui
};
#endif
//=============================================================================
// HPE_BEGIN:
// [tj] bitwise defines for rounded corners
//=============================================================================
#define PANEL_ROUND_CORNER_TOP_LEFT (1 << 0)
#define PANEL_ROUND_CORNER_TOP_RIGHT (1 << 1)
#define PANEL_ROUND_CORNER_BOTTOM_LEFT (1 << 2)
#define PANEL_ROUND_CORNER_BOTTOM_RIGHT (1 << 3)
#define PANEL_ROUND_CORNER_ALL PANEL_ROUND_CORNER_TOP_LEFT | PANEL_ROUND_CORNER_TOP_RIGHT | PANEL_ROUND_CORNER_BOTTOM_LEFT | PANEL_ROUND_CORNER_BOTTOM_RIGHT
//=============================================================================
// HPE_END
//=============================================================================//-----------------------------------------------------------------------------
// Purpose: Base interface to all vgui windows
// All vgui controls that receive message and/or have a physical presence
// on screen are be derived from Panel.
// This is designed as an easy-access to the vgui-functionality; for more
// low-level access to vgui functions use the IPanel/IClientPanel interfaces directly
//-----------------------------------------------------------------------------
class Panel : public IClientPanel
{
DECLARE_CLASS_SIMPLE_NOBASE(Panel);
DECLARE_DMXELEMENT_UNPACK_NAMESPACE(vgui);
public:
// For property mapping
static void InitPropertyConverters(void);
static void AddPropertyConverter(char const* typeName, IPanelAnimationPropertyConverter* converter);
//-----------------------------------------------------------------------------
// CONSTRUCTORS
// these functions deal with the creation of the Panel
// the Panel automatically gets a handle to a vgui-internal panel, the ipanel(), upon construction
// vgui interfaces deal only with ipanel(), not Panel directly
Panel();
Panel(Panel* parent);
Panel(Panel* parent, const char* panelName);
@ -281,53 +330,64 @@ namespace vgui
virtual ~Panel();
// returns pointer to Panel's vgui VPanel interface handle
virtual VPANEL GetVPanel() { return _vpanel; }
HPanel ToHandle() const;
void SetName(const char* panelName);
const char* GetName();
const char* GetClassName();
//-----------------------------------------------------------------------------
// PANEL METHODS
// these functions all manipulate panels
// they cannot be derived from
void SetName(const char* panelName); // sets the name of the panel - used as an identifier
const char* GetName(); // returns the name of this panel... never NULL
const char* GetClassName(); // returns the class name of the panel (eg. Panel, Label, Button, etc.)
void MakeReadyForUse();
void MakeReadyForUse(); // fully construct this panel so its ready for use right now (i.e fonts loaded, colors set, default label text set, ...)
void SetPos(int x, int y);
void GetPos(int& x, int& y);
void SetSize(int wide, int tall);
void GetSize(int& wide, int& tall);
void SetBounds(int x, int y, int wide, int tall);
void GetBounds(int& x, int& y, int& wide, int& tall);
int GetWide();
void SetWide(int wide);
int GetTall();
void SetTall(int tall);
void SetMinimumSize(int wide, int tall);
void GetMinimumSize(int& wide, int& tall);
bool IsBuildModeEditable();
void SetBuildModeEditable(bool state);
bool IsBuildModeDeletable();
void SetBuildModeDeletable(bool state);
bool IsBuildModeActive();
void SetZPos(int z);
// panel position & size
// all units are in pixels
void SetPos(int x, int y); // sets position of panel, in local space (ie. relative to parent's position)
void GetPos(int& x, int& y); // gets local position of panel
void SetSize(int wide, int tall); // sets size of panel
void GetSize(int& wide, int& tall); // gets size of panel
void SetBounds(int x, int y, int wide, int tall); // combination of SetPos/SetSize
void GetBounds(int& x, int& y, int& wide, int& tall); // combination of GetPos/GetSize
int GetWide(); // returns width of panel
void SetWide(int wide); // sets width of panel
int GetTall(); // returns height of panel
void SetTall(int tall); // sets height of panel
void SetMinimumSize(int wide, int tall); // sets the minimum size the panel can go
void GetMinimumSize(int& wide, int& tall); // gets the minimum size
bool IsBuildModeEditable(); // editable in the buildModeDialog?
void SetBuildModeEditable(bool state); // set buildModeDialog editable
bool IsBuildModeDeletable(); // deletable in the buildModeDialog?
void SetBuildModeDeletable(bool state); // set buildModeDialog deletable
bool IsBuildModeActive(); // true if we're currently in edit mode
void SetZPos(int z); // sets Z ordering - lower numbers are always behind higher z's
int GetZPos(void);
void SetAlpha(int alpha);
int GetAlpha();
void SetAlpha(int alpha); // sets alpha modifier for panel and all child panels [0..255]
int GetAlpha(); // returns the current alpha
// panel visibility
// invisible panels and their children do not drawn, updated, or receive input messages
virtual void SetVisible(bool state);
virtual bool IsVisible();
virtual bool IsFullyVisible();
virtual bool IsFullyVisible(); // checks parent panels are IsVisible too
virtual VPANEL IsWithinTraverse(int x, int y, bool traversePopups);
MESSAGE_FUNC(Repaint, "Repaint");
// painting
virtual VPANEL IsWithinTraverse(int x, int y, bool traversePopups); // recursive; returns a pointer to the panel at those coordinates
MESSAGE_FUNC(Repaint, "Repaint"); // marks the panel as needing to be repainted
virtual void PostMessage(VPANEL target, KeyValues* message, float delaySeconds = 0.0f);
bool IsWithin(int x, int y);
bool IsWithin(int x, int y); //in screen space
void LocalToScreen(int& x, int& y);
void ScreenToLocal(int& x, int& y);
void ParentLocalToScreen(int& x, int& y);
void MakePopup(bool showTaskbarIcon = true, bool disabled = false);
void MakePopup(bool showTaskbarIcon = true, bool disabled = false); // turns the panel into a popup window (ie. can draw outside of it's parents space)
virtual void OnMove();
// panel hierarchy
virtual Panel* GetParent();
virtual VPANEL GetVParent();
virtual void SetParent(Panel* newParent);
@ -343,29 +403,33 @@ namespace vgui
virtual bool LookupElementBounds(const char* elementName, int& x, int& y, int& wide, int& tall) { return false; }
virtual void SetAutoDelete(bool state);
virtual void SetAutoDelete(bool state); // if set to true, panel automatically frees itself when parent is deleted
virtual bool IsAutoDeleteSet();
virtual void DeletePanel();
virtual void DeletePanel(); // simply does a { delete this; }
// messaging
virtual void AddActionSignalTarget(Panel* messageTarget);
virtual void AddActionSignalTarget(VPANEL messageTarget);
virtual void RemoveActionSignalTarget(Panel* oldTarget);
virtual void PostActionSignal(KeyValues* message);
virtual void PostActionSignal(KeyValues* message); // sends a message to the current actionSignalTarget(s)
virtual bool RequestInfoFromChild(const char* childName, KeyValues* outputData);
virtual void PostMessageToChild(const char* childName, KeyValues* messsage);
virtual void PostMessage(Panel* target, KeyValues* message, float delaySeconds = 0.0f);
virtual bool RequestInfo(KeyValues* outputData);
virtual bool SetInfo(KeyValues* inputData);
virtual void SetSilentMode(bool bSilent);
virtual bool RequestInfo(KeyValues* outputData); // returns true if output is successfully written. You should always chain back to the base class if info request is not handled
virtual bool SetInfo(KeyValues* inputData); // sets a specified value in the control - inverse of the above
virtual void SetSilentMode(bool bSilent); //change the panel's silent mode; if silent, the panel will not post any action signals
virtual void InstallMouseHandler(Panel* pHandler);
// install a mouse handler
virtual void InstallMouseHandler(Panel* pHandler); // mouse events will be send to handler panel instead of this panel
// drawing state
virtual void SetEnabled(bool state);
virtual bool IsEnabled();
virtual bool IsPopup();
virtual bool IsPopup(); // has a parent, but is in it's own space
virtual void GetClipRect(int& x0, int& y0, int& x1, int& y1);
virtual void MoveToFront();
// pin positions for auto-layout
enum PinCorner_e
{
PIN_TOPLEFT = 0,
@ -374,12 +438,14 @@ namespace vgui
PIN_BOTTOMRIGHT,
PIN_NO,
// For sibling pinning
PIN_CENTER_TOP,
PIN_CENTER_RIGHT,
PIN_CENTER_BOTTOM,
PIN_CENTER_LEFT,
};
// specifies the auto-resize directions for the panel
enum AutoResize_e
{
AUTORESIZE_NO = 0,
@ -388,19 +454,23 @@ namespace vgui
AUTORESIZE_DOWNANDRIGHT,
};
// Sets the pin corner for non-resizing panels
void SetPinCorner(PinCorner_e pinCorner, int nOffsetX, int nOffsetY);
// Sets the pin corner + resize mode for resizing panels
void SetAutoResize(PinCorner_e pinCorner, AutoResize_e resizeDir, int nPinOffsetX, int nPinOffsetY, int nUnpinnedCornerOffsetX, int nUnpinnedCornerOffsetY);
AutoResize_e GetAutoResize();
PinCorner_e GetPinCorner();
// Gets the relative offset of the control from the pinned + non-pinned corner (for resizing)
void GetPinOffset(int& dx, int& dy);
void GetResizeOffset(int& dx, int& dy);
void PinToSibling(const char* pszSibling, PinCorner_e pinOurCorner, PinCorner_e pinSibling);
void UpdateSiblingPin(void);
// colors
virtual void SetBgColor(Color color);
virtual void SetFgColor(Color color);
virtual Color GetBgColor();
@ -413,64 +483,85 @@ namespace vgui
virtual void InvalidateLayout(bool layoutNow = false, bool reloadScheme = false);
virtual bool RequestFocusPrev(VPANEL panel = NULL);
virtual bool RequestFocusNext(VPANEL panel = NULL);
// tab positioning
virtual void SetTabPosition(int position);
virtual int GetTabPosition();
// border
virtual void SetBorder(IBorder* border);
virtual IBorder* GetBorder();
virtual void SetPaintBorderEnabled(bool state);
virtual void SetPaintBackgroundEnabled(bool state);
virtual void SetPaintEnabled(bool state);
virtual void SetPostChildPaintEnabled(bool state);
virtual void SetPaintBackgroundType(int type);
virtual void SetPaintBackgroundType(int type); // 0 for normal(opaque), 1 for single texture from Texture1, and 2 for rounded box w/ four corner textures
virtual void GetInset(int& left, int& top, int& right, int& bottom);
virtual void GetPaintSize(int& wide, int& tall);
virtual void SetBuildGroup(BuildGroup* buildGroup);
virtual bool IsBuildGroupEnabled();
virtual bool IsCursorNone();
virtual bool IsCursorOver();
virtual void MarkForDeletion();
virtual bool IsLayoutInvalid();
virtual Panel* HasHotkey(wchar_t key);
virtual bool IsCursorOver(); // returns true if the cursor is currently over the panel
virtual void MarkForDeletion(); // object will free it's memory next tick
virtual bool IsLayoutInvalid(); // does this object require a perform layout?
virtual Panel* HasHotkey(wchar_t key); // returns the panel that has this hotkey
virtual bool IsOpaque();
bool IsRightAligned();
bool IsBottomAligned();
bool IsPercentage();
bool IsRightAligned(); // returns true if the settings are aligned to the right of the screen
bool IsBottomAligned(); // returns true if the settings are aligned to the bottom of the screen
bool IsPercentage(); // returns true if the settings are a percentage of screen size
// scheme access functions
virtual HScheme GetScheme();
virtual void SetScheme(const char* tag);
virtual void SetScheme(HScheme scheme);
virtual Color GetSchemeColor(const char* keyName, IScheme* pScheme);
virtual Color GetSchemeColor(const char* keyName, Color defaultColor, IScheme* pScheme);
// called when scheme settings need to be applied; called the first time before the panel is painted
virtual void ApplySchemeSettings(IScheme* pScheme);
// interface to build settings
// takes a group of settings and applies them to the control
virtual void ApplySettings(KeyValues* inResourceData);
virtual void OnUnserialized(CDmxElement* pElement);
// records the settings into the resource data
virtual void GetSettings(KeyValues* outResourceData);
// gets a description of the resource for use in the UI
// format: <type><whitespace | punctuation><keyname><whitespace| punctuation><type><whitespace | punctuation><keyname>...
// unknown types as just displayed as strings in the UI (for future UI expansion)
virtual const char* GetDescription();
// returns the name of the module that this instance of panel was compiled into
virtual const char* GetModuleName();
// user configuration settings
// this is used for any control details the user wants saved between sessions
// eg. dialog positions, last directory opened, list column width
virtual void ApplyUserConfigSettings(KeyValues* userConfig);
// returns user config settings for this control
virtual void GetUserConfigSettings(KeyValues* userConfig);
// optimization, return true if this control has any user config settings
virtual bool HasUserConfigSettings();
virtual void OnMessage(const KeyValues* params, VPANEL fromPanel);
MESSAGE_FUNC_CHARPTR(OnCommand, "Command", command);
MESSAGE_FUNC(OnMouseCaptureLost, "MouseCaptureLost");
MESSAGE_FUNC(OnSetFocus, "SetFocus");
MESSAGE_FUNC(OnKillFocus, "KillFocus");
MESSAGE_FUNC(OnDelete, "Delete");
virtual void OnThink();
virtual void OnChildAdded(VPANEL child);
virtual void OnSizeChanged(int newWide, int newTall);
// message handlers
// override to get access to the message
// override to get access to the message
virtual void OnMessage(const KeyValues* params, VPANEL fromPanel); // called when panel receives message; must chain back
MESSAGE_FUNC_CHARPTR(OnCommand, "Command", command); // called when a panel receives a command
MESSAGE_FUNC(OnMouseCaptureLost, "MouseCaptureLost"); // called after the panel loses mouse capture
MESSAGE_FUNC(OnSetFocus, "SetFocus"); // called after the panel receives the keyboard focus
MESSAGE_FUNC(OnKillFocus, "KillFocus"); // called after the panel loses the keyboard focus
MESSAGE_FUNC(OnDelete, "Delete"); // called to delete the panel; Panel::OnDelete() does simply { delete this; }
virtual void OnThink(); // called every frame before painting, but only if panel is visible
virtual void OnChildAdded(VPANEL child); // called when a child has been added to this panel
virtual void OnSizeChanged(int newWide, int newTall); // called after the size of a panel has been changed
// called every frame if ivgui()->AddTickSignal() is called
virtual void OnTick();
// input messages
MESSAGE_FUNC_INT_INT(OnCursorMoved, "OnCursorMoved", x, y);
virtual void OnCursorEntered();
virtual void OnCursorExited();
@ -479,13 +570,14 @@ namespace vgui
virtual void OnMouseReleased(MouseCode code);
virtual void OnMouseWheeled(int delta);
// Trip pressing (e.g., select all text in a TextEntry) requires this to be enabled
virtual void SetTriplePressAllowed(bool state);
virtual bool IsTriplePressAllowed() const;
virtual void OnMouseTriplePressed(MouseCode code);
static char const* KeyCodeToString(KeyCode code);
static wchar_t const* KeyCodeToDisplayString(KeyCode code);
static wchar_t const* KeyCodeModifiersToDisplayString(KeyCode code, int modifiers);
static wchar_t const* KeyCodeModifiersToDisplayString(KeyCode code, int modifiers); // L"Ctrl+Alt+Shift+Backspace"
static KeyCode StringToKeyCode(char const* str);
#if defined( VGUI_USEKEYBINDINGMAPS )
@ -505,7 +597,10 @@ namespace vgui
static void LoadKeyBindings(KeyBindingContextHandle_t handle);
static void LoadKeyBindingsForOnePanel(KeyBindingContextHandle_t handle, Panel* panelOfInterest);
// OnKeyCodeTyped hooks into here for action
virtual bool IsKeyRebound(KeyCode code, int modifiers);
// If a panel implements this and returns true, then the IsKeyRebound check will fail and OnKeyCodeTyped messages will pass through..
// sort of like setting the SetAllowKeyBindingChainToParent flag to false for specific keys
virtual bool IsKeyOverridden(KeyCode code, int modifiers);
virtual void AddKeyBinding(char const* bindingName, int keycode, int modifiers);
@ -516,6 +611,7 @@ namespace vgui
BoundKey_t* LookupDefaultKey(char const* bindingName);
PanelKeyBindingMap* LookupMapForBinding(char const* bindingName);
// Returns the number of keybindings
int GetKeyMappingCount();
void RevertKeyBindingsToDefault();
@ -523,46 +619,58 @@ namespace vgui
void ReloadKeyBindings();
virtual void EditKeyBindings();
// calls RevertKeyBindingsToDefault() and then LoadKeyBindingsForOnePanel( GetKeyBindingsContext(), this );
void SaveKeyBindingsToBuffer(int level, CUtlBuffer& buf);
bool ParseKeyBindings(KeyValues* kv);
virtual char const* GetKeyBindingsFile() const;
virtual char const* GetKeyBindingsFilePathID() const;
// Set this to false to disallow IsKeyRebound chaining to GetParent() Panels...
void SetAllowKeyBindingChainToParent(bool state);
bool IsKeyBindingChainToParentAllowed() const;
#endif
#endif // VGUI_USEKEYBINDINGMAPS
// base implementation forwards Key messages to the Panel's parent
// - override to 'swallow' the input
virtual void OnKeyCodePressed(KeyCode code);
virtual void OnKeyCodeTyped(KeyCode code);
virtual void OnKeyTyped(wchar_t unichar);
virtual void OnKeyCodeReleased(KeyCode code);
virtual void OnKeyFocusTicked();
virtual void OnKeyFocusTicked(); // every window gets key ticked events
// forwards mouse messages to the panel's parent
MESSAGE_FUNC(OnMouseFocusTicked, "OnMouseFocusTicked");
// message handlers that don't go through the message pump
virtual void PaintBackground();
virtual void Paint();
virtual void PaintBorder();
virtual void PaintBuildOverlay();
virtual void PaintBuildOverlay(); // the extra drawing for when in build mode
virtual void PostChildPaint();
virtual void PerformLayout();
// this enables message mapping for this class - requires matching IMPLEMENT_PANELDESC() in the .cpp file
DECLARE_PANELMAP();
virtual VPANEL GetCurrentKeyFocus();
// returns a pointer to the tooltip object associated with the panel
// creates a new one if none yet exists
BaseTooltip* GetTooltip();
void SetTooltip(BaseTooltip* pToolTip, const char* pszText);
// proportional mode settings
virtual bool IsProportional() { return _flags.IsFlagSet(IS_PROPORTIONAL); }
virtual void SetProportional(bool state);
// input interest
virtual void SetMouseInputEnabled(bool state);
virtual void SetKeyBoardInputEnabled(bool state);
virtual bool IsMouseInputEnabled();
virtual bool IsKeyBoardInputEnabled();
// allows you to disable for this panel but not children
void DisableMouseInputForThisPanel(bool bDisable);
bool IsMouseInputDisabledForThisPanel() const;
@ -570,8 +678,14 @@ namespace vgui
virtual void DrawBox(int x, int y, int wide, int tall, Color color, float normalizedAlpha, bool hollow = false);
virtual void DrawBoxFade(int x, int y, int wide, int tall, Color color, float normalizedAlpha, unsigned int alpha0, unsigned int alpha1, bool bHorizontal, bool hollow = false);
virtual void DrawHollowBox(int x, int y, int wide, int tall, Color color, float normalizedAlpha);
//=============================================================================
// HPE_BEGIN:
//=============================================================================
// [menglish] Draws a hollow box similar to the already existing draw hollow box function, but takes the indents as params
virtual void DrawHollowBox(int x, int y, int wide, int tall, Color color, float normalizedAlpha, int cornerWide, int cornerTall);
// [tj] Simple getters and setters to decide which corners to draw rounded
unsigned char GetRoundedCorners() { return m_roundedCorners; }
void SetRoundedCorners(unsigned char cornerFlags) { m_roundedCorners = cornerFlags; }
bool ShouldDrawTopLeftCornerRounded() { return 0 != (m_roundedCorners & PANEL_ROUND_CORNER_TOP_LEFT); }
@ -579,22 +693,35 @@ namespace vgui
bool ShouldDrawBottomLeftCornerRounded() { return 0 != (m_roundedCorners & PANEL_ROUND_CORNER_BOTTOM_LEFT); }
bool ShouldDrawBottomRightCornerRounded() { return 0 != (m_roundedCorners & PANEL_ROUND_CORNER_BOTTOM_RIGHT); }
//=============================================================================
// HPE_END
//=============================================================================
// Drag Drop Public interface
virtual void SetDragEnabled(bool enabled);
virtual bool IsDragEnabled() const;
virtual void SetShowDragHelper(bool enabled);
// Called if drag drop is started but not dropped on top of droppable panel...
virtual void OnDragFailed(CUtlVector< KeyValues* >& msglist);
// Use this to prevent chaining up from a parent which can mess with mouse functionality if you don't want to chain up from a child panel to the best
// draggable parent.
virtual void SetBlockDragChaining(bool block);
virtual bool IsBlockingDragChaining() const;
virtual int GetDragStartTolerance() const;
virtual void SetDragSTartTolerance(int nTolerance);
// If hover context time is non-zero, then after the drop cursor is hovering over the panel for that amount of time
// the Show hover context menu function will be invoked
virtual void SetDropEnabled(bool enabled, float m_flHoverContextTime = 0.0f);
virtual bool IsDropEnabled() const;
// Called if m_flHoverContextTime was non-zero, allows droppee to preview the drop data and show an appropriate menu
// Return false if not using context menu
virtual bool GetDropContextMenu(Menu* menu, CUtlVector< KeyValues* >& msglist);
virtual void OnDropContextHoverShow(CUtlVector< KeyValues* >& msglist);
virtual void OnDropContextHoverHide(CUtlVector< KeyValues* >& msglist);
@ -602,20 +729,27 @@ namespace vgui
#if defined( VGUI_USEDRAGDROP )
virtual DragDrop_t* GetDragDropInfo();
#endif
// For handling multiple selections...
virtual void OnGetAdditionalDragPanels(CUtlVector< Panel* >& dragabbles);
virtual void OnCreateDragData(KeyValues* msg);
// Called to see if a drop enabled panel can accept the specified data blob
virtual bool IsDroppable(CUtlVector< KeyValues* >& msglist);
// Mouse is on draggable panel and has started moving, but is not over a droppable panel yet
virtual void OnDraggablePanelPaint();
// Mouse is now over a droppable panel
virtual void OnDroppablePanelPaint(CUtlVector< KeyValues* >& msglist, CUtlVector< Panel* >& dragPanels);
virtual void OnPanelDropped(CUtlVector< KeyValues* >& msglist);
// called on droptarget when draggable panel entered/exited droptarget
virtual void OnPanelEnteredDroppablePanel(CUtlVector< KeyValues* >& msglist);
virtual void OnPanelExitedDroppablePanel(CUtlVector< KeyValues* >& msglist);
// Chains up to any parent marked DropEnabled
virtual Panel* GetDropTarget(CUtlVector< KeyValues* >& msglist);
// Chains up to first parent marked DragEnabled
virtual Panel* GetDragPanel();
virtual bool IsBeingDragged();
virtual HCursor GetDropCursor(CUtlVector< KeyValues* >& msglist);
@ -624,8 +758,10 @@ namespace vgui
Color GetDropFrameColor();
Color GetDragFrameColor();
// Can override to require custom behavior to start the drag state
virtual bool CanStartDragging(int startx, int starty, int mx, int my);
// Draws a filled rect of specified bounds, but omits the bounds of the skip panel from those bounds
virtual void FillRectSkippingPanel(const Color clr, int x, int y, int w, int h, Panel* skipPanel);
virtual int GetPaintBackgroundType();
@ -638,9 +774,11 @@ namespace vgui
virtual void SetSkipChildDuringPainting(Panel* child);
// If this is set, then the drag drop won't occur until the mouse leaves the drag panels current rectangle
void SetStartDragWhenMouseExitsPanel(bool state);
bool IsStartDragWhenMouseExitsPanel() const;
// Forces context ID for this panel and all children below it
void SetMessageContextId_R(int nContextID);
void PostMessageToAllSiblings(KeyValues* msg, float delaySeconds = 0.0f);
@ -650,6 +788,7 @@ namespace vgui
void SetConsoleStylePanel(bool bConsoleStyle);
bool IsConsoleStylePanel() const;
// For 360: support directional navigation between UI controls via dpad
enum NAV_DIRECTION { ND_UP, ND_DOWN, ND_LEFT, ND_RIGHT, ND_BACK, ND_NONE };
virtual Panel* NavigateUp();
virtual Panel* NavigateDown();
@ -657,7 +796,7 @@ namespace vgui
virtual Panel* NavigateRight();
virtual void NavigateTo();
virtual void NavigateFrom();
virtual void NavigateToChild(Panel* pNavigateTo);
virtual void NavigateToChild(Panel* pNavigateTo); //mouse support
Panel* SetNavUp(Panel* navUp);
Panel* SetNavDown(Panel* navDown);
@ -667,6 +806,7 @@ namespace vgui
MESSAGE_FUNC_CHARPTR(OnNavigateTo, "OnNavigateTo", panelName);
MESSAGE_FUNC_CHARPTR(OnNavigateFrom, "OnNavigateFrom", panelName);
// Drag Drop protected/internal interface
protected:
virtual void OnStartDragging();
@ -703,15 +843,21 @@ namespace vgui
void SetNavRight(const char* controlName);
public:
/*
Will recursively look for the next visible panel in the navigation chain, parameters are for internal use.
It will stop looking if first == nextpanel (to prevent infinite looping).
*/
Panel* GetNavUp(Panel* first = NULL);
Panel* GetNavDown(Panel* first = NULL);
Panel* GetNavLeft(Panel* first = NULL);
Panel* GetNavRight(Panel* first = NULL);
// if set, Panel gets PerformLayout called after the camera and the renderer's m_matrixWorldToScreen has been setup, so panels can be correctly attached to entities in the world
inline void SetWorldPositionCurrentFrame(bool bWorldPositionCurrentFrame) { m_bWorldPositionCurrentFrame = bWorldPositionCurrentFrame; }
inline bool GetWorldPositionCurrentFrame() { return m_bWorldPositionCurrentFrame; }
protected:
//this will return m_NavDown and will not look for the next visible panel
Panel* GetNavUpPanel();
Panel* GetNavDownPanel();
Panel* GetNavLeftPanel();
@ -761,8 +907,10 @@ namespace vgui
ALL_FLAGS = 0xFFFF,
};
// used to get the Panel * for users with only IClientPanel
virtual Panel* GetPanel() { return this; }
// private methods
void Think();
void PerformApplySchemeSettings();
@ -775,6 +923,7 @@ namespace vgui
MESSAGE_FUNC_INT(InternalMousePressed, "MousePressed", code);
MESSAGE_FUNC_INT(InternalMouseDoublePressed, "MouseDoublePressed", code);
// Triple presses are synthesized
MESSAGE_FUNC_INT(InternalMouseTriplePressed, "MouseTriplePressed", code);
MESSAGE_FUNC_INT(InternalMouseReleased, "MouseReleased", code);
MESSAGE_FUNC_INT(InternalMouseWheeled, "MouseWheeled", delta);
@ -789,7 +938,7 @@ namespace vgui
MESSAGE_FUNC(InternalInvalidateLayout, "Invalidate");
MESSAGE_FUNC(InternalMove, "Move");
virtual void InternalFocusChanged(bool lost);
virtual void InternalFocusChanged(bool lost); // called when the focus gets changed
void Init(int x, int y, int wide, int tall);
void PreparePanelMap(PanelMap_t* panelMap);
@ -799,8 +948,10 @@ namespace vgui
PanelAnimationMapEntry* FindPanelAnimationEntry(char const* scriptname, PanelAnimationMap* map);
// Recursively invoke settings for PanelAnimationVars
void InternalApplySettings(PanelAnimationMap* map, KeyValues* inResourceData);
// Purpose: Loads panel details related to autoresize from the resource info
void ApplyAutoResizeSettings(KeyValues* inResourceData);
void FindDropTargetPanel_R(CUtlVector< VPANEL >& panelList, int x, int y, VPANEL check);
@ -819,65 +970,67 @@ namespace vgui
PHandle m_SkipChild;
long m_lLastDoublePressTime;
HFont m_infoFont;
HFont m_infoFont; // this is used exclusively by drag drop panels
#if defined( VGUI_USEKEYBINDINGMAPS )
KeyBindingContextHandle_t m_hKeyBindingsContext;
#endif
VPANEL _vpanel;
CUtlString _panelName;
// data
VPANEL _vpanel; // handle to a vgui panel
CUtlString _panelName; // string name of the panel - only unique within the current context
IBorder* _border;
CUtlFlags< unsigned short > _flags;
Dar<HPanel> _actionSignalTargetDar;
CUtlFlags< unsigned short > _flags; // see PanelFlags_t
Dar<HPanel> _actionSignalTargetDar; // the panel to direct notify messages to ("Command", "TextChanged", etc.)
CUtlVector<OverridableColorEntry> m_OverridableColorEntries;
Color _fgColor;
Color _bgColor;
Color _fgColor; // foreground color
Color _bgColor; // background color
HBuildGroup _buildGroup;
short m_nPinDeltaX;
short m_nPinDeltaX; // Relative position of the pinned corner to the edge
short m_nPinDeltaY;
short m_nResizeDeltaX;
short m_nResizeDeltaX; // Relative position of the non-pinned corner to the edge
short m_nResizeDeltaY;
HCursor _cursor;
unsigned short _buildModeFlags;
unsigned short _buildModeFlags; // flags that control how the build mode dialog handles this panel
byte _pinCorner : 4;
byte _autoResizeDirection : 4;
byte _pinCorner : 4; // the corner of the dialog this panel is pinned to
byte _autoResizeDirection : 4; // the directions in which the panel will auto-resize to
GCC_DIAG_PUSH_OFF(overflow)
DECLARE_DMXELEMENT_BITFIELD(_pinCorner, byte, Panel)
DECLARE_DMXELEMENT_BITFIELD(_autoResizeDirection, byte, Panel)
DECLARE_DMXELEMENT_BITFIELD(_autoResizeDirection, byte, Panel)
GCC_DIAG_POP()
GCC_DIAG_POP()
unsigned char _tabPosition;
HScheme m_iScheme;
unsigned char _tabPosition; // the panel's place in the tab ordering
HScheme m_iScheme; // handle to the scheme to use
bool m_bIsDMXSerialized : 1;
bool m_bUseSchemeColors : 1;
bool m_bIsSilent : 1;
bool m_bIsDMXSerialized : 1; // Is this a DMX panel?
bool m_bUseSchemeColors : 1; // Should we use colors from the scheme?
bool m_bIsSilent : 1; // should this panel PostActionSignals?
bool m_bIsConsoleStylePanel : 1;
DECLARE_DMXELEMENT_BITFIELD(m_bUseSchemeColors, bool, Panel)
DECLARE_DMXELEMENT_BITFIELD(m_bIsSilent, bool, Panel)
DECLARE_DMXELEMENT_BITFIELD(m_bIsSilent, bool, Panel)
char* _pinToSibling;
byte _pinToSiblingCorner;
byte _pinCornerToSibling;
// Sibling pinning
char* _pinToSibling; // string name of the sibling panel we're pinned to
byte _pinToSiblingCorner; // the corner of the sibling panel we're pinned to
byte _pinCornerToSibling; // the corner of our panel that we're pinning to our sibling
PHandle m_pinSibling;
char* _tooltipText;
char* _tooltipText; // Tool tip text for panels that share tooltip panels with other panels
PHandle m_hMouseEventHandler;
bool m_bWorldPositionCurrentFrame;
bool m_bWorldPositionCurrentFrame; // if set, Panel gets PerformLayout called after the camera and the renderer's m_matrixWorldToScreen has been setup, so panels can be correctly attached to entities in the world
CUtlSymbol m_sBorderName;
protected:
@ -899,17 +1052,27 @@ namespace vgui
CPanelAnimationVar(float, m_flAlpha, "alpha", "255");
// 1 == Textured (TextureId1 only)
// 2 == Rounded Corner Box
CPanelAnimationVar(int, m_nPaintBackgroundType, "PaintBackgroundType", "0");
CPanelAnimationVarAliasType(int, m_nBgTextureId1, "Texture1", "vgui/hud/800corner1", "textureid");
CPanelAnimationVarAliasType(int, m_nBgTextureId2, "Texture2", "vgui/hud/800corner2", "textureid");
CPanelAnimationVarAliasType(int, m_nBgTextureId3, "Texture3", "vgui/hud/800corner3", "textureid");
CPanelAnimationVarAliasType(int, m_nBgTextureId4, "Texture4", "vgui/hud/800corner4", "textureid");
//=============================================================================
// HPE_BEGIN:
// [tj] A bitset of flags to determine which corners should be rounded
//=============================================================================
unsigned char m_roundedCorners;
//=============================================================================
// HPE_END
//=============================================================================
friend class BuildGroup;
friend class BuildModeDialog;
friend class PHandle;
// obselete, remove soon
void OnOldMessage(KeyValues* params, VPANEL ifromPanel);
public:
@ -935,7 +1098,7 @@ namespace vgui
}
template< class S >
inline void Panel::PostMessageToAllSiblingsOfType(KeyValues* msg, float delaySeconds )
inline void Panel::PostMessageToAllSiblingsOfType(KeyValues* msg, float delaySeconds /*= 0.0f*/)
{
Panel* parent = GetParent();
if (parent)
@ -956,7 +1119,7 @@ namespace vgui
msg->deleteThis();
}
}
} // namespace vgui
#endif
#endif // PANEL_H

View File

@ -56,6 +56,7 @@ public:
virtual CBaseEntity* GetFilterResult(void) = 0;
};
class CGlobalEntityList : public CBaseEntityList
{
public:

View File

@ -0,0 +1,149 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef TEAMFORTRESSVIEWPORT_H
#define TEAMFORTRESSVIEWPORT_H
// viewport interface for the rest of the dll
#include "iviewport.h"
#include "vguitextwindow.h"
#include "commandmenu.h"
#include "utlqueue.h" // a vector based queue template to manage our VGUI menu queue
#include "Frame.h"
#include "ISurface.h"
#include "igameevents.h"
using namespace vgui;
class IBaseFileSystem;
class IGameUIFuncs;
class IGameEventManager;
//==============================================================================
class CBaseViewport : public vgui::EditablePanel, public IViewPort, public IGameEventListener2
{
DECLARE_CLASS_SIMPLE( CBaseViewport, vgui::EditablePanel );
public:
CBaseViewport();
virtual ~CBaseViewport();
virtual IViewPortPanel* CreatePanelByName(const char *szPanelName);
virtual IViewPortPanel* FindPanelByName(const char *szPanelName);
virtual IViewPortPanel* GetActivePanel( void );
virtual void RemoveAllPanels( void);
virtual void ShowPanel( const char *pName, bool state );
virtual void ShowPanel( IViewPortPanel* pPanel, bool state );
virtual bool AddNewPanel( IViewPortPanel* pPanel, char const *pchDebugName );
virtual void CreateDefaultPanels( void );
virtual void UpdateAllPanels( void );
virtual void PostMessageToPanel( const char *pName, KeyValues *pKeyValues );
virtual void Start( IGameUIFuncs *pGameUIFuncs, IGameEventManager2 *pGameEventManager );
virtual void SetParent(vgui::VPANEL parent);
virtual void ReloadScheme(const char *fromFile);
virtual void ActivateClientUI();
virtual void HideClientUI();
virtual bool AllowedToPrintText( void );
#ifndef _XBOX
virtual int GetViewPortScheme() { return m_pBackGround->GetScheme(); }
virtual VPANEL GetViewPortPanel() { return m_pBackGround->GetVParent(); }
#endif
virtual AnimationController *GetAnimationController() { return m_pAnimController; }
virtual void ShowBackGround(bool bShow)
{
#ifndef _XBOX
m_pBackGround->SetVisible( bShow );
#endif
}
virtual int GetDeathMessageStartHeight( void );
// virtual void ChatInputPosition( int *x, int *y );
public: // IGameEventListener:
virtual void FireGameEvent( IGameEvent * event);
protected:
bool LoadHudAnimations( void );
#ifndef _XBOX
class CBackGroundPanel : public vgui::Frame
{
private:
typedef vgui::Frame BaseClass;
public:
CBackGroundPanel( vgui::Panel *parent) : Frame( parent, "ViewPortBackGround" )
{
SetScheme("ClientScheme");
SetTitleBarVisible( false );
SetMoveable(false);
SetSizeable(false);
SetProportional(true);
}
private:
virtual void ApplySchemeSettings(IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
SetBgColor(pScheme->GetColor("ViewportBG", Color( 0,0,0,0 ) ));
}
virtual void PerformLayout()
{
int w,h;
GetHudSize(w, h);
// fill the screen
SetBounds(0,0,w,h);
BaseClass::PerformLayout();
}
virtual void OnMousePressed(MouseCode code) { }// don't respond to mouse clicks
virtual vgui::VPANEL IsWithinTraverse( int x, int y, bool traversePopups )
{
return ( vgui::VPANEL )0;
}
};
#endif
protected:
virtual void Paint();
virtual void OnThink();
virtual void OnScreenSizeChanged(int iOldWide, int iOldTall);
void PostMessageToPanel( IViewPortPanel* pPanel, KeyValues *pKeyValues );
protected:
IGameUIFuncs* m_GameuiFuncs; // for key binding details
IGameEventManager2* m_GameEventManager;
#ifndef _XBOX
CBackGroundPanel *m_pBackGround;
#endif
CUtlVector<IViewPortPanel*> m_Panels;
bool m_bHasParent; // Used to track if child windows have parents or not.
bool m_bInitialized;
IViewPortPanel *m_pActivePanel;
IViewPortPanel *m_pLastActivePanel;
vgui::HCursor m_hCursorNone;
vgui::AnimationController *m_pAnimController;
int m_OldSize[2];
};
#endif

View File

@ -21,8 +21,8 @@ class QAngle;
typedef enum
{
BITBUFERROR_VALUE_OUT_OF_RANGE = 0,
BITBUFERROR_BUFFER_OVERRUN,
BITBUFERROR_VALUE_OUT_OF_RANGE = 0,
BITBUFERROR_BUFFER_OVERRUN,
BITBUFERROR_NUM_ERRORS
} BitBufErrorType;
@ -370,10 +370,39 @@ public:
class bf_read
{
public:
bf_read();
//bf_read();
bf_read(const void* pData, int nBytes, int nBits = -1);
bf_read(const char* pDebugName, const void* pData, int nBytes, int nBits = -1);
bf_read()
{
m_pData = NULL;
m_nDataBytes = 0;
m_nDataBits = -1; // set to -1 so we overflow on any operation
m_iCurBit = 0;
m_bOverflow = false;
m_bAssertOnOverflow = true;
m_pDebugName = NULL;
}
//bf_read(const void* pData, int nBytes, int nBits = -1);
bf_read(const void* pData, int nBytes, int nBits = -1)
{
m_bAssertOnOverflow = true;
StartReading(pData, nBytes, 0, nBits);
}
//bf_read(const char* pDebugName, const void* pData, int nBytes, int nBits = -1);
bf_read(const char* pDebugName, const void* pData, int nBytes, int nBits)
{
m_bAssertOnOverflow = true;
m_pDebugName = pDebugName;
StartReading(pData, nBytes, 0, nBits);
}
void StartReading(const void* pData, int nBytes, int iStartBit = 0, int nBits = -1);
@ -394,8 +423,8 @@ public:
protected:
unsigned int CheckReadUBitLong(int numbits);
int ReadOneBitNoCheck();
unsigned int CheckReadUBitLong(int numbits);
int ReadOneBitNoCheck();
bool CheckForOverflow(int nBits);
@ -408,7 +437,7 @@ public:
return m_nDataBytes;
}
void ReadBits(void* pOut, int nBits);
inline bool ReadBits(void* pOut, int nBits);
int ReadBitsClamped_ptr(void* pOut, size_t outSizeBytes, size_t nBits);
template <typename T, size_t N>
int ReadBitsClamped(T(&pOut)[N], size_t nBits)
@ -470,11 +499,10 @@ public:
inline bool IsOverflowed() const { return m_bOverflow; }
inline bool Seek(int iBit);
inline bool SeekRelative(int iBitDelta);
void SetOverflowFlag();
inline bool Seek(int iBit);
inline bool SeekRelative(int iBitDelta);
void SetOverflowFlag();
public:
@ -583,6 +611,16 @@ BITBUF_INLINE unsigned int bf_read::ReadUBitVar()
return sixbits >> 2;
}
BITBUF_INLINE void bf_read::SetOverflowFlag()
{
if (m_bAssertOnOverflow)
{
Assert(false);
}
m_bOverflow = true;
}
BITBUF_INLINE unsigned int bf_read::ReadUBitLong(int numbits) RESTRICT
{
Assert(numbits > 0 && numbits <= 32);
@ -620,5 +658,114 @@ BITBUF_INLINE int bf_read::CompareBits(bf_read* RESTRICT other, int numbits) RES
}
inline bool bf_read::ReadString(char* pStr, int maxLen, bool bLine, int* pOutNumChars)
{
Assert(maxLen != 0);
bool bTooSmall = false;
int iChar = 0;
while (1)
{
char val = ReadChar();
//if (val == '\"') break;
if (val == 0)
break;
else if (bLine && val == '\n')
break;
if (iChar < (maxLen - 1))
{
pStr[iChar] = val;
++iChar;
}
else
{
bTooSmall = true;
}
}
// Make sure it's null-terminated.
Assert(iChar < maxLen);
pStr[iChar] = 0;
if (pOutNumChars)
*pOutNumChars = iChar;
return !IsOverflowed() && !bTooSmall;
}
inline bool bf_read::ReadBits(void* pOutData, int nBits)
{
#if defined( BB_PROFILING )
VPROF("bf_write::ReadBits");
#endif
unsigned char* pOut = (unsigned char*)pOutData;
int nBitsLeft = nBits;
// Get output dword-aligned.
while (((unsigned long)pOut & 3) != 0 && nBitsLeft >= 8)
{
*pOut = (unsigned char)ReadUBitLong(8);
++pOut;
nBitsLeft -= 8;
}
// Read dwords.
while (nBitsLeft >= 32)
{
*((unsigned long*)pOut) = ReadUBitLong(32);
pOut += sizeof(unsigned long);
nBitsLeft -= 32;
}
// Read the remaining bytes.
while (nBitsLeft >= 8)
{
*pOut = ReadUBitLong(8);
++pOut;
nBitsLeft -= 8;
}
// Read the remaining bits.
if (nBitsLeft)
{
*pOut = ReadUBitLong(nBitsLeft);
}
return !IsOverflowed();
}
inline bool bf_read::ReadBytes(void* pOut, int nBytes)
{
return ReadBits(pOut, nBytes << 3);
}
inline void bf_read::StartReading(const void* pData, int nBytes, int iStartBit, int nBits)
{
// Make sure we're dword aligned.
Assert(((unsigned long)pData & 3) == 0);
m_pData = (unsigned char*)pData;
m_nDataBytes = nBytes;
if (nBits == -1)
{
m_nDataBits = m_nDataBytes << 3;
}
else
{
Assert(nBits <= nBytes * 8);
m_nDataBits = nBits;
}
m_iCurBit = iStartBit;
m_bOverflow = false;
}
#endif

View File

@ -43,14 +43,7 @@ public:
NETVAR2(GetViewmodelArmConfig, "DT_CSPlayer", "m_pViewmodelArmConfig", PlayerViewmodelArmConfig*);
NETVAR2(GetArmsModel, "DT_CSPlayer", "m_szArmsModel", char*);
void SetModelIndex(const int index)
{
getvfunc<void(__thiscall*)(C_BaseEntity*, int)>(this, 75)(this, index);
}
NETVAR_OFFSET(m_dwBoneMatrix, "CBaseAnimating", "m_nForceBone", +0x1C, uintptr_t);
Vector GetBonePosition(int iBone) {
@ -65,10 +58,10 @@ public:
NETVAR(GetFrozen, "CBaseAnimating", "m_flFrozen", float);
NETVAR(GetMins, "CBaseEntity", "m_vecMins", Vector);
NETVAR(GetMaxs, "CBaseEntity", "m_vecMaxs", Vector);
NETVAR(GetMaxs, "CBaseEntity", "m_vecMaxs", Vector);
NETVAR2(IsScoped, "DT_CSPlayer", "m_bIsScoped", bool);
NETVAR2(GetViewOffset, "DT_CSPlayer", "m_vecViewOffset[0]", Vector);
int GetSequenceActivity(int sequence, studiohdr_t* hdr)
{
@ -109,6 +102,7 @@ public:
NETVAR(GetOrigin, "CBaseEntity", "m_vecOrigin", Vector);
NETVAR(GetAngles, "CBaseEntity", "m_angRotation", Vector);
NETVAR(GetHealth, "CBasePlayer", "m_iHealth", int);
NETVAR2(GetArmorValue, "DT_CSPlayer", "m_ArmorValue", int);
NETVAR(GetViewOffset, "CBasePlayer", "m_vecViewOffset[0]", Vector);
NETVAR(GetTeam, "CBaseEntity", "m_iTeamNum", int);
@ -117,7 +111,10 @@ public:
NETVAR2(GetNightvision, "DT_CSPlayer", "m_bNightVisionOn", bool);
NETVAR2(GetNightvisionAlpha, "DT_CSPlayer", "m_flNightVisionAlpha", float);
};
NETVAR2(GetTickBase, "DT_BasePlayer", "m_nTickBase", unsigned);
NETVAR2(GetObserverTarget, "DT_BasePlayer", "m_hObserverTarget", short);
};
class C_BaseCombatWeapon : public C_BaseEntity
{
@ -187,6 +184,13 @@ public:
class CBaseWeaponWorldModel : public C_BaseEntity
{
public:
};
class C_GameRulesProxy : public C_BaseEntity
{
public:
NETVAR2(IsBombPlanted, "DT_CSGameRulesProxy", "m_bBombPlanted", bool);
};
class C_Precipitation : public C_BaseEntity
@ -195,4 +199,19 @@ public:
NETVAR2(GetPrecipitationType, "DT_Precipitation", "m_nPrecipType", PrecipitationType_t);
};
class CPlantedC4 : public C_BaseEntity
{
public:
NETVAR2(IsBombTicking, "DT_PlantedC4", "m_bBombTicking", bool);
NETVAR2(GetC4Blow, "DT_PlantedC4", "m_flC4Blow", float);
NETVAR2(GetTimerLength, "DT_PlantedC4", "m_flTimerLength", float);
NETVAR2(GetDefuseLength, "DT_PlantedC4", "m_flDefuseLength", float);
NETVAR2(GetDefuseCountDown, "DT_PlantedC4", "m_flDefuseCountDown", float);
NETVAR2(IsBombDefused, "DT_PlantedC4", "m_bBombDefused", bool);
NETVAR2(GetBombDefuser, "DT_PlantedC4", "m_hBombDefuser", int);
NETVAR2(IsHaveBombDefuser, "DT_PlantedC4", "m_hBombDefuser", bool);
NETVAR2(GetBombSite, "DT_PlantedC4", "m_nBombSite", unsigned);
};
#endif

View File

@ -21,6 +21,8 @@
#include "sdk/jobthread.h"
#include "sdk/VGUI.h"
#include "../GetVfunc.hpp"
struct SpatializationInfo_t;
class IClientEntity;
@ -406,27 +408,21 @@ abstract_class IBaseClientDLL
public:
virtual int Connect(CreateInterfaceFn appSystemFactory, CGlobalVarsBase * pGlobals) = 0;
virtual void Disconnect() = 0;
virtual int Init(CreateInterfaceFn appSystemFactory, CGlobalVarsBase* pGlobals) = 0;
virtual void PostInit() = 0;
virtual void Shutdown(void) = 0;
virtual void LevelInitPreEntity(char const* pMapName) = 0;
virtual void LevelInitPostEntity() = 0;
virtual void LevelShutdown(void) = 0;
virtual ClientClass* GetAllClasses(void) = 0;
virtual int HudVidInit(void) = 0;
virtual void HudProcessInput(bool bActive) = 0;
virtual void HudUpdate(bool bActive) = 0;
virtual void HudReset(void) = 0;
virtual void HudText(const char* message) = 0;
virtual void HudText(const char* message) = 0;
virtual bool ShouldDrawDropdownConsole() = 0;
virtual void IN_ActivateMouse(void) = 0;
virtual void IN_DeactivateMouse(void) = 0;
virtual void IN_Accumulate(void) = 0;
@ -440,32 +436,31 @@ public:
bool active) = 0;
virtual void ExtraMouseSample(float frametime, bool active) = 0;
virtual bool WriteUsercmdDeltaToBuffer(int nSlot, bf_write* buf, int from, int to, bool isnewcommand) = 0;
virtual void EncodeUserCmdToBuffer(int nSlot, bf_write& buf, int slot) = 0;
virtual void DecodeUserCmdFromBuffer(int nSlot, bf_read& buf, int slot) = 0;
virtual void View_Render(vrect_t* rect) = 0;
virtual void RenderView(const CViewSetup& view, int nClearFlags, int whatToDraw) = 0;
virtual void View_Fade(ScreenFade_t* pSF) = 0;
virtual void SetCrosshairAngle(const QAngle& angle) = 0;
virtual void InitSprite(CEngineSprite* pSprite, const char* loadname) = 0;
virtual void ShutdownSprite(CEngineSprite* pSprite) = 0;
virtual int GetSpriteSize(void) const = 0;
virtual void VoiceStatus(int entindex, int iSsSlot, qboolean bTalking) = 0;
virtual bool PlayerAudible(int iPlayerIndex) = 0;
virtual void InstallStringTableCallback(char const* tableName) = 0;
virtual void FrameStageNotify(ClientFrameStage_t curStage) = 0; //37
virtual void FrameStageNotify(ClientFrameStage_t curStage) = 0;
//virtual bool DispatchUserMessage(int msg_type, int32 nFlags, int size, const void* msg) = 0;
virtual bool DispatchUserMessage(int msg_type, int32 nFlags, int size, const void* msg) = 0;
bool DispatchUserMessage(int msg_type, int32 nFlags, int size, const void* msg)
{
typedef bool(__stdcall* DispatchUserMessageFn)(int, int32, int, const void*);
//printf("DispatchUserMessageFn %x\n", this);
return getvfunc<DispatchUserMessageFn>(this, 38)(msg_type, nFlags, size, msg);
}
virtual CSaveRestoreData* SaveInit(int size) = 0;
virtual void SaveWriteFields(CSaveRestoreData*, const char*, void*, datamap_t*, typedescription_t*, int) = 0;

View File

@ -0,0 +1,244 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#if !defined( CLIENTMODE_NORMAL_H )
#define CLIENTMODE_NORMAL_H
#ifdef _WIN32
#pragma once
#endif
#include "iclientmode.h"
#include "GameEventListener.h"
#include "baseviewport.h"
class CBaseHudChat;
class CBaseHudWeaponSelection;
class CViewSetup;
class C_BaseEntity;
class C_BasePlayer;
namespace vgui
{
class Panel;
}
//=============================================================================
// HPE_BEGIN:
// [tj] Moved this from the .cpp file so derived classes could access it
//=============================================================================
#define ACHIEVEMENT_ANNOUNCEMENT_MIN_TIME 10
//=============================================================================
// HPE_END
//=============================================================================
class CReplayReminderPanel;
#define USERID2PLAYER(i) ToBasePlayer( ClientEntityList().GetEnt( engine->GetPlayerForUserID( i ) ) )
extern IClientMode *GetClientModeNormal(); // must be implemented
// This class implements client mode functionality common to HL2 and TF2.
/*
class ClientModeShared : public IClientMode, public CGameEventListener
{
// IClientMode overrides.
public:
DECLARE_CLASS_NOBASE( ClientModeShared );
ClientModeShared();
virtual ~ClientModeShared();
virtual void Init();
virtual void InitViewport();
virtual void VGui_Shutdown();
virtual void Shutdown();
virtual void LevelInit( const char *newmap );
virtual void LevelShutdown( void );
virtual void Enable();
virtual void Disable();
virtual void Layout();
virtual void ReloadScheme( void );
virtual void OverrideView( CViewSetup *pSetup );
virtual bool ShouldDrawDetailObjects( );
virtual bool ShouldDrawEntity(C_BaseEntity *pEnt);
virtual bool ShouldDrawLocalPlayer( C_BasePlayer *pPlayer );
virtual bool ShouldDrawViewModel();
virtual bool ShouldDrawParticles( );
virtual bool ShouldDrawCrosshair( void );
virtual bool ShouldBlackoutAroundHUD() OVERRIDE;
virtual HeadtrackMovementMode_t ShouldOverrideHeadtrackControl() OVERRIDE;
virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height );
virtual void PreRender(CViewSetup *pSetup);
virtual void PostRender();
virtual void PostRenderVGui();
virtual void ProcessInput(bool bActive);
virtual bool CreateMove( float flInputSampleTime, CUserCmd *cmd );
virtual void Update();
// Input
virtual int KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
virtual int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
virtual void OverrideMouseInput( float *x, float *y );
virtual void StartMessageMode( int iMessageModeType );
virtual vgui::Panel *GetMessagePanel();
virtual void ActivateInGameVGuiContext( vgui::Panel *pPanel );
virtual void DeactivateInGameVGuiContext();
// The mode can choose to not draw fog
virtual bool ShouldDrawFog( void );
virtual float GetViewModelFOV( void );
virtual vgui::Panel* GetViewport() { return m_pViewport; }
// Gets at the viewports vgui panel animation controller, if there is one...
virtual vgui::AnimationController *GetViewportAnimationController()
{ return m_pViewport->GetAnimationController(); }
virtual void FireGameEvent( IGameEvent *event );
virtual bool CanRecordDemo( char *errorMsg, int length ) const { return true; }
virtual int HandleSpectatorKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
virtual void ComputeVguiResConditions( KeyValues *pkvConditions ) OVERRIDE;
//=============================================================================
// HPE_BEGIN:
// [menglish] Save server information shown to the client in a persistent place
//=============================================================================
virtual wchar_t* GetServerName() { return NULL; }
virtual void SetServerName(wchar_t* name) {};
virtual wchar_t* GetMapName() { return NULL; }
virtual void SetMapName(wchar_t* name) {};
//=============================================================================
// HPE_END
//=============================================================================
virtual bool DoPostScreenSpaceEffects( const CViewSetup *pSetup );
virtual void DisplayReplayMessage( const char *pLocalizeName, float flDuration, bool bUrgent,
const char *pSound, bool bDlg );
virtual bool IsInfoPanelAllowed() OVERRIDE { return true; }
virtual void InfoPanelDisplayed() OVERRIDE { }
virtual bool IsHTMLInfoPanelAllowed() OVERRIDE { return true; }
//protected:
void* ptr1;
void* ptr2;
CBaseViewport *m_pViewport;
void DisplayReplayReminder();
//private:
virtual void UpdateReplayMessages();
void ClearReplayMessageList();
#if defined( REPLAY_ENABLED )
float m_flReplayStartRecordTime;
float m_flReplayStopRecordTime;
CReplayReminderPanel *m_pReplayReminderPanel;
#endif
// Message mode handling
// All modes share a common chat interface
CBaseHudChat *m_pChatElement;
vgui::HCursor m_CursorNone;
CBaseHudWeaponSelection *m_pWeaponSelection;
int m_nRootSize[2];
};
*/
class ClientModeShared : public IClientMode, public CGameEventListener
{
// IClientMode overrides.
public:
DECLARE_CLASS_NOBASE(ClientModeShared);
ClientModeShared();
virtual ~ClientModeShared();
virtual void Init();
virtual void InitViewport();
virtual void VGui_Shutdown();
virtual void Shutdown();
virtual void Enable();
virtual void EnableWithRootPanel(vgui::VPANEL pRoot);
virtual void Disable();
virtual void Layout(bool bForce = false);
virtual vgui::Panel* GetViewport();
virtual vgui::Panel* GetPanelFromViewport(const char* pchNamePath);
virtual vgui::AnimationController* GetViewportAnimationController() { return m_pViewport->GetAnimationController(); };
virtual void ProcessInput(bool bActive);
virtual bool ShouldDrawDetailObjects();
virtual bool ShouldDrawEntity(C_BaseEntity* pEnt);
virtual bool ShouldDrawLocalPlayer(C_BasePlayer* pPlayer);
virtual bool ShouldDrawParticles();
virtual bool ShouldDrawFog(void);
virtual void OverrideView(CViewSetup* pSetup);
virtual void OverrideAudioState(AudioState_t* pAudioState) { return; }
virtual int KeyInput(int down, ButtonCode_t keynum, const char* pszCurrentBinding);
virtual void StartMessageMode(int iMessageModeType);
virtual vgui::Panel* GetMessagePanel();
virtual void OverrideMouseInput(float* x, float* y);
virtual bool CreateMove(float flInputSampleTime, CUserCmd* cmd);
virtual void LevelInit(const char* newmap);
virtual void LevelShutdown(void);
virtual bool ShouldDrawViewModel(void);
virtual bool ShouldDrawCrosshair(void);
virtual void AdjustEngineViewport(int& x, int& y, int& width, int& height); //29
// Called before rendering a view.
virtual void PreRender(CViewSetup* pSetup) { return; }; // 30 just returns
// Called after everything is rendered.
virtual void PostRender(void);
virtual void PostRenderVGui(void);
virtual void ActivateInGameVGuiContext(vgui::Panel* pPanel);
virtual void DeactivateInGameVGuiContext(void);
virtual float GetViewModelFOV(void);
virtual bool CanRecordDemo(char* errorMsg, int length) const { return true; }
virtual wchar_t* GetServerName(void);
virtual void SetServerName(char* name);
virtual wchar_t* GetMapName(void);
virtual void SetMapName(char* name); // 40
virtual void OnColorCorrectionWeightsReset(void);
virtual float GetColorCorrectionScale(void) const;
virtual int HudElementKeyInput(int down, ButtonCode_t keynum, const char* pszCurrentBinding);
virtual bool DoPostScreenSpaceEffects(const CViewSetup* pSetup); // 44
public:
// Called every frame.
virtual void Update();
virtual void SetBlurFade(float scale) {};
virtual float GetBlurFade(void) { return 0.0f; };
virtual void ReloadScheme(void);
virtual void ReloadSchemeWithRoot(unsigned int root);
virtual void OverrideRenderBounds(int& a1, int& a2, int& a3, int& a4, int& a5, int& a6); // 50
virtual void FireGameEvent(IGameEvent* gameEvent); // 51
int GetSplitScreenPlayerSlot() const;
public:
void* ptr1;
void* ptr2;
CBaseViewport* m_pViewport;
// Message mode handling
// All modes share a common chat interface
CHudChat* m_pChatElement;
vgui::HCursor m_CursorNone;
CBaseHudWeaponSelection* m_pWeaponSelection;
int m_nRootSize[2];
};
#endif // CLIENTMODE_NORMAL_H

View File

@ -0,0 +1,77 @@
//========= Copyright © 1996-2003, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef COMMANDMENU_H
#define COMMANDMENU_H
#include "Menu.h"
#include "iviewport.h"
#include "filesystem.h"
#include "utlstack.h"
#include "utlvector.h"
#include "keyvalues.h"
using namespace vgui;
class CommandMenu : public Menu
{
private:
DECLARE_CLASS_SIMPLE( CommandMenu, Menu );
typedef struct
{
Menu * menu;
int itemnr;
} CommandMenuItem;
public:
CommandMenu( Panel *parent, const char *panelName, IViewPort * viewport );
~CommandMenu();
bool LoadFromFile(const char * fileName); // load menu from file (via KeyValues)
void UpdateMenu(); // call to update all menu items, check buttons etc
void RebuildMenu(); // rebuilds menu respecting changed game state (map, team etc)
void ClearMenu(); // destroy menu
public:
// overwrite these in your derived class
// virtual CommandMenu * CommandMenu::Factory(Panel *parent, const char *panelName, IViewPort * viewport = NULL, IFileSystem * pFileSytem = NULL); // overwrite
virtual int AddCustomItem(KeyValues * params, Menu * menu) {return 0;} // return MenuItem nr
virtual void UpdateCustomItem(KeyValues * params, MenuItem * item ) {}; // maybe change your item
virtual void OnCustomItem(KeyValues * params) {}; // a custom item was pressed
virtual bool CheckRules(const char *rule, const char *ruledata); // check a menu item rule
virtual void SetVisible(bool state);
// DON'T touch anything below !
protected:
void OnMessage(const KeyValues *params, VPANEL fromPanel);
void StartNewSubMenu(KeyValues * params);
void FinishSubMenu();
void AddMenuCommandItem(KeyValues * params);
void AddMenuCustomItem(KeyValues * params);
void AddMenuToggleItem(KeyValues * params);
bool LoadFromKeyValuesInternal(KeyValues * key, int depth);
bool LoadFromKeyValues( KeyValues * key); //
KeyValues * GetKeyValues(); // returns keyValues for current menu or NULL
IViewPort * m_ViewPort; // viewport interface
Menu * m_CurrentMenu; // Current menu while building CommandComoboBox
char m_CurrentTeam[4];
char m_CurrentMap[256];
KeyValues* m_MenuKeys;
CUtlStack<vgui::Menu*>m_pMenuStack;
CUtlVector<CommandMenuItem>m_MenuItems;
};
#endif // COMMANDMENU_H

98
SpyCustom/sdk/coordsize.h Normal file
View File

@ -0,0 +1,98 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#ifndef COORDSIZE_H
#define COORDSIZE_H
#pragma once
#include "worldsize.h"
// OVERALL Coordinate Size Limits used in COMMON.C MSG_*BitCoord() Routines (and someday the HUD)
#define COORD_INTEGER_BITS 14
#define COORD_FRACTIONAL_BITS 5
#define COORD_DENOMINATOR (1<<(COORD_FRACTIONAL_BITS))
#define COORD_RESOLUTION (1.0/(COORD_DENOMINATOR))
// Special threshold for networking multiplayer origins
#define COORD_INTEGER_BITS_MP 11
#define COORD_FRACTIONAL_BITS_MP_LOWPRECISION 3
#define COORD_DENOMINATOR_LOWPRECISION (1<<(COORD_FRACTIONAL_BITS_MP_LOWPRECISION))
#define COORD_RESOLUTION_LOWPRECISION (1.0/(COORD_DENOMINATOR_LOWPRECISION))
#define NORMAL_FRACTIONAL_BITS 11
#define NORMAL_DENOMINATOR ( (1<<(NORMAL_FRACTIONAL_BITS)) - 1 )
#define NORMAL_RESOLUTION (1.0/(NORMAL_DENOMINATOR))
// this is limited by the network fractional bits used for coords
// because net coords will be only be accurate to 5 bits fractional
// Standard collision test epsilon
// 1/32nd inch collision epsilon
#define DIST_EPSILON (0.03125)
// Verify that coordsize.h and worldsize.h are consistently defined
#if (MAX_COORD_INTEGER != (1<<COORD_INTEGER_BITS) )
#error MAX_COORD_INTEGER does not match COORD_INTEGER_BITS
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////////
// The following are Bit Packing Diagrams for client/server Coordinate BitField Messages
///////////////////////////////////////////////////////////////////////////////////////////////////////
//
// "Coordinates" = +/-16384.9375 (21 Bits Max)
//
// | IntegerFlagBit:1 | FractionFlagBit:1 | SignBit:1 | IntegerField:14 | FractionPart:4 | Total
// --------------------------------------------------------------------------------------------------
// 0 0 - - - 2
// 0 1 x - xxxx 7
// 1 0 x xxxxxxxxxxxxx - 17
// 1 1 x xxxxxxxxxxxxx xxxx 21
//
///////////////////////////////////////////////////////////////////////////////////////////////////////
//
// "Vec3Coordinate" = Up to 3 Coordinates (66 Bits Max)
//
// | NonZeroX:1 | NonZeroY:1 | NonZeroZ:1 | 0..3 "Coordinates" | BitField Total
// -------------------------------------------------------------------------------
// 0 0 0 - 3
// 0 0 1 7..21 Bits 10..24
// 0 1 0 7..21 Bits 10..24
// 1 0 0 7..21 Bits 10..24
// 0 1 1 14..42 Bits 17..45
// 1 1 0 14..42 Bits 17..45
// 1 0 1 14..42 Bits 17..45
// 1 1 1 21..63 Bits 24..66
//
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
// The following are Bit Packing Diagrams for client/server Normal BitField Messages
///////////////////////////////////////////////////////////////////////////////////////////////////////
//
// "Normals" = +/-1.0 (12 Bits Total)
//
// The only gotcha here is that normalization occurs so that
// 011111111111 = +1.0 and 1111111111111 = -1.0
//
// | SignBit:1 | FractionPart:11 | Total
// --------------------------------------------------------------------------------------------------
// 1 xxxxxxxxxxx 12
//
///////////////////////////////////////////////////////////////////////////////////////////////////////
//
// "Vec3Normal" = Up to 3 Coordinates (27 Bits Max)
//
// | NonZeroX:1 | NonZeroY:1 | 0..2 "Coordinates" | Z Sign Bit | BitField Total
// -------------------------------------------------------------------------------
// 0 0 - x 3
// 0 1 12 Bits x 14
// 1 0 12 Bits x 14
// 1 1 24 Bits x 27
//
///////////////////////////////////////////////////////////////////////////////////////////////////////
#endif // COORDSIZE_H

432
SpyCustom/sdk/gamerules.h Normal file
View File

@ -0,0 +1,432 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef GAMERULES_H
#define GAMERULES_H
#ifdef _WIN32
#pragma once
#endif
// Debug history should be disabled in release builds
//#define DISABLE_DEBUG_HISTORY
#ifdef CLIENT_DLL
// CEG interface functions:
#define ALLOW_TEXTCHAT_FLAG 0xAD1A
DWORD InitHudAllowTextChatFlag( void );
#define ALLOW_PROPER_TINT_FLAG 0x8E3C
DWORD InitUiAllowProperTintFlag( void );
#endif
#ifdef CLIENT_DLL
//#include "c_baseentity.h"
#define CGameRules C_GameRules
#define CGameRulesProxy C_GameRulesProxy
#else
#include "baseentity.h"
#include "recipientfilter.h"
#endif
#include "igamesystem.h"
#include "gamerules_register.h"
#include "networkvar.h"
//#include "items.h"
class CBaseCombatWeapon;
class CBaseCombatCharacter;
class CBasePlayer;
class CItem;
class CAmmoDef;
extern ConVar sk_autoaim_mode;
// Autoaiming modes
enum
{
AUTOAIM_NONE = 0, // No autoaim at all.
AUTOAIM_ON, // Autoaim is on.
AUTOAIM_ON_CONSOLE, // Autoaim is on, including enhanced features for Console gaming (more assistance, etc)
};
// weapon respawning return codes
enum
{
GR_NONE = 0,
GR_WEAPON_RESPAWN_YES,
GR_WEAPON_RESPAWN_NO,
GR_AMMO_RESPAWN_YES,
GR_AMMO_RESPAWN_NO,
GR_ITEM_RESPAWN_YES,
GR_ITEM_RESPAWN_NO,
GR_PLR_DROP_GUN_ALL,
GR_PLR_DROP_GUN_ACTIVE,
GR_PLR_DROP_GUN_NO,
GR_PLR_DROP_AMMO_ALL,
GR_PLR_DROP_AMMO_ACTIVE,
GR_PLR_DROP_AMMO_NO,
};
// Player relationship return codes
enum
{
GR_NOTTEAMMATE = 0,
GR_TEAMMATE,
GR_ENEMY,
GR_ALLY,
GR_NEUTRAL,
};
// This class has the data tables and gets the CGameRules data to the client.
class C_BaseEntity;
class CGameRulesProxy;
abstract_class CGameRules : public CMemZeroOnNew, public CAutoGameSystemPerFrame
{
public:
DECLARE_CLASS_GAMEROOT( CGameRules, CAutoGameSystemPerFrame );
virtual char const *Name() { return "CGameRules"; }
// Stuff shared between client and server.
CGameRules(void);
virtual ~CGameRules( void );
virtual bool Init();
// Damage Queries - these need to be implemented by the various subclasses (single-player, multi-player, etc).
// The queries represent queries against damage types and properties.
virtual bool Damage_IsTimeBased( int iDmgType ) = 0; // Damage types that are time-based.
virtual bool Damage_ShouldGibCorpse( int iDmgType ) = 0; // Damage types that gib the corpse.
virtual bool Damage_ShowOnHUD( int iDmgType ) = 0; // Damage types that have client HUD art.
virtual bool Damage_NoPhysicsForce( int iDmgType ) = 0; // Damage types that don't have to supply a physics force & position.
virtual bool Damage_ShouldNotBleed( int iDmgType ) = 0; // Damage types that don't make the player bleed.
//Temp: These will go away once DamageTypes become enums.
virtual int Damage_GetTimeBased( void ) = 0; // Actual bit-fields.
virtual int Damage_GetShouldGibCorpse( void ) = 0;
virtual int Damage_GetShowOnHud( void ) = 0;
virtual int Damage_GetNoPhysicsForce( void )= 0;
virtual int Damage_GetShouldNotBleed( void ) = 0;
// Ammo Definitions
//CAmmoDef* GetAmmoDef();
virtual bool SwitchToNextBestWeapon( CBaseCombatCharacter *pPlayer, CBaseCombatWeapon *pCurrentWeapon ); // Switch to the next best weapon
virtual CBaseCombatWeapon *GetNextBestWeapon( CBaseCombatCharacter *pPlayer, CBaseCombatWeapon *pCurrentWeapon ); // I can't use this weapon anymore, get me the next best one.
virtual bool ShouldCollide( int collisionGroup0, int collisionGroup1 );
virtual int DefaultFOV( void ) { return 90; }
// This function is here for our CNetworkVars.
inline void NetworkStateChanged()
{
// Forward the call to the entity that will send the data.
//CGameRulesProxy::NotifyNetworkStateChanged();
}
inline void NetworkStateChanged( void *pVar )
{
// Forward the call to the entity that will send the data.
//CGameRulesProxy::NotifyNetworkStateChanged();
}
// Get the view vectors for this mod.
virtual const CViewVectors* GetViewVectors() const;
// Damage rules for ammo types
virtual float GetAmmoDamage( CBaseEntity *pAttacker, CBaseEntity *pVictim, int nAmmoType );
virtual float GetDamageMultiplier( void ) { return 1.0f; }
// Functions to verify the single/multiplayer status of a game
virtual bool IsMultiplayer( void ) = 0;// is this a multiplayer game? (either coop or deathmatch)
virtual const unsigned char *GetEncryptionKey() { return NULL; }
virtual bool InRoundRestart( void ) { return false; }
virtual bool CheckAchievementsEnabled( int iAchievementID ) { return true; }
virtual void RegisterScriptFunctions( void ){ };
virtual void ClientCommandKeyValues( void *pEntity, KeyValues *pKeyValues ) {}
// IsConnectedUserInfoChangeAllowed allows to override FCVAR_NOT_CONNECTED rule when
// player is on team spectator or team unassigned for example
// Default and previous engine implementation will never allow FCVAR_NOT_CONNECTED cvars
// to be changed while connected to a game server
virtual bool IsConnectedUserInfoChangeAllowed( CBasePlayer *pPlayer ) { return false; }
#ifdef CLIENT_DLL
virtual bool IsBonusChallengeTimeBased( void );
virtual bool AllowThirdPersonCamera() { return true; }
#else
virtual void GetTaggedConVarList( KeyValues *pCvarTagList ) {}
// CBaseEntity overrides.
public:
// Setup
virtual void OnBeginChangeLevel( const char *nextMapName, KeyValues *saveData ) {} ///< called just before a trigger_changelevel starts a changelevel
// Called when game rules are destroyed by CWorld
virtual void LevelShutdown( void ) { return; };
virtual void Precache( void );
virtual void RefreshSkillData( bool forceUpdate );// fill skill data struct with proper values
// Called each frame. This just forwards the call to Think().
virtual void FrameUpdatePostEntityThink();
virtual void Think( void ); // GR_Think - runs every server frame, should handle any timer tasks, periodic events, etc.
virtual bool IsAllowedToSpawn( CBaseEntity *pEntity ) = 0; // Can this item spawn (eg NPCs don't spawn in deathmatch).
// Called at the end of GameFrame (i.e. after all game logic has run this frame)
virtual void EndGameFrame( void );
virtual bool IsSkillLevel( int iLevel ) { return GetSkillLevel() == iLevel; }
virtual int GetSkillLevel() { return g_iSkillLevel; }
virtual void OnSkillLevelChanged( int iNewLevel ) {};
virtual void SetSkillLevel( int iLevel )
{
int oldLevel = g_iSkillLevel;
if ( iLevel < 1 )
{
iLevel = 1;
}
else if ( iLevel > 3 )
{
iLevel = 3;
}
g_iSkillLevel = iLevel;
if( g_iSkillLevel != oldLevel )
{
OnSkillLevelChanged( g_iSkillLevel );
}
}
virtual bool FAllowFlashlight( void ) = 0;// Are players allowed to switch on their flashlight?
virtual bool FShouldSwitchWeapon( CBasePlayer *pPlayer, CBaseCombatWeapon *pWeapon ) = 0;// should the player switch to this weapon?
// Functions to verify the single/multiplayer status of a game
virtual bool IsDeathmatch( void ) = 0;//is this a deathmatch game?
virtual bool IsTeamplay( void ) { return FALSE; };// is this deathmatch game being played with team rules?
virtual bool IsCoOp( void ) = 0;// is this a coop game?
virtual const char *GetGameDescription( void ) { return "Half-Life 2"; } // this is the game name that gets seen in the server browser
// Client connection/disconnection
virtual bool ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen ) = 0;// a client just connected to the server (player hasn't spawned yet)
virtual void InitHUD( CBasePlayer *pl ) = 0; // the client dll is ready for updating
virtual void ClientDisconnected( edict_t *pClient ) = 0;// a client just disconnected from the server
virtual bool ShouldTimeoutClient( int nUserID, float flTimeSinceLastReceived ) { return false; } // return true to disconnect client due to timeout (used to do stricter timeouts when the game is sure the client isn't loading a map)
// Client damage rules
virtual float FlPlayerFallDamage( CBasePlayer *pPlayer ) = 0;// this client just hit the ground after a fall. How much damage?
virtual bool FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker ) {return TRUE;};// can this player take damage from this attacker?
virtual bool ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target ) { return TRUE; }
virtual float GetAutoAimScale( CBasePlayer *pPlayer ) { return 1.0f; }
virtual int GetAutoAimMode() { return AUTOAIM_ON; }
virtual bool ShouldUseRobustRadiusDamage(CBaseEntity *pEntity) { return false; }
virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRadius, int iClassIgnore, CBaseEntity *pEntityIgnore );
// Let the game rules specify if fall death should fade screen to black
virtual bool FlPlayerFallDeathDoesScreenFade( CBasePlayer *pl ) { return TRUE; }
virtual bool AllowDamage( CBaseEntity *pVictim, const CTakeDamageInfo &info ) = 0;
// Client spawn/respawn control
virtual void PlayerSpawn( CBasePlayer *pPlayer ) = 0;// called by CBasePlayer::Spawn just before releasing player into the game
virtual void PlayerThink( CBasePlayer *pPlayer ) = 0; // called by CBasePlayer::PreThink every frame, before physics are run and after keys are accepted
virtual bool FPlayerCanRespawn( CBasePlayer *pPlayer ) = 0;// is this player allowed to respawn now?
virtual float FlPlayerSpawnTime( CBasePlayer *pPlayer ) = 0;// When in the future will this player be able to spawn?
virtual CBaseEntity *GetPlayerSpawnSpot( CBasePlayer *pPlayer );// Place this player on their spawnspot and face them the proper direction.
virtual bool IsSpawnPointValid( CBaseEntity *pSpot, CBasePlayer *pPlayer );
virtual bool AllowAutoTargetCrosshair( void ) { return TRUE; };
virtual bool ClientCommand( CBaseEntity *pEdict, const CCommand &args ); // handles the user commands; returns TRUE if command handled properly
virtual void ClientSettingsChanged( CBasePlayer *pPlayer ); // the player has changed cvars
virtual bool CanClientCustomizeOwnIdentity() { return true; }
// Client kills/scoring
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled ) = 0;// how many points do I award whoever kills this player?
virtual void PlayerKilled( CBasePlayer *pVictim, const CTakeDamageInfo &info ) = 0;// Called each time a player dies
virtual void DeathNotice( CBasePlayer *pVictim, const CTakeDamageInfo &info )= 0;// Call this from within a GameRules class to report an obituary.
virtual const char *GetDamageCustomString( const CTakeDamageInfo &info ) { return NULL; }
virtual bool IgnorePlayerKillCommand( void ) const { return false; }
// Weapon Damage
// Determines how much damage Player's attacks inflict, based on skill level.
virtual float AdjustPlayerDamageInflicted( float damage ) { return damage; }
virtual void AdjustPlayerDamageTaken( CTakeDamageInfo *pInfo ) {}; // Base class does nothing.
// Weapon retrieval
virtual bool CanHavePlayerItem( CBasePlayer *pPlayer, CBaseCombatWeapon *pWeapon );// The player is touching an CBaseCombatWeapon, do I give it to him?
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn( CBaseCombatWeapon *pWeapon ) = 0;// should this weapon respawn?
virtual float FlWeaponRespawnTime( CBaseCombatWeapon *pWeapon ) = 0;// when may this weapon respawn?
virtual float FlWeaponTryRespawn( CBaseCombatWeapon *pWeapon ) = 0; // can i respawn now, and if not, when should i try again?
virtual Vector VecWeaponRespawnSpot( CBaseCombatWeapon *pWeapon ) = 0;// where in the world should this weapon respawn?
// Item retrieval
virtual bool CanHaveItem( CBasePlayer *pPlayer, CItem *pItem ) = 0;// is this player allowed to take this item?
virtual void PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem ) = 0;// call each time a player picks up an item (battery, healthkit)
// Item spawn/respawn control
virtual int ItemShouldRespawn( CItem *pItem ) = 0;// Should this item respawn?
virtual float FlItemRespawnTime( CItem *pItem ) = 0;// when may this item respawn?
virtual Vector VecItemRespawnSpot( CItem *pItem ) = 0;// where in the world should this item respawn?
virtual QAngle VecItemRespawnAngles( CItem *pItem ) = 0;// what angles should this item use when respawing?
// Ammo retrieval
virtual bool CanHaveAmmo( CBaseCombatCharacter *pPlayer, int iAmmoIndex ); // can this player take more of this ammo?
virtual bool CanHaveAmmo( CBaseCombatCharacter *pPlayer, const char *szName );
virtual void PlayerGotAmmo( CBaseCombatCharacter *pPlayer, char *szName, int iCount ) = 0;// called each time a player picks up some ammo in the world
virtual float GetAmmoQuantityScale( int iAmmoIndex ) { return 1.0f; }
// AI Definitions
virtual void InitDefaultAIRelationships( void ) { return; }
virtual const char* AIClassText(int classType) { return NULL; }
virtual int NumEntityClasses() const { return LAST_SHARED_ENTITY_CLASS; }
virtual int NumFactions() const { return LAST_SHARED_FACTION; }
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime( void ) = 0;// how long until a depleted HealthCharger recharges itself?
virtual float FlHEVChargerRechargeTime( void ) { return 0; }// how long until a depleted HealthCharger recharges itself?
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons( CBasePlayer *pPlayer ) = 0;// what do I do with a player's weapons when he's killed?
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo( CBasePlayer *pPlayer ) = 0;// Do I drop ammo when the player dies? How much?
// Teamplay stuff
virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget ) = 0;// What is the player's relationship with this entity?
virtual bool PlayerCanHearChat( CBasePlayer *pListener, CBasePlayer *pSpeaker, bool bTeamOnly ) = 0;
virtual void CheckChatText( CBasePlayer *pPlayer, char *pText ) { return; }
virtual int GetTeamIndex( const char *pTeamName ) { return -1; }
virtual const char *GetIndexedTeamName( int teamIndex ) { return ""; }
virtual bool IsValidTeam( const char *pTeamName ) { return true; }
virtual void ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, bool bKill, bool bGib ) {}
virtual const char *SetDefaultPlayerTeam( CBasePlayer *pPlayer ) { return ""; }
virtual void UpdateClientData( CBasePlayer *pPlayer ) { };
virtual bool IsTeamChangeSilent( CBasePlayer *pPlayer, int iTeamNum, bool bAutoTeam, bool bSilent ) { return bSilent; }
// Sounds
virtual bool PlayTextureSounds( void ) { return TRUE; }
virtual bool PlayFootstepSounds( CBasePlayer *pl ) { return TRUE; }
virtual bool AllowSoundscapes( void ) { return TRUE; }
// NPCs
virtual bool FAllowNPCs( void ) = 0;//are NPCs allowed
// Immediately end a multiplayer game
virtual void EndMultiplayerGame( void ) {}
// trace line rules
virtual float WeaponTraceEntity( CBaseEntity *pEntity, const Vector &vecStart, const Vector &vecEnd, unsigned int mask, trace_t *ptr );
// Setup g_pPlayerResource (some mods use a different entity type here).
virtual void CreateStandardEntities();
// Team name, etc shown in chat and dedicated server console
virtual const char *GetChatPrefix( bool bTeamOnly, CBasePlayer *pPlayer );
// Location name shown in chat
virtual const char *GetChatLocation( bool bTeamOnly, CBasePlayer *pPlayer ) { return NULL; }
// VGUI format string for chat, if desired
virtual const char *GetChatFormat( bool bTeamOnly, CBasePlayer *pPlayer ) { return NULL; }
// Whether props that are on fire should get a DLIGHT.
virtual bool ShouldBurningPropsEmitLight() { return false; }
virtual bool CanEntityBeUsePushed( CBaseEntity *pEnt ) { return true; }
virtual void CreateCustomNetworkStringTables( void ) { }
// Game Achievements (server version)
virtual void MarkAchievement ( IRecipientFilter& filter, char const *pchAchievementName );
virtual void ResetMapCycleTimeStamp( void ){ return; }
virtual void OnNavMeshLoad( void ) { return; }
virtual void UpdateGameplayStatsFromSteam( void ) { return; }
virtual edict_t *DoFindClientInPVS( edict_t *pEdict, unsigned char *pvs, unsigned pvssize );
#endif
virtual const char *GetGameTypeName( void ){ return NULL; }
virtual int GetGameType( void ){ return 0; }
virtual bool ForceSplitScreenPlayersOnToSameTeam() { return true; }
virtual bool IsTopDown() { return false; }
virtual const QAngle& GetTopDownMovementAxis() { return vec3_angle; }
// Assume the game doesn't care
virtual int GetMaxHumanPlayers() const { return -1; }
};
#ifndef CLIENT_DLL
void InstallGameRules();
// Create user messages for game here, calls into static player class creation functions
void RegisterUserMessages( void );
#endif
extern ConVar g_Language;
//-----------------------------------------------------------------------------
// Gets us at the game rules
//-----------------------------------------------------------------------------
extern CGameRules *g_pGameRules;
inline CGameRules* GameRules()
{
return g_pGameRules;
}
#ifdef PORTAL2
bool IsGameRulesMultiplayer();
#endif
#endif // GAMERULES_H

View File

@ -0,0 +1,66 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef GAMERULES_REGISTER_H
#define GAMERULES_REGISTER_H
#ifdef _WIN32
#pragma once
#endif
// Each game rules class must register using this in it's .cpp file.
#if !defined(_STATIC_LINKED)
#define REGISTER_GAMERULES_CLASS( className ) \
void __CreateGameRules_##className() { new className; } \
static CGameRulesRegister __g_GameRulesRegister_##className( #className, __CreateGameRules_##className );
#else
#define REGISTER_GAMERULES_CLASS( className ) \
void MAKE_NAME_UNIQUE(__CreateGameRules_)##className() { new className; } \
static CGameRulesRegister __g_GameRulesRegister_##className( #className, MAKE_NAME_UNIQUE(__CreateGameRules_)##className );
#endif
class CGameRulesRegister
{
public:
typedef void (*CreateGameRulesFn)();
CGameRulesRegister( const char *pClassName, CreateGameRulesFn fn );
// Allocates the gamerules object associated with this class.
void CreateGameRules();
static CGameRulesRegister* FindByName( const char *pName );
private:
const char *m_pClassName;
CreateGameRulesFn m_pFn;
CGameRulesRegister *m_pNext; // Links it into the global list.
static CGameRulesRegister *s_pHead;
};
#ifdef CLIENT_DLL
// The client forwards this call so the game rules manager can create the appropriate
// game rules class.
void InstallStringTableCallback_GameRules( const char *tableName );
#else
// Server calls this at startup.
void CreateNetworkStringTables_GameRules();
// Server calls this to install a specific game rules object. The class should have been registered
// with REGISTER_GAMERULES_CLASS.
void CreateGameRulesObject( const char *pClassName );
#endif
#endif // GAMERULES_REGISTER_H

View File

@ -201,7 +201,10 @@ public:
MAX_CHARS_PER_LINE = 128
};
CBaseHudChat(const char* pElementName);
explicit CBaseHudChat(const char* pElementName);
~CBaseHudChat();
static CBaseHudChat* GetHudChat(void);
virtual void CreateChatInputLine(void);
virtual void CreateChatLines(void);
@ -215,21 +218,20 @@ public:
virtual void Printf(int iFilter, PRINTF_FORMAT_STRING const char* fmt, ...);
virtual void ChatPrintf(int iPlayerIndex, int iFilter, PRINTF_FORMAT_STRING const char* fmt, ...) FMTFUNCTION(4, 5);
virtual void ChatPrintfW(int iPlayerIndex, int iFilter, const wchar_t* wszNotice);
virtual void StartMessageMode(int iMessageModeType);
virtual void StopMessageMode(void);
void Send(void);
MESSAGE_FUNC(OnChatEntrySend, "ChatEntrySend");
MESSAGE_FUNC(OnChatEntryStopMessageMode, "ChatEntryStopMessageMode");
//MESSAGE_FUNC(OnChatEntrySend, "ChatEntrySend");
//MESSAGE_FUNC(OnChatEntryStopMessageMode, "ChatEntryStopMessageMode");
virtual void ApplySchemeSettings(vgui::IScheme* pScheme);
virtual void Paint(void);
virtual void OnTick(void);
virtual void Reset();
#ifdef _XBOX
virtual bool ShouldDraw();
#endif
vgui::Panel* GetInputPanel(void);
static int m_nLineCounter;
@ -256,6 +258,8 @@ public:
virtual int GetFilterFlags(void) { return m_iFilterFlags; }
void SetFilterFlag(int iFilter);
virtual void SetChatPrompt(int iMessageModeType);
virtual Color GetDefaultTextColor(void);
virtual Color GetTextColorForClient(TextColor colorNum, int clientIndex);
virtual Color GetClientColor(int clientIndex);
@ -266,10 +270,10 @@ public:
bool IsVoiceSubtitle(void) { return m_bEnteringVoice; }
void SetVoiceSubtitleState(bool bState) { m_bEnteringVoice = bState; }
int GetMessageMode(void) { return m_nMessageMode; }
//int GetMessageMode(void) { return m_nMessageMode; }
void SetCustomColor(Color colNew) { m_ColorCustom = colNew; }
void SetCustomColor(const char* pszColorName);
//void SetCustomColor(Color colNew) { m_ColorCustom = colNew; }
//void SetCustomColor(const char* pszColorName);
protected:
CBaseHudChatLine* FindUnusedChatLine(void);
@ -283,7 +287,7 @@ protected:
CHudChatFilterButton* m_pFiltersButton;
CHudChatFilterPanel* m_pFilterPanel;
Color m_ColorCustom;
//Color m_ColorCustom;
private:
void Clear(void);
@ -292,7 +296,7 @@ private:
int m_nMessageMode;
int m_nVisibleHeight;
//int m_nVisibleHeight;
vgui::HFont m_hChatFont;

View File

@ -9,6 +9,9 @@
#include "networkvar.h"
#include "GameEventListener.h"
#include "memdbgon.h"
#include "panel2d.h"
#undef new
class CHudElement : public CGameEventListener
@ -16,9 +19,12 @@ class CHudElement : public CGameEventListener
public:
DECLARE_CLASS_NOBASE(CHudElement);
CHudElement(const char* pElementName);
CHudElement() {}
explicit CHudElement(const char* pElementName);
virtual ~CHudElement();
virtual void SetHud(CHud* pHud);
virtual void Init(void) { return; }
virtual void VidInit(void) { return; }
@ -29,6 +35,13 @@ public:
virtual void Reset(void) { return; }
virtual void ProcessInput(void) { return; }
// Called once per frame whether the element is visible or not
virtual void Think(void) { return; }
// Called when time warping occurs, i.e. when instant replay rewinds or forwards client's time
virtual void OnTimeJump(void) { return; }
virtual const char* GetName(void) const { return m_pElementName; };
virtual bool ShouldDraw(void);
@ -38,9 +51,15 @@ public:
virtual void SetHiddenBits(int iBits);
virtual void SetIgnoreGlobalHudDisable(bool hide);
virtual bool GetIgnoreGlobalHudDisable(void);
bool IsParentedToClientDLLRootPanel() const;
void SetParentedToClientDLLRootPanel(bool parented);
// Return true if this HUD element expects an entry in HudLayout.res
virtual bool WantsHudLayoutEntry(void) const { return true; }
void* operator new(size_t stAllocateBlock)
{
Assert(stAllocateBlock != 0);
@ -80,23 +99,40 @@ public:
virtual int GetRenderGroupPriority();
void SetSplitScreenPlayerSlot(int nSlot);
int GetSplitScreenPlayerSlot() const;
virtual void OnSplitScreenStateChanged() {}
public:
virtual void FireGameEvent(IGameEvent* event) {}
//protected:
void InitCHudElementAfterConstruction(const char* pElementName);
public:
bool m_bActive;
protected:
//protected:
int m_iHiddenBits;
int m_nSplitScreenPlayerSlot;
bool m_ignoreGlobalHudDisable;
private:
const char* m_pElementName;
//private:
const char* m_pElementName;
bool m_bNeedsRemove;
bool m_bIsParentedToClientDLLRootPanel;
CUtlVector< int > m_HudRenderGroups;
CHud* m_pHud;
//
panorama::CPanel2D* GetPanel2D()
{
return reinterpret_cast<panorama::CPanel2D*>(uintptr_t(this) - 0x14);
}
};
#include "utlpriorityqueue.h"

View File

@ -12,7 +12,8 @@
class IServer;
class INetMessage;
struct NetMessageCvar_t;
class CMsg_CVars;
//class CMsg_CVars;
#include "../ProtobuffMessages.h"
enum CrossPlayPlatform_t
{

View File

@ -52,6 +52,17 @@ public:
return getvfunc<SetModelIndexFn>(this, 2)(this + sizeof(uintptr_t) * 2, updateType);
}
Vector GetViewPos()
{
static auto EyePosition = reinterpret_cast<float* (__thiscall*)(void*, Vector*)>(
FindPatternV2("client.dll", "55 8B EC 56 8B 75 08 57 8B F9 56 8B 07 FF 90")
);
Vector output;
EyePosition(this, &output);
return output;
}
virtual CMouthInfo* GetMouth(void) = 0;
virtual bool GetSoundSpatialization(SpatializationInfo_t& info) = 0;

View File

@ -75,6 +75,9 @@ public:
virtual void RemoveListener(IGameEventListener2* listener) = 0;
// add a listener that listens to all events.
virtual bool AddListenerGlobal(IGameEventListener2* listener, bool bServerSide) = 0;
virtual IGameEvent* CreateEvent(const char* name, bool bForce = false) = 0;
virtual bool FireEvent(IGameEvent* event, bool bDontBroadcast = false) = 0;
@ -88,7 +91,7 @@ public:
virtual bool SerializeEvent(IGameEvent* event, bf_write* buf) = 0;
virtual IGameEvent* UnserializeEvent(bf_read* buf) = 0;
virtual KeyValues* GetEventDataTypes(IGameEvent* event) = 0;
//virtual KeyValues* GetEventDataTypes(IGameEvent* event) = 0;
};
class IGameEventListener

152
SpyCustom/sdk/igametypes.h Normal file
View File

@ -0,0 +1,152 @@
//========= Copyright (c) 1996-2011, Valve Corporation, All rights reserved. ============//
//
// Purpose: Game types and modes
//
// $NoKeywords: $
//=============================================================================//
#ifndef IGAME_TYPES_H
#define IGAME_TYPES_H
#ifdef _WIN32
#pragma once
#endif
#include "utlvector.h"
#include "utlstring.h"
#include "keyvalues.h"
abstract_class IGameTypes
{
public:
struct WeaponProgression
{
WeaponProgression()
: m_Kills(0)
{
}
CUtlString m_Name;
int m_Kills;
};
public:
virtual ~IGameTypes() {}
// Initialization. "force" will reload the data from file even if this interface has already been initialized.
virtual bool Initialize(bool force = false) = 0;
virtual bool IsInitialized(void) const = 0;
//
// Game Types and Modes
//
// Set the game type and mode convars from the given strings.
virtual bool SetGameTypeAndMode(const char* gameType, const char* gameMode) = 0;
virtual bool GetGameTypeAndModeFromAlias(const char* modeAlias, int& iOutGameType, int& iOutGameMode) = 0;
virtual bool SetGameTypeAndMode(int nGameType, int nGameMode) = 0;
virtual void SetAndParseExtendedServerInfo(KeyValues* pExtendedServerInfo) = 0;
virtual void CheckShouldSetDefaultGameModeAndType(const char* szMapNameFull) = 0;
// Get the indexes for the current game type and mode.
virtual int GetCurrentGameType() const = 0;
virtual int GetCurrentGameMode() const = 0;
virtual const char* GetCurrentMapName() = 0;
// Get the current game type and mode UI strings.
virtual const char* GetCurrentGameTypeNameID(void) = 0;
virtual const char* GetCurrentGameModeNameID(void) = 0;
// Apply the game mode convars for the current game type and mode.
virtual bool ApplyConvarsForCurrentMode(bool isMultiplayer) = 0;
// Output the values of the convars for the current game mode.
virtual void DisplayConvarsForCurrentMode(void) = 0;
// Returns the weapon progression for the current game type and mode.
virtual const CUtlVector< WeaponProgression >* GetWeaponProgressionForCurrentModeCT(void) = 0;
virtual const CUtlVector< WeaponProgression >* GetWeaponProgressionForCurrentModeT(void) = 0;
virtual int GetNoResetVoteThresholdForCurrentModeCT(void) = 0;
virtual int GetNoResetVoteThresholdForCurrentModeT(void) = 0;
virtual const char* GetGameTypeFromInt(int gameType) = 0;
virtual const char* GetGameModeFromInt(int gameType, int gameMode) = 0;
virtual bool GetGameModeAndTypeIntsFromStrings(const char* szGameType, const char* szGameMode, int& iOutGameType, int& iOutGameMode) = 0;
virtual bool GetGameModeAndTypeNameIdsFromStrings(const char* szGameType, const char* szGameMode, const char*& szOutGameTypeNameId, const char*& szOutGameModeNameId) = 0;
virtual bool CreateOrUpdateWorkshopMapGroup(const char* szName, const CUtlStringList& vecMapNames) = 0;
virtual bool IsWorkshopMapGroup(const char* szMapGroupName) = 0;
//
// Maps
//
// Get maps from mapgroup and get mapgroup from type and mode
virtual const char* GetRandomMapGroup(const char* gameType, const char* gameMode) = 0;
virtual const char* GetFirstMap(const char* mapGroup) = 0;
virtual const char* GetRandomMap(const char* mapGroup) = 0;
virtual const char* GetNextMap(const char* mapGroup, const char* mapName) = 0;
virtual int GetMaxPlayersForTypeAndMode(int iType, int iMode) = 0;
virtual bool IsValidMapGroupName(const char* mapGroup) = 0;
virtual bool IsValidMapInMapGroup(const char* mapGroup, const char* mapName) = 0;
virtual bool IsValidMapGroupForTypeAndMode(const char* mapGroup, const char* gameType, const char* gameMode) = 0;
// Apply the convars for the given map.
virtual bool ApplyConvarsForMap(const char* mapName, bool isMultiplayer) = 0;
// Get specifics about a map.
virtual bool GetMapInfo(const char* mapName, uint32& richPresence) = 0;
// Returns the available character model names (T or CT) for the given map.
virtual const CUtlStringList* GetTModelsForMap(const char* mapName) = 0;
virtual const CUtlStringList* GetCTModelsForMap(const char* mapName) = 0;
virtual const CUtlStringList* GetHostageModelsForMap(const char* mapName) = 0;
virtual const int GetDefaultGameTypeForMap(const char* mapName) = 0;
virtual const int GetDefaultGameModeForMap(const char* mapName) = 0;
// Returns the view model arms name (T or CT) for the given map.
virtual const char* GetTViewModelArmsForMap(const char* mapName) = 0;
virtual const char* GetCTViewModelArmsForMap(const char* mapName) = 0;
// Item requirements for the map
virtual const char* GetRequiredAttrForMap(const char* mapName) = 0;
virtual int GetRequiredAttrValueForMap(const char* mapName) = 0;
virtual const char* GetRequiredAttrRewardForMap(const char* mapName) = 0;
virtual int GetRewardDropListForMap(const char* mapName) = 0;
// Map group properties
virtual const CUtlStringList* GetMapGroupMapList(const char* mapGroup) = 0;
virtual bool GetRunMapWithDefaultGametype() = 0;
virtual void SetRunMapWithDefaultGametype(bool bDefaultGametype) = 0;
virtual bool GetLoadingScreenDataIsCorrect() = 0;
virtual void SetLoadingScreenDataIsCorrect(bool bLoadingScreenDataIsCorrect) = 0;
//
// Custom Bot Difficulty for Offline games
//
// Sets the bot difficulty for Offline games.
virtual bool SetCustomBotDifficulty(int botDiff) = 0;
// Returns the bot difficulty for Offline games.
virtual int GetCustomBotDifficulty(void) = 0;
virtual int GetCurrentServerNumSlots(void) = 0;
virtual int GetCurrentServerSettingInt(const char* szSetting, int iDefaultValue = 0) = 0;
virtual bool GetGameTypeFromMode(const char* szGameMode, const char*& pszGameTypeOut) = 0;
virtual bool LoadMapEntry(KeyValues* pKV) = 0;
};
#define VENGINE_GAMETYPES_VERSION "VENGINE_GAMETYPES_VERSION002"
#endif // IGAME_TYPES_H

View File

@ -14,22 +14,32 @@ class INetChannelInfo
public:
enum {
GENERIC = 0,
LOCALPLAYER,
OTHERPLAYERS,
ENTITIES,
SOUNDS,
EVENTS,
USERMESSAGES,
ENTMESSAGES,
VOICE,
STRINGTABLE,
MOVE,
STRINGCMD,
SIGNON,
TOTAL,
GENERIC = 0, // must be first and is default group
LOCALPLAYER, // bytes for local player entity update
OTHERPLAYERS, // bytes for other players update
ENTITIES, // all other entity bytes
SOUNDS, // game sounds
EVENTS, // event messages
TEMPENTS, // temp entities
USERMESSAGES, // user messages
ENTMESSAGES, // entity messages
VOICE, // voice data
STRINGTABLE, // a stringtable update
MOVE, // client move cmds
STRINGCMD, // string command
SIGNON, // various signondata
PAINTMAP, // paintmap data
ENCRYPTED, // encrypted data
TOTAL, // must be last and is not a real group
};
enum ENetworkEventType_t
{
k_ENetworkEventType_Generic = 0, // Generic network event
k_ENetworkEventType_TimedOut = 1, // Network connection timed out
};
virtual const char* GetName(void) const = 0;
virtual const char* GetAddress(void) const = 0;
virtual float GetTime(void) const = 0;

View File

@ -0,0 +1,192 @@
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
//===========================================================================//
#ifndef INETWORKSYSTEM_H
#define INETWORKSYSTEM_H
#ifdef _WIN32
#pragma once
#endif
#include "platform.h"
#include "iappsystem.h"
// This is the packet payload without any header bytes (which are attached for actual sending)
#define NET_MAX_PAYLOAD ( 262144 - 4) // largest message we can send in bytes
#define NET_MAX_PAYLOAD_BITS 18 // 2^NET_MAX_PAYLOAD_BITS > NET_MAX_PAYLOAD
// This is just the client_t->netchan.datagram buffer size (shouldn't ever need to be huge)
#define NET_MAX_DATAGRAM_PAYLOAD 4000 // = maximum unreliable playload size
// UDP has 28 byte headers
#define UDP_HEADER_SIZE (20+8) // IP = 20, UDP = 8
#define MAX_ROUTABLE_PAYLOAD 1200 // x360 requires <= 1260, but now that listen servers can support "steam" mediated sockets, steam enforces 1200 byte limit
#if (MAX_ROUTABLE_PAYLOAD & 3) != 0
#error Bit buffers must be a multiple of 4 bytes
#endif
#define MIN_ROUTABLE_PAYLOAD 16 // minimum playload size
#define NETMSG_TYPE_BITS 8 // must be 2^NETMSG_TYPE_BITS > SVC_LASTMSG
// This is the payload plus any header info (excluding UDP header)
#define HEADER_BYTES 9 // 2*4 bytes seqnr, 1 byte flags
// Pad this to next higher 16 byte boundary
// This is the largest packet that can come in/out over the wire, before processing the header
// bytes will be stripped by the networking channel layer
#define NET_MAX_MESSAGE PAD_NUMBER( ( NET_MAX_PAYLOAD + HEADER_BYTES ), 16 )
#define NET_HEADER_FLAG_SPLITPACKET -2
#define NET_HEADER_FLAG_COMPRESSEDPACKET -3
//-----------------------------------------------------------------------------
// Forward declarations:
//-----------------------------------------------------------------------------
class INetworkMessageHandler;
class INetworkMessage;
class INetChannel;
class INetworkMessageFactory;
class bf_read;
class bf_write;
typedef struct netadr_s netadr_t;
class CNetPacket;
//-----------------------------------------------------------------------------
// Default ports
//-----------------------------------------------------------------------------
enum
{
NETWORKSYSTEM_DEFAULT_SERVER_PORT = 27001,
NETWORKSYSTEM_DEFAULT_CLIENT_PORT = 27002
};
//-----------------------------------------------------------------------------
// This interface encompasses a one-way communication path between two
//-----------------------------------------------------------------------------
typedef int ConnectionHandle_t;
enum ConnectionStatus_t
{
CONNECTION_STATE_DISCONNECTED = 0,
CONNECTION_STATE_CONNECTING,
CONNECTION_STATE_CONNECTION_FAILED,
CONNECTION_STATE_CONNECTED,
};
//-----------------------------------------------------------------------------
// This interface encompasses a one-way communication path between two machines
//-----------------------------------------------------------------------------
//
// abstract_class INetChannel
// {
// public:
// // virtual INetworkMessageHandler *GetMsgHandler( void ) const = 0;
// virtual const netadr_t &GetRemoteAddress( void ) const = 0;
//
// // send a net message
// // NOTE: There are special connect/disconnect messages?
// virtual bool AddNetMsg( INetworkMessage *msg, bool bForceReliable = false ) = 0;
// // virtual bool RegisterMessage( INetworkMessage *msg ) = 0;
//
// virtual ConnectionStatus_t GetConnectionState( ) = 0;
//
// /*
// virtual ConnectTo( const netadr_t& to ) = 0;
// virtual Disconnect() = 0;
//
// virtual const netadr_t& GetLocalAddress() = 0;
//
// virtual const netadr_t& GetRemoteAddress() = 0;
// */
// };
//-----------------------------------------------------------------------------
// Network event types + structures
//-----------------------------------------------------------------------------
enum NetworkEventType_t
{
NETWORK_EVENT_CONNECTED = 0,
NETWORK_EVENT_DISCONNECTED,
NETWORK_EVENT_MESSAGE_RECEIVED,
};
struct NetworkEvent_t
{
NetworkEventType_t m_nType;
};
struct NetworkConnectionEvent_t : public NetworkEvent_t
{
INetChannel *m_pChannel;
};
struct NetworkDisconnectionEvent_t : public NetworkEvent_t
{
INetChannel *m_pChannel;
};
struct NetworkMessageReceivedEvent_t : public NetworkEvent_t
{
INetChannel *m_pChannel;
INetworkMessage *m_pNetworkMessage;
};
//-----------------------------------------------------------------------------
// Main interface for low-level networking (packet sending). This is a low-level interface
//-----------------------------------------------------------------------------
abstract_class INetworkSystem : public IAppSystem
{
public:
// Installs network message factories to be used with all connections
virtual bool RegisterMessage( INetworkMessage *msg ) = 0;
// Start, shutdown a server
virtual bool StartServer( unsigned short nServerListenPort = NETWORKSYSTEM_DEFAULT_SERVER_PORT ) = 0;
virtual void ShutdownServer( ) = 0;
// Process server-side network messages
virtual void ServerReceiveMessages() = 0;
virtual void ServerSendMessages() = 0;
// Start, shutdown a client
virtual bool StartClient( unsigned short nClientListenPort = NETWORKSYSTEM_DEFAULT_CLIENT_PORT ) = 0;
virtual void ShutdownClient( ) = 0;
// Process client-side network messages
virtual void ClientSendMessages() = 0;
virtual void ClientReceiveMessages() = 0;
// Connect, disconnect a client to a server
virtual INetChannel* ConnectClientToServer( const char *pServer, int nServerListenPort = NETWORKSYSTEM_DEFAULT_SERVER_PORT ) = 0;
virtual void DisconnectClientFromServer( INetChannel* pChan ) = 0;
// Event queue
virtual NetworkEvent_t *FirstNetworkEvent( ) = 0;
virtual NetworkEvent_t *NextNetworkEvent( ) = 0;
// Returns the local host name
virtual const char* GetLocalHostName( void ) const = 0;
virtual const char* GetLocalAddress( void ) const = 0;
/*
// NOTE: Server methods
// NOTE: There's only 1 client INetChannel ever
// There can be 0-N server INetChannels.
virtual INetChannel* CreateConnection( bool bIsClientConnection ) = 0;
// Add methods for setting unreliable payloads
*/
};
#endif // INETWORKSYSTEM_H

View File

@ -0,0 +1,63 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to app data in Steam
//
//=============================================================================
#ifndef ISTEAMAPPLIST_H
#define ISTEAMAPPLIST_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
#include "steamtypes.h"
//-----------------------------------------------------------------------------
// Purpose: This is a restricted interface that can only be used by previously approved apps,
// contact your Steam Account Manager if you believe you need access to this API.
// This interface lets you detect installed apps for the local Steam client, useful for debugging tools
// to offer lists of apps to debug via Steam.
//-----------------------------------------------------------------------------
class ISteamAppList
{
public:
virtual uint32 GetNumInstalledApps() = 0;
virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0;
virtual int GetAppName( AppId_t nAppID, OUT_STRING() 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

160
SpyCustom/sdk/isteamapps.h Normal file
View File

@ -0,0 +1,160 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to app data in Steam
//
//=============================================================================
#ifndef ISTEAMAPPS_H
#define ISTEAMAPPS_H
#ifdef _WIN32
#pragma once
#endif
const int k_cubAppProofOfPurchaseKeyMax = 240; // max supported length of a legacy cd key
//-----------------------------------------------------------------------------
// Purpose: interface to app data
//-----------------------------------------------------------------------------
class ISteamApps
{
public:
virtual bool BIsSubscribed() = 0;
virtual bool BIsLowViolence() = 0;
virtual bool BIsCybercafe() = 0;
virtual bool BIsVACBanned() = 0;
virtual const char *GetCurrentGameLanguage() = 0;
virtual const char *GetAvailableGameLanguages() = 0;
// only use this member if you need to check ownership of another game related to yours, a demo for example
virtual bool BIsSubscribedApp( AppId_t appID ) = 0;
// Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed
virtual bool BIsDlcInstalled( AppId_t appID ) = 0;
// returns the Unix time of the purchase of the app
virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0;
// Checks if the user is subscribed to the current app through a free weekend
// This function will return false for users who have a retail or other type of license
// Before using, please ask your Valve technical contact how to package and secure your free weekened
virtual bool BIsSubscribedFromFreeWeekend() = 0;
// Returns the number of DLC pieces for the running app
virtual int GetDLCCount() = 0;
// Returns metadata for DLC by index, of range [0, GetDLCCount()]
virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0;
// Install/Uninstall control for optional DLC
virtual void InstallDLC( AppId_t nAppID ) = 0;
virtual void UninstallDLC( AppId_t nAppID ) = 0;
// Request legacy cd-key for yourself or owned DLC. If you are interested in this
// data then make sure you provide us with a list of valid keys to be distributed
// to users when they purchase the game, before the game ships.
// You'll receive an AppProofOfPurchaseKeyResponse_t callback when
// the key is available (which may be immediately).
virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0;
virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch
virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing
virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order
// returns current app install folder for AppID, returns folder name length
virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0;
virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned)
virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed
// Returns the associated launch param if the game is run via steam://run/<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;
// get download progress for optional DLC
virtual bool GetDlcDownloadProgress( AppId_t nAppID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
// return the buildid of this app, may change at any time based on backend updates to the game
virtual int GetAppBuildId() = 0;
// Request all proof of purchase keys for the calling appid and asociated DLC.
// A series of AppProofOfPurchaseKeyResponse_t callbacks will be sent with
// appropriate appid values, ending with a final callback where the m_nAppId
// member is k_uAppIdInvalid (zero).
virtual void RequestAllProofOfPurchaseKeys() = 0;
};
#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION008"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: posted after the user gains ownership of DLC & that DLC is installed
//-----------------------------------------------------------------------------
struct DlcInstalled_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 5 };
AppId_t m_nAppID; // AppID of the DLC
};
//-----------------------------------------------------------------------------
// Purpose: possible results when registering an activation code
//-----------------------------------------------------------------------------
enum ERegisterActivationCodeResult
{
k_ERegisterActivationCodeResultOK = 0,
k_ERegisterActivationCodeResultFail = 1,
k_ERegisterActivationCodeResultAlreadyRegistered = 2,
k_ERegisterActivationCodeResultTimeout = 3,
k_ERegisterActivationCodeAlreadyOwned = 4,
};
//-----------------------------------------------------------------------------
// Purpose: response to RegisterActivationCode()
//-----------------------------------------------------------------------------
struct RegisterActivationCodeResponse_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 8 };
ERegisterActivationCodeResult m_eResult;
uint32 m_unPackageRegistered; // package that was registered. Only set on success
};
//---------------------------------------------------------------------------------
// Purpose: 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 };
};
//-----------------------------------------------------------------------------
// Purpose: response to RequestAppProofOfPurchaseKey/RequestAllProofOfPurchaseKeys
// for supporting third-party CD keys, or other proof-of-purchase systems.
//-----------------------------------------------------------------------------
struct AppProofOfPurchaseKeyResponse_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 21 };
EResult m_eResult;
uint32 m_nAppID;
uint32 m_cchKeyLength;
char m_rgchKey[k_cubAppProofOfPurchaseKeyMax];
};
#pragma pack( pop )
#endif // ISTEAMAPPS_H

View File

@ -0,0 +1,520 @@
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: Main interface for loading and accessing Steamworks API's from the
// Steam client.
// For most uses, this code is wrapped inside of SteamAPI_Init()
//=============================================================================
#ifndef ISTEAMCLIENT_H
#define ISTEAMCLIENT_H
#ifdef _WIN32
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
// Define compile time assert macros to let us validate the structure sizes.
#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1];
#ifndef REFERENCE
#define REFERENCE(arg) ((void)arg)
#endif
#if defined(STEAM_API_EXPORTS) && !defined(API_GEN)
#define STEAM_PRIVATE_API( ... ) __VA_ARGS__
#elif defined(STEAM_API_EXPORTS) && defined(API_GEN)
#define STEAM_PRIVATE_API( ... )
#else
#define STEAM_PRIVATE_API( ... ) protected: __VA_ARGS__ public:
#endif
#if defined(__linux__) || defined(__APPLE__)
// The 32-bit version of gcc has the alignment requirement for uint64 and double set to
// 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned.
// The 64-bit version of gcc has the alignment requirement for these types set to
// 8 meaning that unless we use #pragma pack(4) our structures will get bigger.
// The 64-bit structure packing has to match the 32-bit structure packing for each platform.
#define VALVE_CALLBACK_PACK_SMALL
#else
#define VALVE_CALLBACK_PACK_LARGE
#endif
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error ???
#endif
typedef struct ValvePackingSentinel_t
{
uint32 m_u32;
uint64 m_u64;
uint16 m_u16;
double m_d;
} ValvePackingSentinel_t;
#pragma pack( pop )
#if defined(VALVE_CALLBACK_PACK_SMALL)
VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 24 )
#elif defined(VALVE_CALLBACK_PACK_LARGE)
VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 32 )
#else
#error ???
#endif
// handle to a communication pipe to the Steam client
typedef int32 HSteamPipe;
// handle to single instance of a steam user
typedef int32 HSteamUser;
// function prototype
#if defined( POSIX )
#define __cdecl
#endif
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
extern "C" typedef uint32 ( *SteamAPI_CheckCallbackRegistered_t )( int iCallbackNum );
#if defined( __SNC__ )
#pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor
#endif
// interface predec
class ISteamUser;
class ISteamGameServer;
class ISteamFriends;
class ISteamUtils;
class ISteamMatchmaking;
class ISteamContentServer;
class ISteamMatchmakingServers;
class ISteamUserStats;
class ISteamApps;
class ISteamNetworking;
class ISteamRemoteStorage;
class ISteamScreenshots;
class ISteamMusic;
class ISteamMusicRemote;
class ISteamGameServerStats;
class ISteamPS3OverlayRender;
class ISteamHTTP;
class ISteamUnifiedMessages;
class ISteamController;
class ISteamUGC;
class ISteamAppList;
class ISteamHTMLSurface;
class ISteamInventory;
class ISteamVideo;
//-----------------------------------------------------------------------------
// Purpose: Interface to creating a new steam instance, or to
// connect to an existing steam instance, whether it's in a
// different process or is local.
//
// For most scenarios this is all handled automatically via SteamAPI_Init().
// You'll only need these APIs if you have a more complex versioning scheme,
// or if you want to implement a multiplexed gameserver where a single process
// is handling multiple games at once with independent gameserver SteamIDs.
//-----------------------------------------------------------------------------
class ISteamClient
{
public:
// Creates a communication pipe to the Steam client.
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamPipe CreateSteamPipe() = 0;
// Releases a previously created communications pipe
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0;
// connects to an existing global user, failing if none exists
// used by the game to coordinate with the steamUI
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0;
// used by game servers, create a steam user that won't be shared with anyone else
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) = 0;
// removes an allocated user
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0;
// retrieves the ISteamUser interface associated with the handle
virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// retrieves the ISteamGameServer interface associated with the handle
virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// set the local IP and Port to bind to
// this must be set before CreateLocalUser()
virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0;
// returns the ISteamFriends interface
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamUtils interface
virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmaking interface
virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmakingServers interface
virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the a generic interface
virtual void *GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamUserStats interface
virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamGameServerStats interface
virtual ISteamGameServerStats *GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns apps interface
virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// networking
virtual ISteamNetworking *GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// remote storage
virtual ISteamRemoteStorage *GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// user screenshots
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead.
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
// Every IPC call is at minimum a thread context switch if not a process one so you want to rate
// control how often you do them.
virtual uint32 GetIPCCallCount() = 0;
// API warning handling
// 'int' is the severity; 0 for msg, 1 for warning
// 'const char *' is the text of the message
// callbacks will occur directly after the API function is called that generated the warning or message.
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
// Trigger global shutdown for the DLL
virtual bool BShutdownIfAllPipesClosed() = 0;
// Expose HTTP interface
virtual ISteamHTTP *GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the ISteamUnifiedMessages interface
virtual ISteamUnifiedMessages *GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the ISteamController interface
virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the ISteamUGC interface
virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns app list interface, only available on specially registered apps
virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Music Player
virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Music Player Remote
virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
// html page display
virtual ISteamHTMLSurface *GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
// Helper functions for internal Steam usage
STEAM_PRIVATE_API( virtual void DEPRECATED_Set_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void DEPRECATED_Remove_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess( SteamAPI_CheckCallbackRegistered_t func ) = 0; )
// inventory
virtual ISteamInventory *GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Video
virtual ISteamVideo *GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
};
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient017"
//-----------------------------------------------------------------------------
// Purpose: Base values for callback identifiers, each callback must
// have a unique ID.
//-----------------------------------------------------------------------------
enum { k_iSteamUserCallbacks = 100 };
enum { k_iSteamGameServerCallbacks = 200 };
enum { k_iSteamFriendsCallbacks = 300 };
enum { k_iSteamBillingCallbacks = 400 };
enum { k_iSteamMatchmakingCallbacks = 500 };
enum { k_iSteamContentServerCallbacks = 600 };
enum { k_iSteamUtilsCallbacks = 700 };
enum { k_iClientFriendsCallbacks = 800 };
enum { k_iClientUserCallbacks = 900 };
enum { k_iSteamAppsCallbacks = 1000 };
enum { k_iSteamUserStatsCallbacks = 1100 };
enum { k_iSteamNetworkingCallbacks = 1200 };
enum { k_iClientRemoteStorageCallbacks = 1300 };
enum { k_iClientDepotBuilderCallbacks = 1400 };
enum { k_iSteamGameServerItemsCallbacks = 1500 };
enum { k_iClientUtilsCallbacks = 1600 };
enum { k_iSteamGameCoordinatorCallbacks = 1700 };
enum { k_iSteamGameServerStatsCallbacks = 1800 };
enum { k_iSteam2AsyncCallbacks = 1900 };
enum { k_iSteamGameStatsCallbacks = 2000 };
enum { k_iClientHTTPCallbacks = 2100 };
enum { k_iClientScreenshotsCallbacks = 2200 };
enum { k_iSteamScreenshotsCallbacks = 2300 };
enum { k_iClientAudioCallbacks = 2400 };
enum { k_iClientUnifiedMessagesCallbacks = 2500 };
enum { k_iSteamStreamLauncherCallbacks = 2600 };
enum { k_iClientControllerCallbacks = 2700 };
enum { k_iSteamControllerCallbacks = 2800 };
enum { k_iClientParentalSettingsCallbacks = 2900 };
enum { k_iClientDeviceAuthCallbacks = 3000 };
enum { k_iClientNetworkDeviceManagerCallbacks = 3100 };
enum { k_iClientMusicCallbacks = 3200 };
enum { k_iClientRemoteClientManagerCallbacks = 3300 };
enum { k_iClientUGCCallbacks = 3400 };
enum { k_iSteamStreamClientCallbacks = 3500 };
enum { k_IClientProductBuilderCallbacks = 3600 };
enum { k_iClientShortcutsCallbacks = 3700 };
enum { k_iClientRemoteControlManagerCallbacks = 3800 };
enum { k_iSteamAppListCallbacks = 3900 };
enum { k_iSteamMusicCallbacks = 4000 };
enum { k_iSteamMusicRemoteCallbacks = 4100 };
enum { k_iClientVRCallbacks = 4200 };
enum { k_iClientGameNotificationCallbacks = 4300 };
enum { k_iSteamGameNotificationCallbacks = 4400 };
enum { k_iSteamHTMLSurfaceCallbacks = 4500 };
enum { k_iClientVideoCallbacks = 4600 };
enum { k_iClientInventoryCallbacks = 4700 };
enum { k_iClientBluetoothManagerCallbacks = 4800 };
//-----------------------------------------------------------------------------
// The CALLBACK macros are for client side callback logging enabled with
// log_callback <first callnbackID> <last callbackID>
// Do not change any of these.
//-----------------------------------------------------------------------------
#ifdef STEAM_CALLBACK_INSPECTION_ENABLED
#define DEFINE_CALLBACK( callbackname, callbackid ) \
struct callbackname { \
typedef callbackname SteamCallback_t; \
enum { k_iCallback = callbackid }; \
static callbackname *GetNullPointer() { return 0; } \
static const char *GetCallbackName() { return #callbackname; } \
static uint32 GetCallbackID() { return callbackname::k_iCallback; }
#define CALLBACK_MEMBER( varidx, vartype, varname ) \
public: vartype varname ; \
static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \
varOffset = (unsigned int)(size_t)&GetNullPointer()->varname; \
varSize = sizeof( vartype ); \
varCount = 1; \
*pszName = #varname; *pszType = #vartype; }
#define CALLBACK_ARRAY( varidx, vartype, varname, varcount ) \
public: vartype varname [ varcount ]; \
static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \
varOffset = (unsigned int)(size_t)&GetNullPointer()->varname[0]; \
varSize = sizeof( vartype ); \
varCount = varcount; \
*pszName = #varname; *pszType = #vartype; }
#define END_CALLBACK_INTERNAL_BEGIN( numvars ) \
static uint32 GetNumMemberVariables() { return numvars; } \
static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \
switch ( index ) { default : return false;
#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true;
#define END_CALLBACK_INTERNAL_END() }; } };
#define END_DEFINE_CALLBACK_0() \
static uint32 GetNumMemberVariables() { return 0; } \
static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { REFERENCE( pszType ); REFERENCE( pszName ); REFERENCE( varCount ); REFERENCE( varSize ); REFERENCE( varOffset ); REFERENCE( index ); return false; } \
};
#else
#define DEFINE_CALLBACK( callbackname, callbackid ) struct callbackname { typedef callbackname SteamCallback_t; enum { k_iCallback = callbackid };
#define CALLBACK_MEMBER( varidx, vartype, varname ) public: vartype varname ;
#define CALLBACK_ARRAY( varidx, vartype, varname, varcount ) public: vartype varname [ varcount ];
#define END_CALLBACK_INTERNAL_BEGIN( numvars )
#define END_CALLBACK_INTERNAL_SWITCH( varidx )
#define END_CALLBACK_INTERNAL_END() };
#define END_DEFINE_CALLBACK_0() };
#endif
#define END_DEFINE_CALLBACK_1() \
END_CALLBACK_INTERNAL_BEGIN( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_2() \
END_CALLBACK_INTERNAL_BEGIN( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_3() \
END_CALLBACK_INTERNAL_BEGIN( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_4() \
END_CALLBACK_INTERNAL_BEGIN( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_5() \
END_CALLBACK_INTERNAL_BEGIN( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_6() \
END_CALLBACK_INTERNAL_BEGIN( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_7() \
END_CALLBACK_INTERNAL_BEGIN( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_8() \
END_CALLBACK_INTERNAL_BEGIN( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_9() \
END_CALLBACK_INTERNAL_BEGIN( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_10() \
END_CALLBACK_INTERNAL_BEGIN( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_11() \
END_CALLBACK_INTERNAL_BEGIN( 11 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_12() \
END_CALLBACK_INTERNAL_BEGIN( 12 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_13() \
END_CALLBACK_INTERNAL_BEGIN( 13 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
END_CALLBACK_INTERNAL_SWITCH( 12 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_14() \
END_CALLBACK_INTERNAL_BEGIN( 14 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
END_CALLBACK_INTERNAL_SWITCH( 12 ) \
END_CALLBACK_INTERNAL_SWITCH( 13 ) \
END_CALLBACK_INTERNAL_END()
#endif // ISTEAMCLIENT_H

View File

@ -0,0 +1,214 @@
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to valve controller
//
//=============================================================================
#ifndef ISTEAMCONTROLLER_H
#define ISTEAMCONTROLLER_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
#define STEAM_CONTROLLER_MAX_COUNT 16
#define STEAM_CONTROLLER_MAX_ANALOG_ACTIONS 16
#define STEAM_CONTROLLER_MAX_DIGITAL_ACTIONS 128
#define STEAM_CONTROLLER_MAX_ORIGINS 8
// When sending an option to a specific controller handle, you can send to all controllers via this command
#define STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS UINT64_MAX
#define STEAM_CONTROLLER_MIN_ANALOG_ACTION_DATA -1.0f
#define STEAM_CONTROLLER_MAX_ANALOG_ACTION_DATA 1.0f
enum ESteamControllerPad
{
k_ESteamControllerPad_Left,
k_ESteamControllerPad_Right
};
enum EControllerSource
{
k_EControllerSource_None,
k_EControllerSource_LeftTrackpad,
k_EControllerSource_RightTrackpad,
k_EControllerSource_Joystick,
k_EControllerSource_ABXY,
k_EControllerSource_Switch,
k_EControllerSource_LeftTrigger,
k_EControllerSource_RightTrigger,
k_EControllerSource_Gyro,
k_EControllerSource_Count
};
enum EControllerSourceMode
{
k_EControllerSourceMode_None,
k_EControllerSourceMode_Dpad,
k_EControllerSourceMode_Buttons,
k_EControllerSourceMode_FourButtons,
k_EControllerSourceMode_AbsoluteMouse,
k_EControllerSourceMode_RelativeMouse,
k_EControllerSourceMode_JoystickMove,
k_EControllerSourceMode_JoystickCamera,
k_EControllerSourceMode_ScrollWheel,
k_EControllerSourceMode_Trigger,
k_EControllerSourceMode_TouchMenu,
k_EControllerSourceMode_MouseJoystick,
k_EControllerSourceMode_MouseRegion
};
enum EControllerActionOrigin
{
k_EControllerActionOrigin_None,
k_EControllerActionOrigin_A,
k_EControllerActionOrigin_B,
k_EControllerActionOrigin_X,
k_EControllerActionOrigin_Y,
k_EControllerActionOrigin_LeftBumper,
k_EControllerActionOrigin_RightBumper,
k_EControllerActionOrigin_LeftGrip,
k_EControllerActionOrigin_RightGrip,
k_EControllerActionOrigin_Start,
k_EControllerActionOrigin_Back,
k_EControllerActionOrigin_LeftPad_Touch,
k_EControllerActionOrigin_LeftPad_Swipe,
k_EControllerActionOrigin_LeftPad_Click,
k_EControllerActionOrigin_LeftPad_DPadNorth,
k_EControllerActionOrigin_LeftPad_DPadSouth,
k_EControllerActionOrigin_LeftPad_DPadWest,
k_EControllerActionOrigin_LeftPad_DPadEast,
k_EControllerActionOrigin_RightPad_Touch,
k_EControllerActionOrigin_RightPad_Swipe,
k_EControllerActionOrigin_RightPad_Click,
k_EControllerActionOrigin_RightPad_DPadNorth,
k_EControllerActionOrigin_RightPad_DPadSouth,
k_EControllerActionOrigin_RightPad_DPadWest,
k_EControllerActionOrigin_RightPad_DPadEast,
k_EControllerActionOrigin_LeftTrigger_Pull,
k_EControllerActionOrigin_LeftTrigger_Click,
k_EControllerActionOrigin_RightTrigger_Pull,
k_EControllerActionOrigin_RightTrigger_Click,
k_EControllerActionOrigin_LeftStick_Move,
k_EControllerActionOrigin_LeftStick_Click,
k_EControllerActionOrigin_LeftStick_DPadNorth,
k_EControllerActionOrigin_LeftStick_DPadSouth,
k_EControllerActionOrigin_LeftStick_DPadWest,
k_EControllerActionOrigin_LeftStick_DPadEast,
k_EControllerActionOrigin_Gyro_Move,
k_EControllerActionOrigin_Gyro_Pitch,
k_EControllerActionOrigin_Gyro_Yaw,
k_EControllerActionOrigin_Gyro_Roll,
k_EControllerActionOrigin_Count
};
// ControllerHandle_t is used to refer to a specific controller.
// This handle will consistently identify a controller, even if it is disconnected and re-connected
typedef uint64 ControllerHandle_t;
// These handles are used to refer to a specific in-game action or action set
// All action handles should be queried during initialization for performance reasons
typedef uint64 ControllerActionSetHandle_t;
typedef uint64 ControllerDigitalActionHandle_t;
typedef uint64 ControllerAnalogActionHandle_t;
#pragma pack( push, 1 )
struct ControllerAnalogActionData_t
{
// Type of data coming from this action, this will match what got specified in the action set
EControllerSourceMode eMode;
// The current state of this action; will be delta updates for mouse actions
float x, y;
// Whether or not this action is currently available to be bound in the active action set
bool bActive;
};
struct ControllerDigitalActionData_t
{
// The current state of this action; will be true if currently pressed
bool bState;
// Whether or not this action is currently available to be bound in the active action set
bool bActive;
};
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Native Steam controller support API
//-----------------------------------------------------------------------------
class ISteamController
{
public:
// Init and Shutdown must be called when starting/ending use of this interface
virtual bool Init() = 0;
virtual bool Shutdown() = 0;
// Synchronize API state with the latest Steam Controller inputs available. This
// is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest
// possible latency, you call this directly before reading controller state.
virtual void RunFrame() = 0;
// Enumerate currently connected controllers
// handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles
// Returns the number of handles written to handlesOut
virtual int GetConnectedControllers( ControllerHandle_t *handlesOut ) = 0;
// Invokes the Steam overlay and brings up the binding screen
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
virtual bool ShowBindingPanel( ControllerHandle_t controllerHandle ) = 0;
// ACTION SETS
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0;
// Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')
// This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in
// your state loops, instead of trying to place it in all of your state transitions.
virtual void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) = 0;
virtual ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) = 0;
// ACTIONS
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0;
// Returns the current state of the supplied digital game action
virtual ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) = 0;
// Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
virtual int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin *originsOut ) = 0;
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) = 0;
// Returns the current state of these supplied analog game action
virtual ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) = 0;
// Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
virtual int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin *originsOut ) = 0;
virtual void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) = 0;
// Trigger a haptic pulse on a controller
virtual void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0;
virtual void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0;
};
#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController003"
#endif // ISTEAMCONTROLLER_H

View File

@ -0,0 +1,636 @@
//====== Copyright (C) 1996-2008, Valve Corporation, All rights reserved. =====
//
// Purpose: interface to both friends list data and general information about users
//
//=============================================================================
#ifndef ISTEAMFRIENDS_H
#define ISTEAMFRIENDS_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
#include "steamclientpublic.h"
//-----------------------------------------------------------------------------
// Purpose: set of relationships to other users
//-----------------------------------------------------------------------------
enum EFriendRelationship
{
k_EFriendRelationshipNone = 0,
k_EFriendRelationshipBlocked = 1, // this doesn't get stored; the user has just done an Ignore on an friendship invite
k_EFriendRelationshipRequestRecipient = 2,
k_EFriendRelationshipFriend = 3,
k_EFriendRelationshipRequestInitiator = 4,
k_EFriendRelationshipIgnored = 5, // this is stored; the user has explicit blocked this other user from comments/chat/etc
k_EFriendRelationshipIgnoredFriend = 6,
k_EFriendRelationshipSuggested = 7,
// keep this updated
k_EFriendRelationshipMax = 8,
};
// maximum length of friend group name (not including terminating nul!)
const int k_cchMaxFriendsGroupName = 64;
// maximum number of groups a single user is allowed
const int k_cFriendsGroupLimit = 100;
// friends group identifier type
typedef int16 FriendsGroupID_t;
// invalid friends group identifier constant
const FriendsGroupID_t k_FriendsGroupID_Invalid = -1;
const int k_cEnumerateFollowersMax = 50;
//-----------------------------------------------------------------------------
// Purpose: list of states a friend can be in
//-----------------------------------------------------------------------------
enum EPersonaState
{
k_EPersonaStateOffline = 0, // friend is not currently logged on
k_EPersonaStateOnline = 1, // friend is logged on
k_EPersonaStateBusy = 2, // user is on, but busy
k_EPersonaStateAway = 3, // auto-away feature
k_EPersonaStateSnooze = 4, // auto-away for a long time
k_EPersonaStateLookingToTrade = 5, // Online, trading
k_EPersonaStateLookingToPlay = 6, // Online, wanting to play
k_EPersonaStateMax,
};
//-----------------------------------------------------------------------------
// Purpose: flags for enumerating friends list, or quickly checking a the relationship between users
//-----------------------------------------------------------------------------
enum EFriendFlags
{
k_EFriendFlagNone = 0x00,
k_EFriendFlagBlocked = 0x01,
k_EFriendFlagFriendshipRequested = 0x02,
k_EFriendFlagImmediate = 0x04, // "regular" friend
k_EFriendFlagClanMember = 0x08,
k_EFriendFlagOnGameServer = 0x10,
// k_EFriendFlagHasPlayedWith = 0x20, // not currently used
// k_EFriendFlagFriendOfFriend = 0x40, // not currently used
k_EFriendFlagRequestingFriendship = 0x80,
k_EFriendFlagRequestingInfo = 0x100,
k_EFriendFlagIgnored = 0x200,
k_EFriendFlagIgnoredFriend = 0x400,
k_EFriendFlagSuggested = 0x800,
k_EFriendFlagChatMember = 0x1000,
k_EFriendFlagAll = 0xFFFF,
};
// friend game played information
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
struct FriendGameInfo_t
{
CGameID m_gameID;
uint32 m_unGameIP;
uint16 m_usGamePort;
uint16 m_usQueryPort;
CSteamID m_steamIDLobby;
};
#pragma pack( pop )
// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16.
// The UTF-8 version has to be very generous to accomodate characters that get large when encoded
// in UTF-8.
enum
{
k_cchPersonaNameMax = 128,
k_cwchPersonaNameMax = 32,
};
//-----------------------------------------------------------------------------
// Purpose: user restriction flags
//-----------------------------------------------------------------------------
enum EUserRestriction
{
k_nUserRestrictionNone = 0, // no known chat/content restriction
k_nUserRestrictionUnknown = 1, // we don't know yet (user offline)
k_nUserRestrictionAnyChat = 2, // user is not allowed to (or can't) send/recv any chat
k_nUserRestrictionVoiceChat = 4, // user is not allowed to (or can't) send/recv voice chat
k_nUserRestrictionGroupChat = 8, // user is not allowed to (or can't) send/recv group chat
k_nUserRestrictionRating = 16, // user is too young according to rating in current region
k_nUserRestrictionGameInvites = 32, // user cannot send or recv game invites (e.g. mobile)
k_nUserRestrictionTrading = 64, // user cannot participate in trading (console, mobile)
};
//-----------------------------------------------------------------------------
// Purpose: information about user sessions
//-----------------------------------------------------------------------------
struct FriendSessionStateInfo_t
{
uint32 m_uiOnlineSessionInstances;
uint8 m_uiPublishedToFriendsSessionInstance;
};
// size limit on chat room or member metadata
const uint32 k_cubChatMetadataMax = 8192;
// size limits on Rich Presence data
enum { k_cchMaxRichPresenceKeys = 20 };
enum { k_cchMaxRichPresenceKeyLength = 64 };
enum { k_cchMaxRichPresenceValueLength = 256 };
// These values are passed as parameters to the store
enum EOverlayToStoreFlag
{
k_EOverlayToStoreFlag_None = 0,
k_EOverlayToStoreFlag_AddToCart = 1,
k_EOverlayToStoreFlag_AddToCartAndShow = 2,
};
//-----------------------------------------------------------------------------
// Purpose: interface to accessing information about individual users,
// that can be a friend, in a group, on a game server or in a lobby with the local user
//-----------------------------------------------------------------------------
class ISteamFriends
{
public:
// returns the local players name - guaranteed to not be NULL.
// this is the same name as on the users community profile page
// this is stored in UTF-8 format
// like all the other interface functions that return a char *, it's important that this pointer is not saved
// off; it will eventually be free'd or re-allocated
virtual const char *GetPersonaName() = 0;
// Sets the player name, stores it on the server and publishes the changes to all friends who are online.
// Changes take place locally immediately, and a PersonaStateChange_t is posted, presuming success.
//
// The final results are available through the return value SteamAPICall_t, using SetPersonaNameResponse_t.
//
// If the name change fails to happen on the server, then an additional global PersonaStateChange_t will be posted
// to change the name back, in addition to the SetPersonaNameResponse_t callback.
CALL_RESULT( SetPersonaNameResponse_t )
virtual SteamAPICall_t SetPersonaName( const char *pchPersonaName ) = 0;
// gets the status of the current user
virtual EPersonaState GetPersonaState() = 0;
// friend iteration
// takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria
// then GetFriendByIndex() can then be used to return the id's of each of those users
virtual int GetFriendCount( int iFriendFlags ) = 0;
// returns the steamID of a user
// iFriend is a index of range [0, GetFriendCount())
// iFriendsFlags must be the same value as used in GetFriendCount()
// the returned CSteamID can then be used by all the functions below to access details about the user
virtual CSteamID GetFriendByIndex( int iFriend, int iFriendFlags ) = 0;
// returns a relationship to a user
virtual EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend ) = 0;
// returns the current status of the specified user
// this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user
virtual EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) = 0;
// returns the name another user - guaranteed to not be NULL.
// same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
// note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
//
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;
// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details
virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo ) = 0;
// accesses old friends names - returns an empty string when their are no more items in the history
virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0;
// friends steam level
virtual int GetFriendSteamLevel( CSteamID steamIDFriend ) = 0;
// Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player.
virtual const char *GetPlayerNickname( CSteamID steamIDPlayer ) = 0;
// friend grouping (tag) apis
// returns the number of friends groups
virtual int GetFriendsGroupCount() = 0;
// returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid)
virtual FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG ) = 0;
// returns the name for the given friends group (NULL in the case of invalid friends group IDs)
virtual const char *GetFriendsGroupName( FriendsGroupID_t friendsGroupID ) = 0;
// returns the number of members in a given friends group
virtual int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID ) = 0;
// gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid
virtual void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID ) CSteamID *pOutSteamIDMembers, int nMembersCount ) = 0;
// returns true if the specified user meets any of the criteria specified in iFriendFlags
// iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values
virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0;
// clan (group) iteration and access functions
virtual int GetClanCount() = 0;
virtual CSteamID GetClanByIndex( int iClan ) = 0;
virtual const char *GetClanName( CSteamID steamIDClan ) = 0;
virtual const char *GetClanTag( CSteamID steamIDClan ) = 0;
// returns the most recent information we have about what's happening in a clan
virtual bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting ) = 0;
// for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest
virtual SteamAPICall_t DownloadClanActivityCounts( ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest ) = 0;
// iterators for getting users in a chat room, lobby, game server or clan
// note that large clans that cannot be iterated by the local user
// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
// steamIDSource can be the steamID of a group, game server, lobby or chat room
virtual int GetFriendCountFromSource( CSteamID steamIDSource ) = 0;
virtual CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend ) = 0;
// returns true if the local user can see that steamIDUser is a member or in steamIDSource
virtual bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource ) = 0;
// User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI)
virtual void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) = 0;
// activates the game overlay, with an optional dialog to open
// valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements"
virtual void ActivateGameOverlay( const char *pchDialog ) = 0;
// activates game overlay to a specific place
// valid options are
// "steamid" - opens the overlay web browser to the specified user or groups profile
// "chat" - opens a chat window to the specified user, or joins the group chat
// "jointrade" - opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API
// "stats" - opens the overlay web browser to the specified user's stats
// "achievements" - opens the overlay web browser to the specified user's achievements
// "friendadd" - opens the overlay in minimal mode prompting the user to add the target user as a friend
// "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend
// "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite
// "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite
virtual void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID ) = 0;
// activates game overlay web browser directly to the specified URL
// full address with protocol type is required, e.g. http://www.steamgames.com/
virtual void ActivateGameOverlayToWebPage( const char *pchURL ) = 0;
// activates game overlay to store page for app
virtual void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag ) = 0;
// Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is
// in game
virtual void SetPlayedWith( CSteamID steamIDUserPlayedWith ) = 0;
// activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby.
virtual void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby ) = 0;
// gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
virtual int GetSmallFriendAvatar( CSteamID steamIDFriend ) = 0;
// gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
virtual int GetMediumFriendAvatar( CSteamID steamIDFriend ) = 0;
// gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
// returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again
virtual int GetLargeFriendAvatar( CSteamID steamIDFriend ) = 0;
// requests information about a user - persona name & avatar
// if bRequireNameOnly is set, then the avatar of a user isn't downloaded
// - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them
// if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved
// if returns false, it means that we already have all the details about that user, and functions can be called immediately
virtual bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) = 0;
// requests information about a clan officer list
// when complete, data is returned in ClanOfficerListResponse_t call result
// this makes available the calls below
// you can only ask about clans that a user is a member of
// note that this won't download avatars automatically; if you get an officer,
// and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar
CALL_RESULT( ClanOfficerListResponse_t )
virtual SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) = 0;
// iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed
// returns the steamID of the clan owner
virtual CSteamID GetClanOwner( CSteamID steamIDClan ) = 0;
// returns the number of officers in a clan (including the owner)
virtual int GetClanOfficerCount( CSteamID steamIDClan ) = 0;
// returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)
virtual CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer ) = 0;
// if current user is chat restricted, he can't send or receive any text/voice chat messages.
// the user can't see custom avatars. But the user can be online and send/recv game invites.
// a chat restricted user can't add friends or join any groups.
virtual uint32 GetUserRestrictions() = 0;
// Rich Presence data is automatically shared between friends who are in the same game
// Each user has a set of Key/Value pairs
// Up to 20 different keys can be set
// There are two magic keys:
// "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list
// "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game
// GetFriendRichPresence() returns an empty string "" if no value is set
// SetRichPresence() to a NULL or an empty string deletes the key
// You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount()
// and GetFriendRichPresenceKeyByIndex() (typically only used for debugging)
virtual bool SetRichPresence( const char *pchKey, const char *pchValue ) = 0;
virtual void ClearRichPresence() = 0;
virtual const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey ) = 0;
virtual int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend ) = 0;
virtual const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey ) = 0;
// Requests rich presence for a specific user.
virtual void RequestFriendRichPresence( CSteamID steamIDFriend ) = 0;
// rich invite support
// if the target accepts the invite, the pchConnectString gets added to the command-line for launching the game
// if the game is already running, a GameRichPresenceJoinRequested_t callback is posted containing the connect string
// invites can only be sent to friends
virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0;
// recently-played-with friends iteration
// this iterates the entire list of users recently played with, across games
// GetFriendCoplayTime() returns as a unix time
virtual int GetCoplayFriendCount() = 0;
virtual CSteamID GetCoplayFriend( int iCoplayFriend ) = 0;
virtual int GetFriendCoplayTime( CSteamID steamIDFriend ) = 0;
virtual AppId_t GetFriendCoplayGame( CSteamID steamIDFriend ) = 0;
// chat interface for games
// this allows in-game access to group (clan) chats from in the game
// the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay
// use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat
CALL_RESULT( JoinClanChatRoomCompletionResult_t )
virtual SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan ) = 0;
virtual bool LeaveClanChatRoom( CSteamID steamIDClan ) = 0;
virtual int GetClanChatMemberCount( CSteamID steamIDClan ) = 0;
virtual CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) = 0;
virtual bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) = 0;
virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, OUT_STRUCT() CSteamID *psteamidChatter ) = 0;
virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0;
// interact with the Steam (game overlay / desktop)
virtual bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat ) = 0;
virtual bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0;
virtual bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0;
// peer-to-peer chat interception
// this is so you can show P2P chats inline in the game
virtual bool SetListenForFriendsMessages( bool bInterceptEnabled ) = 0;
virtual bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend ) = 0;
virtual int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
// following apis
CALL_RESULT( FriendsGetFollowerCount_t )
virtual SteamAPICall_t GetFollowerCount( CSteamID steamID ) = 0;
CALL_RESULT( FriendsIsFollowing_t )
virtual SteamAPICall_t IsFollowing( CSteamID steamID ) = 0;
CALL_RESULT( FriendsEnumerateFollowingList_t )
virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0;
};
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends015"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: called when a friends' status changes
//-----------------------------------------------------------------------------
struct PersonaStateChange_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 4 };
uint64 m_ulSteamID; // steamID of the friend who changed
int m_nChangeFlags; // what's changed
};
// used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user
// these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend
enum EPersonaChange
{
k_EPersonaChangeName = 0x0001,
k_EPersonaChangeStatus = 0x0002,
k_EPersonaChangeComeOnline = 0x0004,
k_EPersonaChangeGoneOffline = 0x0008,
k_EPersonaChangeGamePlayed = 0x0010,
k_EPersonaChangeGameServer = 0x0020,
k_EPersonaChangeAvatar = 0x0040,
k_EPersonaChangeJoinedSource= 0x0080,
k_EPersonaChangeLeftSource = 0x0100,
k_EPersonaChangeRelationshipChanged = 0x0200,
k_EPersonaChangeNameFirstSet = 0x0400,
k_EPersonaChangeFacebookInfo = 0x0800,
k_EPersonaChangeNickname = 0x1000,
k_EPersonaChangeSteamLevel = 0x2000,
};
//-----------------------------------------------------------------------------
// Purpose: posted when game overlay activates or deactivates
// the game can use this to be pause or resume single player games
//-----------------------------------------------------------------------------
struct GameOverlayActivated_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 31 };
uint8 m_bActive; // true if it's just been activated, false otherwise
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a different game server from their friends list
// game client should attempt to connect to specified server when this is received
//-----------------------------------------------------------------------------
struct GameServerChangeRequested_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 32 };
char m_rgchServer[64]; // server address ("127.0.0.1:27015", "tf2.valvesoftware.com")
char m_rgchPassword[64]; // server password, if any
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a lobby from their friends list
// game client should attempt to connect to specified lobby when this is received
//-----------------------------------------------------------------------------
struct GameLobbyJoinRequested_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 33 };
CSteamID m_steamIDLobby;
// The friend they did the join via (will be invalid if not directly via a friend)
//
// On PS3, the friend will be invalid if this was triggered by a PSN invite via the XMB, but
// the account type will be console user so you can tell at least that this was from a PSN friend
// rather than a Steam friend.
CSteamID m_steamIDFriend;
};
//-----------------------------------------------------------------------------
// Purpose: called when an avatar is loaded in from a previous GetLargeFriendAvatar() call
// if the image wasn't already available
//-----------------------------------------------------------------------------
struct AvatarImageLoaded_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 34 };
CSteamID m_steamID; // steamid the avatar has been loaded for
int m_iImage; // the image index of the now loaded image
int m_iWide; // width of the loaded image
int m_iTall; // height of the loaded image
};
//-----------------------------------------------------------------------------
// Purpose: marks the return of a request officer list call
//-----------------------------------------------------------------------------
struct ClanOfficerListResponse_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 35 };
CSteamID m_steamIDClan;
int m_cOfficers;
uint8 m_bSuccess;
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating updated data about friends rich presence information
//-----------------------------------------------------------------------------
struct FriendRichPresenceUpdate_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 36 };
CSteamID m_steamIDFriend; // friend who's rich presence has changed
AppId_t m_nAppID; // the appID of the game (should always be the current game)
};
//-----------------------------------------------------------------------------
// Purpose: called when the user tries to join a game from their friends list
// rich presence will have been set with the "connect" key which is set here
//-----------------------------------------------------------------------------
struct GameRichPresenceJoinRequested_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 37 };
CSteamID m_steamIDFriend; // the friend they did the join via (will be invalid if not directly via a friend)
char m_rgchConnect[k_cchMaxRichPresenceValueLength];
};
//-----------------------------------------------------------------------------
// Purpose: a chat message has been received for a clan chat the game has joined
//-----------------------------------------------------------------------------
struct GameConnectedClanChatMsg_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 38 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
int m_iMessageID;
};
//-----------------------------------------------------------------------------
// Purpose: a user has joined a clan chat
//-----------------------------------------------------------------------------
struct GameConnectedChatJoin_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 39 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
};
//-----------------------------------------------------------------------------
// Purpose: a user has left the chat we're in
//-----------------------------------------------------------------------------
struct GameConnectedChatLeave_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 40 };
CSteamID m_steamIDClanChat;
CSteamID m_steamIDUser;
bool m_bKicked; // true if admin kicked
bool m_bDropped; // true if Steam connection dropped
};
//-----------------------------------------------------------------------------
// Purpose: a DownloadClanActivityCounts() call has finished
//-----------------------------------------------------------------------------
struct DownloadClanActivityCountsResult_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 41 };
bool m_bSuccess;
};
//-----------------------------------------------------------------------------
// Purpose: a JoinClanChatRoom() call has finished
//-----------------------------------------------------------------------------
struct JoinClanChatRoomCompletionResult_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 42 };
CSteamID m_steamIDClanChat;
EChatRoomEnterResponse m_eChatRoomEnterResponse;
};
//-----------------------------------------------------------------------------
// Purpose: a chat message has been received from a user
//-----------------------------------------------------------------------------
struct GameConnectedFriendChatMsg_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 43 };
CSteamID m_steamIDUser;
int m_iMessageID;
};
struct FriendsGetFollowerCount_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 44 };
EResult m_eResult;
CSteamID m_steamID;
int m_nCount;
};
struct FriendsIsFollowing_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 45 };
EResult m_eResult;
CSteamID m_steamID;
bool m_bIsFollowing;
};
struct FriendsEnumerateFollowingList_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 46 };
EResult m_eResult;
CSteamID m_rgSteamID[ k_cEnumerateFollowersMax ];
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
};
//-----------------------------------------------------------------------------
// Purpose: reports the result of an attempt to change the user's persona name
//-----------------------------------------------------------------------------
struct SetPersonaNameResponse_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 47 };
bool m_bSuccess; // true if name change succeeded completely.
bool m_bLocalSuccess; // true if name change was retained locally. (We might not have been able to communicate with Steam)
EResult m_result; // detailed result code
};
#pragma pack( pop )
#endif // ISTEAMFRIENDS_H

View File

@ -0,0 +1,75 @@
//====== Copyright ©, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to the game coordinator for this application
//
//=============================================================================
#ifndef ISTEAMGAMECOORDINATOR
#define ISTEAMGAMECOORDINATOR
#ifdef _WIN32
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
// list of possible return values from the ISteamGameCoordinator API
enum EGCResults
{
k_EGCResultOK = 0,
k_EGCResultNoMessage = 1, // There is no message in the queue
k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message
k_EGCResultNotLoggedOn = 3, // The client is not logged onto Steam
k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage
};
//-----------------------------------------------------------------------------
// Purpose: Functions for sending and receiving messages from the Game Coordinator
// for this application
//-----------------------------------------------------------------------------
class ISteamGameCoordinator
{
public:
// sends a message to the Game Coordinator
virtual EGCResults SendMessage(int unMsgType, const void *pubData, int cubData ) = 0;
// returns true if there is a message waiting from the game coordinator
virtual bool IsMessageAvailable(int*pcubMsgSize ) = 0;
// fills the provided buffer with the first message in the queue and returns k_EGCResultOK or
// returns k_EGCResultNoMessage if there is no message waiting. pcubMsgSize is filled with the message size.
// If the provided buffer is not large enough to fit the entire message, k_EGCResultBufferTooSmall is returned
// and the message remains at the head of the queue.
virtual EGCResults RetrieveMessage(int*punMsgType, void *pubDest, int cubDest, int*pcubMsgSize ) = 0;
};
#define STEAMGAMECOORDINATOR_INTERFACE_VERSION "SteamGameCoordinator001"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
// callback notification - A new message is available for reading from the message queue
struct GCMessageAvailable_t
{
enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 1 };
uint32 m_nMessageSize;
};
// callback notification - A message failed to make it to the GC. It may be down temporarily
struct GCMessageFailed_t
{
enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 2 };
};
#pragma pack( pop )
#endif // ISTEAMGAMECOORDINATOR

View File

@ -0,0 +1,453 @@
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to display html pages in a texture
//
//=============================================================================
#ifndef ISTEAMHTMLSURFACE_H
#define ISTEAMHTMLSURFACE_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
typedef uint32 HHTMLBrowser;
const uint32 INVALID_HTMLBROWSER = 0;
//-----------------------------------------------------------------------------
// Purpose: Functions for displaying HTML pages and interacting with them
//-----------------------------------------------------------------------------
class ISteamHTMLSurface
{
public:
virtual ~ISteamHTMLSurface() {}
// Must call init and shutdown when starting/ending use of the interface
virtual bool Init() = 0;
virtual bool Shutdown() = 0;
// Create a browser object for display of a html page, when creation is complete the call handle
// will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser.
// The user agent string is a substring to be added to the general user agent string so you can
// identify your client on web servers.
// The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if
// you do not require this functionality.
//
// YOU MUST HAVE IMPLEMENTED HANDLERS FOR HTML_BrowserReady_t, HTML_StartRequest_t,
// HTML_JSAlert_t, HTML_JSConfirm_t, and HTML_FileOpenDialog_t! See the CALLBACKS
// section of this interface (AllowStartRequest, etc) for more details. If you do
// not implement these callback handlers, the browser may appear to hang instead of
// navigating to new pages or triggering javascript popups.
//
CALL_RESULT( HTML_BrowserReady_t )
virtual SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS ) = 0;
// Call this when you are done with a html surface, this lets us free the resources being used by it
virtual void RemoveBrowser( HHTMLBrowser unBrowserHandle ) = 0;
// Navigate to this URL, results in a HTML_StartRequest_t as the request commences
virtual void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchPostData ) = 0;
// Tells the surface the size in pixels to display the surface
virtual void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight ) = 0;
// Stop the load of the current html page
virtual void StopLoad( HHTMLBrowser unBrowserHandle ) = 0;
// Reload (most likely from local cache) the current page
virtual void Reload( HHTMLBrowser unBrowserHandle ) = 0;
// navigate back in the page history
virtual void GoBack( HHTMLBrowser unBrowserHandle ) = 0;
// navigate forward in the page history
virtual void GoForward( HHTMLBrowser unBrowserHandle ) = 0;
// add this header to any url requests from this browser
virtual void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue ) = 0;
// run this javascript script in the currently loaded page
virtual void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript ) = 0;
enum EHTMLMouseButton
{
eHTMLMouseButton_Left = 0,
eHTMLMouseButton_Right = 1,
eHTMLMouseButton_Middle = 2,
};
// Mouse click and mouse movement commands
virtual void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
virtual void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
virtual void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
// x and y are relative to the HTML bounds
virtual void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
// nDelta is pixels of scroll
virtual void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta ) = 0;
enum EMouseCursor
{
dc_user = 0,
dc_none,
dc_arrow,
dc_ibeam,
dc_hourglass,
dc_waitarrow,
dc_crosshair,
dc_up,
dc_sizenw,
dc_sizese,
dc_sizene,
dc_sizesw,
dc_sizew,
dc_sizee,
dc_sizen,
dc_sizes,
dc_sizewe,
dc_sizens,
dc_sizeall,
dc_no,
dc_hand,
dc_blank, // don't show any custom cursor, just use your default
dc_middle_pan,
dc_north_pan,
dc_north_east_pan,
dc_east_pan,
dc_south_east_pan,
dc_south_pan,
dc_south_west_pan,
dc_west_pan,
dc_north_west_pan,
dc_alias,
dc_cell,
dc_colresize,
dc_copycur,
dc_verticaltext,
dc_rowresize,
dc_zoomin,
dc_zoomout,
dc_help,
dc_custom,
dc_last, // custom cursors start from this value and up
};
enum EHTMLKeyModifiers
{
k_eHTMLKeyModifier_None = 0,
k_eHTMLKeyModifier_AltDown = 1 << 0,
k_eHTMLKeyModifier_CtrlDown = 1 << 1,
k_eHTMLKeyModifier_ShiftDown = 1 << 2,
};
// keyboard interactions, native keycode is the virtual key code value from your OS
virtual void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
virtual void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
// cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
virtual void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
// programmatically scroll this many pixels on the page
virtual void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
virtual void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
// tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things
virtual void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) = 0;
// open the current pages html code in the local editor of choice, used for debugging
virtual void ViewSource( HHTMLBrowser unBrowserHandle ) = 0;
// copy the currently selected text on the html page to the local clipboard
virtual void CopyToClipboard( HHTMLBrowser unBrowserHandle ) = 0;
// paste from the local clipboard to the current html page
virtual void PasteFromClipboard( HHTMLBrowser unBrowserHandle ) = 0;
// find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element
virtual void Find( HHTMLBrowser unBrowserHandle, const char *pchSearchStr, bool bCurrentlyInFind, bool bReverse ) = 0;
// cancel a currently running find
virtual void StopFind( HHTMLBrowser unBrowserHandle ) = 0;
// return details about the link at position x,y on the current page
virtual void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
// set a webcookie for the hostname in question
virtual void SetCookie( const char *pchHostname, const char *pchKey, const char *pchValue, const char *pchPath = "/", RTime32 nExpires = 0, bool bSecure = false, bool bHTTPOnly = false ) = 0;
// Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)
virtual void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) = 0;
// Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are
// more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled,
// all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1".
// When background mode is disabled, any video or audio objects with that property will resume with ".play()".
virtual void SetBackgroundMode( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) = 0;
// CALLBACKS
//
// These set of functions are used as responses to callback requests
//
// You MUST call this in response to a HTML_StartRequest_t callback
// Set bAllowed to true to allow this navigation, false to cancel it and stay
// on the current page. You can use this feature to limit the valid pages
// allowed in your HTML surface.
virtual void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed ) = 0;
// You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback
// Set bResult to true for the OK option of a confirm, use false otherwise
virtual void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) = 0;
// You MUST call this in response to a HTML_FileOpenDialog_t callback
IGNOREATTR()
virtual void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) = 0;
};
#define STEAMHTMLSURFACE_INTERFACE_VERSION "STEAMHTMLSURFACE_INTERFACE_VERSION_003"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: The browser is ready for use
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_BrowserReady_t, k_iSteamHTMLSurfaceCallbacks + 1 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this browser is now fully created and ready to navigate to pages
END_DEFINE_CALLBACK_1()
//-----------------------------------------------------------------------------
// Purpose: the browser has a pending paint
//-----------------------------------------------------------------------------
DEFINE_CALLBACK(HTML_NeedsPaint_t, k_iSteamHTMLSurfaceCallbacks + 2)
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the browser that needs the paint
CALLBACK_MEMBER(1, const char *, pBGRA ) // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called
CALLBACK_MEMBER(2, uint32, unWide) // the total width of the pBGRA texture
CALLBACK_MEMBER(3, uint32, unTall) // the total height of the pBGRA texture
CALLBACK_MEMBER(4, uint32, unUpdateX) // the offset in X for the damage rect for this update
CALLBACK_MEMBER(5, uint32, unUpdateY) // the offset in Y for the damage rect for this update
CALLBACK_MEMBER(6, uint32, unUpdateWide) // the width of the damage rect for this update
CALLBACK_MEMBER(7, uint32, unUpdateTall) // the height of the damage rect for this update
CALLBACK_MEMBER(8, uint32, unScrollX) // the page scroll the browser was at when this texture was rendered
CALLBACK_MEMBER(9, uint32, unScrollY) // the page scroll the browser was at when this texture was rendered
CALLBACK_MEMBER(10, float, flPageScale) // the page scale factor on this page when rendered
CALLBACK_MEMBER(11, uint32, unPageSerial) // incremented on each new page load, you can use this to reject draws while navigating to new pages
END_DEFINE_CALLBACK_12()
//-----------------------------------------------------------------------------
// Purpose: The browser wanted to navigate to a new page
// NOTE - you MUST call AllowStartRequest in response to this callback
//-----------------------------------------------------------------------------
DEFINE_CALLBACK(HTML_StartRequest_t, k_iSteamHTMLSurfaceCallbacks + 3)
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface navigating
CALLBACK_MEMBER(1, const char *, pchURL) // the url they wish to navigate to
CALLBACK_MEMBER(2, const char *, pchTarget) // the html link target type (i.e _blank, _self, _parent, _top )
CALLBACK_MEMBER(3, const char *, pchPostData ) // any posted data for the request
CALLBACK_MEMBER(4, bool, bIsRedirect) // true if this was a http/html redirect from the last load request
END_DEFINE_CALLBACK_5()
//-----------------------------------------------------------------------------
// Purpose: The browser has been requested to close due to user interaction (usually from a javascript window.close() call)
//-----------------------------------------------------------------------------
DEFINE_CALLBACK(HTML_CloseBrowser_t, k_iSteamHTMLSurfaceCallbacks + 4)
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface
END_DEFINE_CALLBACK_1()
//-----------------------------------------------------------------------------
// Purpose: the browser is navigating to a new url
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_URLChanged_t, k_iSteamHTMLSurfaceCallbacks + 5 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface navigating
CALLBACK_MEMBER( 1, const char *, pchURL ) // the url they wish to navigate to
CALLBACK_MEMBER( 2, const char *, pchPostData ) // any posted data for the request
CALLBACK_MEMBER( 3, bool, bIsRedirect ) // true if this was a http/html redirect from the last load request
CALLBACK_MEMBER( 4, const char *, pchPageTitle ) // the title of the page
CALLBACK_MEMBER( 5, bool, bNewNavigation ) // true if this was from a fresh tab and not a click on an existing page
END_DEFINE_CALLBACK_6()
//-----------------------------------------------------------------------------
// Purpose: A page is finished loading
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_FinishedRequest_t, k_iSteamHTMLSurfaceCallbacks + 6 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchURL ) //
CALLBACK_MEMBER( 2, const char *, pchPageTitle ) //
END_DEFINE_CALLBACK_3()
//-----------------------------------------------------------------------------
// Purpose: a request to load this url in a new tab
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_OpenLinkInNewTab_t, k_iSteamHTMLSurfaceCallbacks + 7 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchURL ) //
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: the page has a new title now
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_ChangedTitle_t, k_iSteamHTMLSurfaceCallbacks + 8 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchTitle ) //
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: results from a search
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_SearchResults_t, k_iSteamHTMLSurfaceCallbacks + 9 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, unResults ) //
CALLBACK_MEMBER( 2, uint32, unCurrentMatch ) //
END_DEFINE_CALLBACK_3()
//-----------------------------------------------------------------------------
// Purpose: page history status changed on the ability to go backwards and forward
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_CanGoBackAndForward_t, k_iSteamHTMLSurfaceCallbacks + 10 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, bool, bCanGoBack ) //
CALLBACK_MEMBER( 2, bool, bCanGoForward ) //
END_DEFINE_CALLBACK_3()
//-----------------------------------------------------------------------------
// Purpose: details on the visibility and size of the horizontal scrollbar
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_HorizontalScroll_t, k_iSteamHTMLSurfaceCallbacks + 11 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
CALLBACK_MEMBER( 3, float, flPageScale ) //
CALLBACK_MEMBER( 4, bool , bVisible ) //
CALLBACK_MEMBER( 5, uint32, unPageSize ) //
END_DEFINE_CALLBACK_6()
//-----------------------------------------------------------------------------
// Purpose: details on the visibility and size of the vertical scrollbar
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_VerticalScroll_t, k_iSteamHTMLSurfaceCallbacks + 12 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
CALLBACK_MEMBER( 3, float, flPageScale ) //
CALLBACK_MEMBER( 4, bool, bVisible ) //
CALLBACK_MEMBER( 5, uint32, unPageSize ) //
END_DEFINE_CALLBACK_6()
//-----------------------------------------------------------------------------
// Purpose: response to GetLinkAtPosition call
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_LinkAtPosition_t, k_iSteamHTMLSurfaceCallbacks + 13 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, x ) // NOTE - Not currently set
CALLBACK_MEMBER( 2, uint32, y ) // NOTE - Not currently set
CALLBACK_MEMBER( 3, const char *, pchURL ) //
CALLBACK_MEMBER( 4, bool, bInput ) //
CALLBACK_MEMBER( 5, bool, bLiveLink ) //
END_DEFINE_CALLBACK_6()
//-----------------------------------------------------------------------------
// Purpose: show a Javascript alert dialog, call JSDialogResponse
// when the user dismisses this dialog (or right away to ignore it)
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_JSAlert_t, k_iSteamHTMLSurfaceCallbacks + 14 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMessage ) //
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: show a Javascript confirmation dialog, call JSDialogResponse
// when the user dismisses this dialog (or right away to ignore it)
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_JSConfirm_t, k_iSteamHTMLSurfaceCallbacks + 15 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMessage ) //
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: when received show a file open dialog
// then call FileLoadDialogResponse with the file(s) the user selected.
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_FileOpenDialog_t, k_iSteamHTMLSurfaceCallbacks + 16 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchTitle ) //
CALLBACK_MEMBER( 2, const char *, pchInitialFile ) //
END_DEFINE_CALLBACK_3()
//-----------------------------------------------------------------------------
// Purpose: a new html window has been created
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_NewWindow_t, k_iSteamHTMLSurfaceCallbacks + 21 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the current surface
CALLBACK_MEMBER( 1, const char *, pchURL ) // the page to load
CALLBACK_MEMBER( 2, uint32, unX ) // the x pos into the page to display the popup
CALLBACK_MEMBER( 3, uint32, unY ) // the y pos into the page to display the popup
CALLBACK_MEMBER( 4, uint32, unWide ) // the total width of the pBGRA texture
CALLBACK_MEMBER( 5, uint32, unTall ) // the total height of the pBGRA texture
CALLBACK_MEMBER( 6, HHTMLBrowser, unNewWindow_BrowserHandle ) // the handle of the new window surface
END_DEFINE_CALLBACK_7()
//-----------------------------------------------------------------------------
// Purpose: change the cursor to display
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_SetCursor_t, k_iSteamHTMLSurfaceCallbacks + 22 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, eMouseCursor ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: informational message from the browser
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_StatusText_t, k_iSteamHTMLSurfaceCallbacks + 23 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: show a tooltip
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_ShowToolTip_t, k_iSteamHTMLSurfaceCallbacks + 24 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: update the text of an existing tooltip
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_UpdateToolTip_t, k_iSteamHTMLSurfaceCallbacks + 25 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
//-----------------------------------------------------------------------------
// Purpose: hide the tooltip you are showing
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_HideToolTip_t, k_iSteamHTMLSurfaceCallbacks + 26 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
END_DEFINE_CALLBACK_1()
#pragma pack( pop )
#endif // ISTEAMHTMLSURFACE_H

210
SpyCustom/sdk/isteamhttp.h Normal file
View File

@ -0,0 +1,210 @@
//====== Copyright © 1996-2009, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to http client
//
//=============================================================================
#ifndef ISTEAMHTTP_H
#define ISTEAMHTTP_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
#include "steamhttpenums.h"
// Handle to a HTTP Request handle
typedef uint32 HTTPRequestHandle;
#define INVALID_HTTPREQUEST_HANDLE 0
typedef uint32 HTTPCookieContainerHandle;
#define INVALID_HTTPCOOKIE_HANDLE 0
//-----------------------------------------------------------------------------
// Purpose: interface to http client
//-----------------------------------------------------------------------------
class ISteamHTTP
{
public:
// Initializes a new HTTP request, returning a handle to use in further operations on it. Requires
// the method (GET or POST) and the absolute URL for the request. Both http and https are supported,
// so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/
// or such.
virtual HTTPRequestHandle CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL ) = 0;
// Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after
// sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.
virtual bool SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue ) = 0;
// Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default
// timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request
// has already been sent.
virtual bool SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds ) = 0;
// Set a request header value for the request, must be called prior to sending the request. Will
// return false if the handle is invalid or the request is already sent.
virtual bool SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, const char *pchHeaderValue ) = 0;
// Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified
// when creating the request. Must be called prior to sending the request. Will return false if the
// handle is invalid or the request is already sent.
virtual bool SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, const char *pchParamName, const char *pchParamValue ) = 0;
// Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on
// asynchronous response via callback.
//
// Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control
// header and only do a local cache lookup rather than sending any actual remote request.
virtual bool SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0;
// Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on
// asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and
// HTTPRequestDataReceived_t callbacks while streaming.
virtual bool SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0;
// Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move
// the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.
virtual bool DeferHTTPRequest( HTTPRequestHandle hRequest ) = 0;
// Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move
// the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.
virtual bool PrioritizeHTTPRequest( HTTPRequestHandle hRequest ) = 0;
// Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also
// returns the size of the header value if present so the caller and allocate a correctly sized buffer for
// GetHTTPResponseHeaderValue.
virtual bool GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const char *pchHeaderName, uint32 *unResponseHeaderSize ) = 0;
// Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// header is not present or if your buffer is too small to contain it's value. You should first call
// BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.
virtual bool GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, uint8 *pHeaderValueBuffer, uint32 unBufferSize ) = 0;
// Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// handle is invalid.
virtual bool GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize ) = 0;
// Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the
// handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out
// the correct buffer size to use.
virtual bool GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0;
// Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the
// handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset
// do not match the size and offset sent in HTTPRequestDataReceived_t.
virtual bool GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0;
// Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t
// callback and finishing using the response.
virtual bool ReleaseHTTPRequest( HTTPRequestHandle hRequest ) = 0;
// Gets progress on downloading the body for the request. This will be zero unless a response header has already been
// received which included a content-length field. For responses that contain no content-length it will report
// zero for the duration of the request as the size is unknown until the connection closes.
virtual bool GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut ) = 0;
// Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params
// have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType
// parameter will set the content-type header for the request so the server may know how to interpret the body.
virtual bool SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen ) = 0;
// Creates a cookie container handle which you must later free with ReleaseCookieContainer(). If bAllowResponsesToModify=true
// than any response to your requests using this cookie container may add new cookies which may be transmitted with
// future requests. If bAllowResponsesToModify=false than only cookies you explicitly set will be sent. This API is just for
// during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across
// repeat executions of your process.
virtual HTTPCookieContainerHandle CreateCookieContainer( bool bAllowResponsesToModify ) = 0;
// Release a cookie container you are finished using, freeing it's memory
virtual bool ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer ) = 0;
// Adds a cookie to the specified cookie container that will be used with future requests.
virtual bool SetCookie( HTTPCookieContainerHandle hCookieContainer, const char *pchHost, const char *pchUrl, const char *pchCookie ) = 0;
// Set the cookie container to use for a HTTP request
virtual bool SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer ) = 0;
// Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end
virtual bool SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const char *pchUserAgentInfo ) = 0;
// Set that https request should require verified SSL certificate via machines certificate trust store
virtual bool SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate ) = 0;
// Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout
// which can bump everytime we get more data
virtual bool SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, uint32 unMilliseconds ) = 0;
// Check if the reason the request failed was because we timed it out (rather than some harder failure)
virtual bool GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut ) = 0;
};
#define STEAMHTTP_INTERFACE_VERSION "STEAMHTTP_INTERFACE_VERSION002"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
struct HTTPRequestCompleted_t
{
enum { k_iCallback = k_iClientHTTPCallbacks + 1 };
// Handle value for the request that has completed.
HTTPRequestHandle m_hRequest;
// Context value that the user defined on the request that this callback is associated with, 0 if
// no context value was set.
uint64 m_ulContextValue;
// This will be true if we actually got any sort of response from the server (even an error).
// It will be false if we failed due to an internal error or client side network failure.
bool m_bRequestSuccessful;
// Will be the HTTP status code value returned by the server, k_EHTTPStatusCode200OK is the normal
// OK response, if you get something else you probably need to treat it as a failure.
EHTTPStatusCode m_eStatusCode;
uint32 m_unBodySize; // Same as GetHTTPResponseBodySize()
};
struct HTTPRequestHeadersReceived_t
{
enum { k_iCallback = k_iClientHTTPCallbacks + 2 };
// Handle value for the request that has received headers.
HTTPRequestHandle m_hRequest;
// Context value that the user defined on the request that this callback is associated with, 0 if
// no context value was set.
uint64 m_ulContextValue;
};
struct HTTPRequestDataReceived_t
{
enum { k_iCallback = k_iClientHTTPCallbacks + 3 };
// Handle value for the request that has received data.
HTTPRequestHandle m_hRequest;
// Context value that the user defined on the request that this callback is associated with, 0 if
// no context value was set.
uint64 m_ulContextValue;
// Offset to provide to GetHTTPStreamingResponseBodyData to get this chunk of data
uint32 m_cOffset;
// Size to provide to GetHTTPStreamingResponseBodyData to get this chunk of data
uint32 m_cBytesReceived;
};
#pragma pack( pop )
#endif // ISTEAMHTTP_H

View File

@ -0,0 +1,354 @@
//====== Copyright © 1996-2014 Valve Corporation, All rights reserved. =======
//
// Purpose: interface to Steam Inventory
//
//=============================================================================
#ifndef ISTEAMINVENTORY_H
#define ISTEAMINVENTORY_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
// Every individual instance of an item has a globally-unique ItemInstanceID.
// This ID is unique to the combination of (player, specific item instance)
// and will not be transferred to another player or re-used for another item.
typedef uint64 SteamItemInstanceID_t;
static const SteamItemInstanceID_t k_SteamItemInstanceIDInvalid = (SteamItemInstanceID_t)~0;
// Types of items in your game are identified by a 32-bit "item definition number".
// Valid definition numbers are between 1 and 999999999; numbers less than or equal to
// zero are invalid, and numbers greater than or equal to one billion (1x10^9) are
// reserved for internal Steam use.
typedef int32 SteamItemDef_t;
enum ESteamItemFlags
{
// Item status flags - these flags are permanently attached to specific item instances
k_ESteamItemNoTrade = 1 << 0, // This item is account-locked and cannot be traded or given away.
// Action confirmation flags - these flags are set one time only, as part of a result set
k_ESteamItemRemoved = 1 << 8, // The item has been destroyed, traded away, expired, or otherwise invalidated
k_ESteamItemConsumed = 1 << 9, // The item quantity has been decreased by 1 via ConsumeItem API.
// All other flag bits are currently reserved for internal Steam use at this time.
// Do not assume anything about the state of other flags which are not defined here.
};
struct SteamItemDetails_t
{
SteamItemInstanceID_t m_itemId;
SteamItemDef_t m_iDefinition;
uint16 m_unQuantity;
uint16 m_unFlags; // see ESteamItemFlags
};
typedef int32 SteamInventoryResult_t;
static const SteamInventoryResult_t k_SteamInventoryResultInvalid = -1;
//-----------------------------------------------------------------------------
// Purpose: Steam Inventory query and manipulation API
//-----------------------------------------------------------------------------
class ISteamInventory
{
public:
// INVENTORY ASYNC RESULT MANAGEMENT
//
// Asynchronous inventory queries always output a result handle which can be used with
// GetResultStatus, GetResultItems, etc. A SteamInventoryResultReady_t callback will
// be triggered when the asynchronous result becomes ready (or fails).
//
// Find out the status of an asynchronous inventory result handle. Possible values:
// k_EResultPending - still in progress
// k_EResultOK - done, result ready
// k_EResultExpired - done, result ready, maybe out of date (see DeserializeResult)
// k_EResultInvalidParam - ERROR: invalid API call parameters
// k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later
// k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits
// k_EResultFail - ERROR: unknown / generic error
METHOD_DESC(Find out the status of an asynchronous inventory result handle.)
virtual EResult GetResultStatus( SteamInventoryResult_t resultHandle ) = 0;
// Copies the contents of a result set into a flat array. The specific
// contents of the result set depend on which query which was used.
METHOD_DESC(Copies the contents of a result set into a flat array. The specific contents of the result set depend on which query which was used.)
virtual bool GetResultItems( SteamInventoryResult_t resultHandle,
OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray,
uint32 *punOutItemsArraySize ) = 0;
// Returns the server time at which the result was generated. Compare against
// the value of IClientUtils::GetServerRealTime() to determine age.
METHOD_DESC(Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.)
virtual uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle ) = 0;
// Returns true if the result belongs to the target steam ID, false if the
// result does not. This is important when using DeserializeResult, to verify
// that a remote player is not pretending to have a different user's inventory.
METHOD_DESC(Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.)
virtual bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected ) = 0;
// Destroys a result handle and frees all associated memory.
METHOD_DESC(Destroys a result handle and frees all associated memory.)
virtual void DestroyResult( SteamInventoryResult_t resultHandle ) = 0;
// INVENTORY ASYNC QUERY
//
// Captures the entire state of the current user's Steam inventory.
// You must call DestroyResult on this handle when you are done with it.
// Returns false and sets *pResultHandle to zero if inventory is unavailable.
// Note: calls to this function are subject to rate limits and may return
// cached results if called too frequently. It is suggested that you call
// this function only when you are about to display the user's full inventory,
// or if you expect that the inventory may have changed.
METHOD_DESC(Captures the entire state of the current users Steam inventory.)
virtual bool GetAllItems( SteamInventoryResult_t *pResultHandle ) = 0;
// Captures the state of a subset of the current user's Steam inventory,
// identified by an array of item instance IDs. The results from this call
// can be serialized and passed to other players to "prove" that the current
// user owns specific items, without exposing the user's entire inventory.
// For example, you could call GetItemsByID with the IDs of the user's
// currently equipped cosmetic items and serialize this to a buffer, and
// then transmit this buffer to other players upon joining a game.
METHOD_DESC(Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.)
virtual bool GetItemsByID( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT( unCountInstanceIDs ) const SteamItemInstanceID_t *pInstanceIDs, uint32 unCountInstanceIDs ) = 0;
// RESULT SERIALIZATION AND AUTHENTICATION
//
// Serialized result sets contain a short signature which can't be forged
// or replayed across different game sessions. A result set can be serialized
// on the local client, transmitted to other players via your game networking,
// and deserialized by the remote players. This is a secure way of preventing
// hackers from lying about posessing rare/high-value items.
// Serializes a result set with signature bytes to an output buffer. Pass
// NULL as an output buffer to get the required size via punOutBufferSize.
// The size of a serialized result depends on the number items which are being
// serialized. When securely transmitting items to other players, it is
// recommended to use "GetItemsByID" first to create a minimal result set.
// Results have a built-in timestamp which will be considered "expired" after
// an hour has elapsed. See DeserializeResult for expiration handling.
virtual bool SerializeResult( SteamInventoryResult_t resultHandle, OUT_BUFFER_COUNT(punOutBufferSize) void *pOutBuffer, uint32 *punOutBufferSize ) = 0;
// Deserializes a result set and verifies the signature bytes. Returns false
// if bRequireFullOnlineVerify is set but Steam is running in Offline mode.
// Otherwise returns true and then delivers error codes via GetResultStatus.
//
// The bRESERVED_MUST_BE_FALSE flag is reserved for future use and should not
// be set to true by your game at this time.
//
// DeserializeResult has a potential soft-failure mode where the handle status
// is set to k_EResultExpired. GetResultItems() still succeeds in this mode.
// The "expired" result could indicate that the data may be out of date - not
// just due to timed expiration (one hour), but also because one of the items
// in the result set may have been traded or consumed since the result set was
// generated. You could compare the timestamp from GetResultTimestamp() to
// ISteamUtils::GetServerRealTime() to determine how old the data is. You could
// simply ignore the "expired" result code and continue as normal, or you
// could challenge the player with expired data to send an updated result set.
virtual bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, BUFFER_COUNT(punOutBufferSize) const void *pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE = false ) = 0;
// INVENTORY ASYNC MODIFICATION
//
// GenerateItems() creates one or more items and then generates a SteamInventoryCallback_t
// notification with a matching nCallbackContext parameter. This API is insecure, and could
// be abused by hacked clients. It is, however, very useful as a development cheat or as
// a means of prototyping item-related features for your game. The use of GenerateItems can
// be restricted to certain item definitions or fully blocked via the Steamworks website.
// If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should
// describe the quantity of each item to generate.
virtual bool GenerateItems( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0;
// GrantPromoItems() checks the list of promotional items for which the user may be eligible
// and grants the items (one time only). On success, the result set will include items which
// were granted, if any. If no items were granted because the user isn't eligible for any
// promotions, this is still considered a success.
METHOD_DESC(GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).)
virtual bool GrantPromoItems( SteamInventoryResult_t *pResultHandle ) = 0;
// AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of
// scanning for all eligible promotional items, the check is restricted to a single item
// definition or set of item definitions. This can be useful if your game has custom UI for
// showing a specific promo item to the user.
virtual bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef ) = 0;
virtual bool AddPromoItems( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength ) = 0;
// ConsumeItem() removes items from the inventory, permanently. They cannot be recovered.
// Not for the faint of heart - if your game implements item removal at all, a high-friction
// UI confirmation process is highly recommended. Similar to GenerateItems, punArrayQuantity
// can be NULL or else an array of the same length as pArrayItems which describe the quantity
// of each item to destroy. ConsumeItem can be restricted to certain item definitions or
// fully blocked via the Steamworks website to minimize support/abuse issues such as the
// clasic "my brother borrowed my laptop and deleted all of my rare items".
METHOD_DESC(ConsumeItem() removes items from the inventory permanently.)
virtual bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity ) = 0;
// ExchangeItems() is an atomic combination of GenerateItems and DestroyItems. It can be
// used to implement crafting recipes or transmutations, or items which unpack themselves
// into other items. Like GenerateItems, this is a flexible and dangerous API which is
// meant for rapid prototyping. You can configure restrictions on ExchangeItems via the
// Steamworks website, such as limiting it to a whitelist of input/output combinations
// corresponding to recipes.
// (Note: although GenerateItems may be hard or impossible to use securely in your game,
// ExchangeItems is perfectly reasonable to use once the whitelists are set accordingly.)
virtual bool ExchangeItems( SteamInventoryResult_t *pResultHandle,
ARRAY_COUNT(unArrayGenerateLength) const SteamItemDef_t *pArrayGenerate, ARRAY_COUNT(unArrayGenerateLength) const uint32 *punArrayGenerateQuantity, uint32 unArrayGenerateLength,
ARRAY_COUNT(unArrayDestroyLength) const SteamItemInstanceID_t *pArrayDestroy, ARRAY_COUNT(unArrayDestroyLength) const uint32 *punArrayDestroyQuantity, uint32 unArrayDestroyLength ) = 0;
// TransferItemQuantity() is intended for use with items which are "stackable" (can have
// quantity greater than one). It can be used to split a stack into two, or to transfer
// quantity from one stack into another stack of identical items. To split one stack into
// two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.
virtual bool TransferItemQuantity( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemIdSource, uint32 unQuantity, SteamItemInstanceID_t itemIdDest ) = 0;
// TIMED DROPS AND PLAYTIME CREDIT
//
// Applications which use timed-drop mechanics should call SendItemDropHeartbeat() when
// active gameplay begins, and at least once every two minutes afterwards. The backend
// performs its own time calculations, so the precise timing of the heartbeat is not
// critical as long as you send at least one heartbeat every two minutes. Calling the
// function more often than that is not harmful, it will simply have no effect. Note:
// players may be able to spoof this message by hacking their client, so you should not
// attempt to use this as a mechanism to restrict playtime credits. It is simply meant
// to distinguish between being in any kind of gameplay situation vs the main menu or
// a pre-game launcher window. (If you are stingy with handing out playtime credit, it
// will only encourage players to run bots or use mouse/kb event simulators.)
//
// Playtime credit accumulation can be capped on a daily or weekly basis through your
// Steamworks configuration.
//
METHOD_DESC(Applications which use timed-drop mechanics should call SendItemDropHeartbeat() when active gameplay begins and at least once every two minutes afterwards.)
virtual void SendItemDropHeartbeat() = 0;
// Playtime credit must be consumed and turned into item drops by your game. Only item
// definitions which are marked as "playtime item generators" can be spawned. The call
// will return an empty result set if there is not enough playtime credit for a drop.
// Your game should call TriggerItemDrop at an appropriate time for the user to receive
// new items, such as between rounds or while the player is dead. Note that players who
// hack their clients could modify the value of "dropListDefinition", so do not use it
// to directly control rarity. It is primarily useful during testing and development,
// where you may wish to perform experiments with different types of drops.
METHOD_DESC(Playtime credit must be consumed and turned into item drops by your game.)
virtual bool TriggerItemDrop( SteamInventoryResult_t *pResultHandle, SteamItemDef_t dropListDefinition ) = 0;
// IN-GAME TRADING
//
// TradeItems() implements limited in-game trading of items, if you prefer not to use
// the overlay or an in-game web browser to perform Steam Trading through the website.
// You should implement a UI where both players can see and agree to a trade, and then
// each client should call TradeItems simultaneously (+/- 5 seconds) with matching
// (but reversed) parameters. The result is the same as if both players performed a
// Steam Trading transaction through the web. Each player will get an inventory result
// confirming the removal or quantity changes of the items given away, and the new
// item instance id numbers and quantities of the received items.
// (Note: new item instance IDs are generated whenever an item changes ownership.)
virtual bool TradeItems( SteamInventoryResult_t *pResultHandle, CSteamID steamIDTradePartner,
ARRAY_COUNT(nArrayGiveLength) const SteamItemInstanceID_t *pArrayGive, ARRAY_COUNT(nArrayGiveLength) const uint32 *pArrayGiveQuantity, uint32 nArrayGiveLength,
ARRAY_COUNT(nArrayGetLength) const SteamItemInstanceID_t *pArrayGet, ARRAY_COUNT(nArrayGetLength) const uint32 *pArrayGetQuantity, uint32 nArrayGetLength ) = 0;
// ITEM DEFINITIONS
//
// Item definitions are a mapping of "definition IDs" (integers between 1 and 1000000)
// to a set of string properties. Some of these properties are required to display items
// on the Steam community web site. Other properties can be defined by applications.
// Use of these functions is optional; there is no reason to call LoadItemDefinitions
// if your game hardcodes the numeric definition IDs (eg, purple face mask = 20, blue
// weapon mod = 55) and does not allow for adding new item types without a client patch.
//
// LoadItemDefinitions triggers the automatic load and refresh of item definitions.
// Every time new item definitions are available (eg, from the dynamic addition of new
// item types while players are still in-game), a SteamInventoryDefinitionUpdate_t
// callback will be fired.
METHOD_DESC(LoadItemDefinitions triggers the automatic load and refresh of item definitions.)
virtual bool LoadItemDefinitions() = 0;
// GetItemDefinitionIDs returns the set of all defined item definition IDs (which are
// defined via Steamworks configuration, and not necessarily contiguous integers).
// If pItemDefIDs is null, the call will return true and *punItemDefIDsArraySize will
// contain the total size necessary for a subsequent call. Otherwise, the call will
// return false if and only if there is not enough space in the output array.
virtual bool GetItemDefinitionIDs(
OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0;
// GetItemDefinitionProperty returns a string property from a given item definition.
// Note that some properties (for example, "name") may be localized and will depend
// on the current Steam language settings (see ISteamApps::GetCurrentGameLanguage).
// Property names are always composed of ASCII letters, numbers, and/or underscores.
// Pass a NULL pointer for pchPropertyName to get a comma - separated list of available
// property names.
virtual bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPropertyName,
OUT_STRING_COUNT(punValueBufferSize) char *pchValueBuffer, uint32 *punValueBufferSize ) = 0;
};
#define STEAMINVENTORY_INTERFACE_VERSION "STEAMINVENTORY_INTERFACE_V001"
// SteamInventoryResultReady_t callbacks are fired whenever asynchronous
// results transition from "Pending" to "OK" or an error state. There will
// always be exactly one callback per handle.
struct SteamInventoryResultReady_t
{
enum { k_iCallback = k_iClientInventoryCallbacks + 0 };
SteamInventoryResult_t m_handle;
EResult m_result;
};
// SteamInventoryFullUpdate_t callbacks are triggered when GetAllItems
// successfully returns a result which is newer / fresher than the last
// known result. (It will not trigger if the inventory hasn't changed,
// or if results from two overlapping calls are reversed in flight and
// the earlier result is already known to be stale/out-of-date.)
// The normal ResultReady callback will still be triggered immediately
// afterwards; this is an additional notification for your convenience.
struct SteamInventoryFullUpdate_t
{
enum { k_iCallback = k_iClientInventoryCallbacks + 1 };
SteamInventoryResult_t m_handle;
};
// A SteamInventoryDefinitionUpdate_t callback is triggered whenever
// item definitions have been updated, which could be in response to
// LoadItemDefinitions() or any other async request which required
// a definition update in order to process results from the server.
struct SteamInventoryDefinitionUpdate_t
{
enum { k_iCallback = k_iClientInventoryCallbacks + 2 };
};
#pragma pack( pop )
#endif // ISTEAMCONTROLLER_H

View File

@ -0,0 +1,741 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to steam managing game server/client match making
//
//=============================================================================
#ifndef ISTEAMMATCHMAKING
#define ISTEAMMATCHMAKING
#ifdef _WIN32
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
#include "matchmakingtypes.h"
#include "isteamclient.h"
#include "isteamfriends.h"
// lobby type description
enum ELobbyType
{
k_ELobbyTypePrivate = 0, // only way to join the lobby is to invite to someone else
k_ELobbyTypeFriendsOnly = 1, // shows for friends or invitees, but not in lobby list
k_ELobbyTypePublic = 2, // visible for friends and in lobby list
k_ELobbyTypeInvisible = 3, // returned by search, but not visible to other friends
// useful if you want a user in two lobbies, for example matching groups together
// a user can be in only one regular lobby, and up to two invisible lobbies
};
// lobby search filter tools
enum ELobbyComparison
{
k_ELobbyComparisonEqualToOrLessThan = -2,
k_ELobbyComparisonLessThan = -1,
k_ELobbyComparisonEqual = 0,
k_ELobbyComparisonGreaterThan = 1,
k_ELobbyComparisonEqualToOrGreaterThan = 2,
k_ELobbyComparisonNotEqual = 3,
};
// lobby search distance. Lobby results are sorted from closest to farthest.
enum ELobbyDistanceFilter
{
k_ELobbyDistanceFilterClose, // only lobbies in the same immediate region will be returned
k_ELobbyDistanceFilterDefault, // only lobbies in the same region or near by regions
k_ELobbyDistanceFilterFar, // for games that don't have many latency requirements, will return lobbies about half-way around the globe
k_ELobbyDistanceFilterWorldwide, // no filtering, will match lobbies as far as India to NY (not recommended, expect multiple seconds of latency between the clients)
};
// maximum number of characters a lobby metadata key can be
#define k_nMaxLobbyKeyLength 255
//-----------------------------------------------------------------------------
// Purpose: Functions for match making services for clients to get to favorites
// and to operate on game lobbies.
//-----------------------------------------------------------------------------
class ISteamMatchmaking
{
public:
// game server favorites storage
// saves basic details about a multiplayer game server locally
// returns the number of favorites servers the user has stored
virtual int GetFavoriteGameCount() = 0;
// returns the details of the game server
// iGame is of range [0,GetFavoriteGameCount())
// *pnIP, *pnConnPort are filled in the with IP:port of the game server
// *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections
// *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added
virtual bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0;
// adds the game server to the local list; updates the time played of the server if it already exists in the list
virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) = 0;
// removes the game server from the local storage; returns true if one was removed
virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
///////
// Game lobby functions
// Get a list of relevant lobbies
// this is an asynchronous request
// results will be returned by LobbyMatchList_t callback & call result, with the number of lobbies found
// this will never return lobbies that are full
// to add more filter, the filter calls below need to be call before each and every RequestLobbyList() call
// use the CCallResult<> object in steam_api.h to match the SteamAPICall_t call result to a function in an object, e.g.
/*
class CMyLobbyListManager
{
CCallResult<CMyLobbyListManager, LobbyMatchList_t> m_CallResultLobbyMatchList;
void FindLobbies()
{
// SteamMatchmaking()->AddRequestLobbyListFilter*() functions would be called here, before RequestLobbyList()
SteamAPICall_t hSteamAPICall = SteamMatchmaking()->RequestLobbyList();
m_CallResultLobbyMatchList.Set( hSteamAPICall, this, &CMyLobbyListManager::OnLobbyMatchList );
}
void OnLobbyMatchList( LobbyMatchList_t *pLobbyMatchList, bool bIOFailure )
{
// lobby list has be retrieved from Steam back-end, use results
}
}
*/
//
CALL_RESULT( LobbyMatchList_t )
virtual SteamAPICall_t RequestLobbyList() = 0;
// filters for lobbies
// this needs to be called before RequestLobbyList() to take effect
// these are cleared on each call to RequestLobbyList()
virtual void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pchValueToMatch, ELobbyComparison eComparisonType ) = 0;
// numerical comparison
virtual void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType ) = 0;
// returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence
virtual void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueToBeCloseTo ) = 0;
// returns only lobbies with the specified number of slots available
virtual void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable ) = 0;
// sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed)
virtual void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilter ) = 0;
// sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client
virtual void AddRequestLobbyListResultCountFilter( int cMaxResults ) = 0;
virtual void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby ) = 0;
// returns the CSteamID of a lobby, as retrieved by a RequestLobbyList call
// should only be called after a LobbyMatchList_t callback is received
// iLobby is of the range [0, LobbyMatchList_t::m_nLobbiesMatching)
// the returned CSteamID::IsValid() will be false if iLobby is out of range
virtual CSteamID GetLobbyByIndex( int iLobby ) = 0;
// Create a lobby on the Steam servers.
// If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID
// of the lobby will need to be communicated via game channels or via InviteUserToLobby()
// this is an asynchronous request
// results will be returned by LobbyCreated_t callback and call result; lobby is joined & ready to use at this point
// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
CALL_RESULT( LobbyCreated_t )
virtual SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers ) = 0;
// Joins an existing lobby
// this is an asynchronous request
// results will be returned by LobbyEnter_t callback & call result, check m_EChatRoomEnterResponse to see if was successful
// lobby metadata is available to use immediately on this call completing
CALL_RESULT( LobbyEnter_t )
virtual SteamAPICall_t JoinLobby( CSteamID steamIDLobby ) = 0;
// Leave a lobby; this will take effect immediately on the client side
// other users in the lobby will be notified by a LobbyChatUpdate_t callback
virtual void LeaveLobby( CSteamID steamIDLobby ) = 0;
// Invite another user to the lobby
// the target user will receive a LobbyInvite_t callback
// will return true if the invite is successfully sent, whether or not the target responds
// returns false if the local user is not connected to the Steam servers
// if the other user clicks the join link, a GameLobbyJoinRequested_t will be posted if the user is in-game,
// or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id>
virtual bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) = 0;
// Lobby iteration, for viewing details of users in a lobby
// only accessible if the lobby user is a member of the specified lobby
// persona information for other lobby members (name, avatar, etc.) will be asynchronously received
// and accessible via ISteamFriends interface
// returns the number of users in the specified lobby
virtual int GetNumLobbyMembers( CSteamID steamIDLobby ) = 0;
// returns the CSteamID of a user in the lobby
// iMember is of range [0,GetNumLobbyMembers())
// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby
virtual CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember ) = 0;
// Get data associated with this lobby
// takes a simple key, and returns the string associated with it
// "" will be returned if no value is set, or if steamIDLobby is invalid
virtual const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0;
// Sets a key/value pair in the lobby metadata
// each user in the lobby will be broadcast this new value, and any new users joining will receive any existing data
// this can be used to set lobby names, map, etc.
// to reset a key, just set it to ""
// other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback
virtual bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0;
// returns the number of metadata keys set on the specified lobby
virtual int GetLobbyDataCount( CSteamID steamIDLobby ) = 0;
// returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount())
virtual bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize ) = 0;
// removes a metadata key from the lobby
virtual bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0;
// Gets per-user metadata for someone in this lobby
virtual const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey ) = 0;
// Sets per-user metadata (for the local user implicitly)
virtual void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0;
// Broadcasts a chat message to the all the users in the lobby
// users in the lobby (including the local user) will receive a LobbyChatMsg_t callback
// returns true if the message is successfully sent
// pvMsgBody can be binary or text data, up to 4k
// if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator
virtual bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody ) = 0;
// Get a chat message as specified in a LobbyChatMsg_t callback
// iChatID is the LobbyChatMsg_t::m_iChatID value in the callback
// *pSteamIDUser is filled in with the CSteamID of the member
// *pvData is filled in with the message itself
// return value is the number of bytes written into the buffer
virtual int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, OUT_STRUCT() CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
// Refreshes metadata for a lobby you're not necessarily in right now
// you never do this for lobbies you're a member of, only if your
// this will send down all the metadata associated with a lobby
// this is an asynchronous call
// returns false if the local user is not connected to the Steam servers
// results will be returned by a LobbyDataUpdate_t callback
// if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false
virtual bool RequestLobbyData( CSteamID steamIDLobby ) = 0;
// sets the game server associated with the lobby
// usually at this point, the users will join the specified game server
// either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect
virtual void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer ) = 0;
// returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist
virtual bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, OUT_STRUCT() CSteamID *psteamIDGameServer ) = 0;
// set the limit on the # of users who can join the lobby
virtual bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers ) = 0;
// returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined
virtual int GetLobbyMemberLimit( CSteamID steamIDLobby ) = 0;
// updates which type of lobby it is
// only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls
virtual bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType ) = 0;
// sets whether or not a lobby is joinable - defaults to true for a new lobby
// if set to false, no user can join, even if they are a friend or have been invited
virtual bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable ) = 0;
// returns the current lobby owner
// you must be a member of the lobby to access this
// there always one lobby owner - if the current owner leaves, another user will become the owner
// it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner
virtual CSteamID GetLobbyOwner( CSteamID steamIDLobby ) = 0;
// changes who the lobby owner is
// you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby
// after completion, the local user will no longer be the owner
virtual bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner ) = 0;
// link two lobbies for the purposes of checking player compatibility
// you must be the lobby owner of both lobbies
virtual bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent ) = 0;
#ifdef _PS3
// changes who the lobby owner is
// you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby
// after completion, the local user will no longer be the owner
virtual void CheckForPSNGameBootInvite( unsigned int iGameBootAttributes ) = 0;
#endif
CALL_BACK( LobbyChatUpdate_t );
};
#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking009"
//-----------------------------------------------------------------------------
// Callback interfaces for server list functions (see ISteamMatchmakingServers below)
//
// The idea here is that your game code implements objects that implement these
// interfaces to receive callback notifications after calling asynchronous functions
// inside the ISteamMatchmakingServers() interface below.
//
// This is different than normal Steam callback handling due to the potentially
// large size of server lists.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Typedef for handle type you will receive when requesting server list.
//-----------------------------------------------------------------------------
typedef void* HServerListRequest;
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after a server list refresh
// or an individual server update.
//
// Since you get these callbacks after requesting full list refreshes you will
// usually implement this interface inside an object like CServerBrowser. If that
// object is getting destructed you should use ISteamMatchMakingServers()->CancelQuery()
// to cancel any in-progress queries so you don't get a callback into the destructed
// object and crash.
//-----------------------------------------------------------------------------
class ISteamMatchmakingServerListResponse
{
public:
// Server has responded ok with updated data
virtual void ServerResponded( HServerListRequest hRequest, int iServer ) = 0;
// Server has failed to respond
virtual void ServerFailedToRespond( HServerListRequest hRequest, int iServer ) = 0;
// A list refresh you had initiated is now 100% completed
virtual void RefreshComplete( HServerListRequest hRequest, EMatchMakingServerResponse response ) = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after pinging an individual server
//
// These callbacks all occur in response to querying an individual server
// via the ISteamMatchmakingServers()->PingServer() call below. If you are
// destructing an object that implements this interface then you should call
// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
class ISteamMatchmakingPingResponse
{
public:
// Server has responded successfully and has updated data
virtual void ServerResponded( gameserveritem_t &server ) = 0;
// Server failed to respond to the ping request
virtual void ServerFailedToRespond() = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after requesting details on
// who is playing on a particular server.
//
// These callbacks all occur in response to querying an individual server
// via the ISteamMatchmakingServers()->PlayerDetails() call below. If you are
// destructing an object that implements this interface then you should call
// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
class ISteamMatchmakingPlayersResponse
{
public:
// Got data on a new player on the server -- you'll get this callback once per player
// on the server which you have requested player data on.
virtual void AddPlayerToList( const char *pchName, int nScore, float flTimePlayed ) = 0;
// The server failed to respond to the request for player details
virtual void PlayersFailedToRespond() = 0;
// The server has finished responding to the player details request
// (ie, you won't get anymore AddPlayerToList callbacks)
virtual void PlayersRefreshComplete() = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Callback interface for receiving responses after requesting rules
// details on a particular server.
//
// These callbacks all occur in response to querying an individual server
// via the ISteamMatchmakingServers()->ServerRules() call below. If you are
// destructing an object that implements this interface then you should call
// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query
// which is in progress. Failure to cancel in progress queries when destructing
// a callback handler may result in a crash when a callback later occurs.
//-----------------------------------------------------------------------------
class ISteamMatchmakingRulesResponse
{
public:
// Got data on a rule on the server -- you'll get one of these per rule defined on
// the server you are querying
virtual void RulesResponded( const char *pchRule, const char *pchValue ) = 0;
// The server failed to respond to the request for rule details
virtual void RulesFailedToRespond() = 0;
// The server has finished responding to the rule details request
// (ie, you won't get anymore RulesResponded callbacks)
virtual void RulesRefreshComplete() = 0;
};
//-----------------------------------------------------------------------------
// Typedef for handle type you will receive when querying details on an individual server.
//-----------------------------------------------------------------------------
typedef int HServerQuery;
const int HSERVERQUERY_INVALID = 0xffffffff;
//-----------------------------------------------------------------------------
// Purpose: Functions for match making services for clients to get to game lists and details
//-----------------------------------------------------------------------------
class ISteamMatchmakingServers
{
public:
// Request a new list of servers of a particular type. These calls each correspond to one of the EMatchMakingType values.
// Each call allocates a new asynchronous request object.
// Request object must be released by calling ReleaseRequest( hServerListRequest )
virtual HServerListRequest RequestInternetServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestFriendsServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestFavoritesServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestHistoryServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestSpectatorServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
// Releases the asynchronous request object and cancels any pending query on it if there's a pending query in progress.
// RefreshComplete callback is not posted when request is released.
virtual void ReleaseRequest( HServerListRequest hServerListRequest ) = 0;
/* the filter operation codes that go in the key part of MatchMakingKeyValuePair_t should be one of these:
"map"
- Server passes the filter if the server is playing the specified map.
"gamedataand"
- Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains all of the
specified strings. The value field is a comma-delimited list of strings to match.
"gamedataor"
- Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains at least one of the
specified strings. The value field is a comma-delimited list of strings to match.
"gamedatanor"
- Server passes the filter if the server's game data (ISteamGameServer::SetGameData) does not contain any
of the specified strings. The value field is a comma-delimited list of strings to check.
"gametagsand"
- Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) contains all
of the specified strings. The value field is a comma-delimited list of strings to check.
"gametagsnor"
- Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) does not contain any
of the specified strings. The value field is a comma-delimited list of strings to check.
"and" (x1 && x2 && ... && xn)
"or" (x1 || x2 || ... || xn)
"nand" !(x1 && x2 && ... && xn)
"nor" !(x1 || x2 || ... || xn)
- Performs Boolean operation on the following filters. The operand to this filter specifies
the "size" of the Boolean inputs to the operation, in Key/value pairs. (The keyvalue
pairs must immediately follow, i.e. this is a prefix logical operator notation.)
In the simplest case where Boolean expressions are not nested, this is simply
the number of operands.
For example, to match servers on a particular map or with a particular tag, would would
use these filters.
( server.map == "cp_dustbowl" || server.gametags.contains("payload") )
"or", "2"
"map", "cp_dustbowl"
"gametagsand", "payload"
If logical inputs are nested, then the operand specifies the size of the entire
"length" of its operands, not the number of immediate children.
( server.map == "cp_dustbowl" || ( server.gametags.contains("payload") && !server.gametags.contains("payloadrace") ) )
"or", "4"
"map", "cp_dustbowl"
"and", "2"
"gametagsand", "payload"
"gametagsnor", "payloadrace"
Unary NOT can be achieved using either "nand" or "nor" with a single operand.
"addr"
- Server passes the filter if the server's query address matches the specified IP or IP:port.
"gameaddr"
- Server passes the filter if the server's game address matches the specified IP or IP:port.
The following filter operations ignore the "value" part of MatchMakingKeyValuePair_t
"dedicated"
- Server passes the filter if it passed true to SetDedicatedServer.
"secure"
- Server passes the filter if the server is VAC-enabled.
"notfull"
- Server passes the filter if the player count is less than the reported max player count.
"hasplayers"
- Server passes the filter if the player count is greater than zero.
"noplayers"
- Server passes the filter if it doesn't have any players.
"linux"
- Server passes the filter if it's a linux server
*/
// Get details on a given server in the list, you can get the valid range of index
// values by calling GetServerCount(). You will also receive index values in
// ISteamMatchmakingServerListResponse::ServerResponded() callbacks
virtual gameserveritem_t *GetServerDetails( HServerListRequest hRequest, int iServer ) = 0;
// Cancel an request which is operation on the given list type. You should call this to cancel
// any in-progress requests before destructing a callback object that may have been passed
// to one of the above list request calls. Not doing so may result in a crash when a callback
// occurs on the destructed object.
// Canceling a query does not release the allocated request handle.
// The request handle must be released using ReleaseRequest( hRequest )
virtual void CancelQuery( HServerListRequest hRequest ) = 0;
// Ping every server in your list again but don't update the list of servers
// Query callback installed when the server list was requested will be used
// again to post notifications and RefreshComplete, so the callback must remain
// valid until another RefreshComplete is called on it or the request
// is released with ReleaseRequest( hRequest )
virtual void RefreshQuery( HServerListRequest hRequest ) = 0;
// Returns true if the list is currently refreshing its server list
virtual bool IsRefreshing( HServerListRequest hRequest ) = 0;
// How many servers in the given list, GetServerDetails above takes 0... GetServerCount() - 1
virtual int GetServerCount( HServerListRequest hRequest ) = 0;
// Refresh a single server inside of a query (rather than all the servers )
virtual void RefreshServer( HServerListRequest hRequest, int iServer ) = 0;
//-----------------------------------------------------------------------------
// Queries to individual servers directly via IP/Port
//-----------------------------------------------------------------------------
// Request updated ping time and other details from a single server
virtual HServerQuery PingServer( uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse *pRequestServersResponse ) = 0;
// Request the list of players currently playing on a server
virtual HServerQuery PlayerDetails( uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse *pRequestServersResponse ) = 0;
// Request the list of rules that the server is running (See ISteamGameServer::SetKeyValue() to set the rules server side)
virtual HServerQuery ServerRules( uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse *pRequestServersResponse ) = 0;
// Cancel an outstanding Ping/Players/Rules query from above. You should call this to cancel
// any in-progress requests before destructing a callback object that may have been passed
// to one of the above calls to avoid crashing when callbacks occur.
virtual void CancelServerQuery( HServerQuery hServerQuery ) = 0;
};
#define STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION "SteamMatchMakingServers002"
// game server flags
const uint32 k_unFavoriteFlagNone = 0x00;
const uint32 k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list
const uint32 k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list
//-----------------------------------------------------------------------------
// Purpose: Used in ChatInfo messages - fields specific to a chat member - must fit in a uint32
//-----------------------------------------------------------------------------
enum EChatMemberStateChange
{
// Specific to joining / leaving the chatroom
k_EChatMemberStateChangeEntered = 0x0001, // This user has joined or is joining the chat room
k_EChatMemberStateChangeLeft = 0x0002, // This user has left or is leaving the chat room
k_EChatMemberStateChangeDisconnected = 0x0004, // User disconnected without leaving the chat first
k_EChatMemberStateChangeKicked = 0x0008, // User kicked
k_EChatMemberStateChangeBanned = 0x0010, // User kicked and banned
};
// returns true of the flags indicate that a user has been removed from the chat
#define BChatMemberStateChangeRemoved( rgfChatMemberStateChangeFlags ) ( rgfChatMemberStateChangeFlags & ( k_EChatMemberStateChangeDisconnected | k_EChatMemberStateChangeLeft | k_EChatMemberStateChangeKicked | k_EChatMemberStateChangeBanned ) )
//-----------------------------------------------------------------------------
// Callbacks for ISteamMatchmaking (which go through the regular Steam callback registration system)
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: a server was added/removed from the favorites list, you should refresh now
//-----------------------------------------------------------------------------
struct FavoritesListChanged_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 2 };
uint32 m_nIP; // an IP of 0 means reload the whole list, any other value means just one server
uint32 m_nQueryPort;
uint32 m_nConnPort;
uint32 m_nAppID;
uint32 m_nFlags;
bool m_bAdd; // true if this is adding the entry, otherwise it is a remove
AccountID_t m_unAccountId;
};
//-----------------------------------------------------------------------------
// Purpose: Someone has invited you to join a Lobby
// normally you don't need to do anything with this, since
// the Steam UI will also display a '<user> has invited you to the lobby, join?' dialog
//
// if the user outside a game chooses to join, your game will be launched with the parameter "+connect_lobby <64-bit lobby id>",
// or with the callback GameLobbyJoinRequested_t if they're already in-game
//-----------------------------------------------------------------------------
struct LobbyInvite_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 3 };
uint64 m_ulSteamIDUser; // Steam ID of the person making the invite
uint64 m_ulSteamIDLobby; // Steam ID of the Lobby
uint64 m_ulGameID; // GameID of the Lobby
};
//-----------------------------------------------------------------------------
// Purpose: Sent on entering a lobby, or on failing to enter
// m_EChatRoomEnterResponse will be set to k_EChatRoomEnterResponseSuccess on success,
// or a higher value on failure (see enum EChatRoomEnterResponse)
//-----------------------------------------------------------------------------
struct LobbyEnter_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 4 };
uint64 m_ulSteamIDLobby; // SteamID of the Lobby you have entered
uint32 m_rgfChatPermissions; // Permissions of the current user
bool m_bLocked; // If true, then only invited users may join
uint32 m_EChatRoomEnterResponse; // EChatRoomEnterResponse
};
//-----------------------------------------------------------------------------
// Purpose: The lobby metadata has changed
// if m_ulSteamIDMember is the steamID of a lobby member, use GetLobbyMemberData() to access per-user details
// if m_ulSteamIDMember == m_ulSteamIDLobby, use GetLobbyData() to access lobby metadata
//-----------------------------------------------------------------------------
struct LobbyDataUpdate_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 5 };
uint64 m_ulSteamIDLobby; // steamID of the Lobby
uint64 m_ulSteamIDMember; // steamID of the member whose data changed, or the room itself
uint8 m_bSuccess; // true if we lobby data was successfully changed;
// will only be false if RequestLobbyData() was called on a lobby that no longer exists
};
//-----------------------------------------------------------------------------
// Purpose: The lobby chat room state has changed
// this is usually sent when a user has joined or left the lobby
//-----------------------------------------------------------------------------
struct LobbyChatUpdate_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 6 };
uint64 m_ulSteamIDLobby; // Lobby ID
uint64 m_ulSteamIDUserChanged; // user who's status in the lobby just changed - can be recipient
uint64 m_ulSteamIDMakingChange; // Chat member who made the change (different from SteamIDUserChange if kicking, muting, etc.)
// for example, if one user kicks another from the lobby, this will be set to the id of the user who initiated the kick
uint32 m_rgfChatMemberStateChange; // bitfield of EChatMemberStateChange values
};
//-----------------------------------------------------------------------------
// Purpose: A chat message for this lobby has been sent
// use GetLobbyChatEntry( m_iChatID ) to retrieve the contents of this message
//-----------------------------------------------------------------------------
struct LobbyChatMsg_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 7 };
uint64 m_ulSteamIDLobby; // the lobby id this is in
uint64 m_ulSteamIDUser; // steamID of the user who has sent this message
uint8 m_eChatEntryType; // type of message
uint32 m_iChatID; // index of the chat entry to lookup
};
//-----------------------------------------------------------------------------
// Purpose: A game created a game for all the members of the lobby to join,
// as triggered by a SetLobbyGameServer()
// it's up to the individual clients to take action on this; the usual
// game behavior is to leave the lobby and connect to the specified game server
//-----------------------------------------------------------------------------
struct LobbyGameCreated_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 9 };
uint64 m_ulSteamIDLobby; // the lobby we were in
uint64 m_ulSteamIDGameServer; // the new game server that has been created or found for the lobby members
uint32 m_unIP; // IP & Port of the game server (if any)
uint16 m_usPort;
};
//-----------------------------------------------------------------------------
// Purpose: Number of matching lobbies found
// iterate the returned lobbies with GetLobbyByIndex(), from values 0 to m_nLobbiesMatching-1
//-----------------------------------------------------------------------------
struct LobbyMatchList_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 10 };
uint32 m_nLobbiesMatching; // Number of lobbies that matched search criteria and we have SteamIDs for
};
//-----------------------------------------------------------------------------
// Purpose: posted if a user is forcefully removed from a lobby
// can occur if a user loses connection to Steam
//-----------------------------------------------------------------------------
struct LobbyKicked_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 12 };
uint64 m_ulSteamIDLobby; // Lobby
uint64 m_ulSteamIDAdmin; // User who kicked you - possibly the ID of the lobby itself
uint8 m_bKickedDueToDisconnect; // true if you were kicked from the lobby due to the user losing connection to Steam (currently always true)
};
//-----------------------------------------------------------------------------
// Purpose: Result of our request to create a Lobby
// m_eResult == k_EResultOK on success
// at this point, the lobby has been joined and is ready for use
// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
//-----------------------------------------------------------------------------
struct LobbyCreated_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 13 };
EResult m_eResult; // k_EResultOK - the lobby was successfully created
// k_EResultNoConnection - your Steam client doesn't have a connection to the back-end
// k_EResultTimeout - you the message to the Steam servers, but it didn't respond
// k_EResultFail - the server responded, but with an unknown internal error
// k_EResultAccessDenied - your game isn't set to allow lobbies, or your client does haven't rights to play the game
// k_EResultLimitExceeded - your game client has created too many lobbies
uint64 m_ulSteamIDLobby; // chat room, zero if failed
};
// used by now obsolete RequestFriendsLobbiesResponse_t
// enum { k_iCallback = k_iSteamMatchmakingCallbacks + 14 };
//-----------------------------------------------------------------------------
// Purpose: Result of CheckForPSNGameBootInvite
// m_eResult == k_EResultOK on success
// at this point, the local user may not have finishing joining this lobby;
// game code should wait until the subsequent LobbyEnter_t callback is received
//-----------------------------------------------------------------------------
struct PSNGameBootInviteResult_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 15 };
bool m_bGameBootInviteExists;
CSteamID m_steamIDLobby; // Should be valid if m_bGameBootInviteExists == true
};
//-----------------------------------------------------------------------------
// Purpose: Result of our request to create a Lobby
// m_eResult == k_EResultOK on success
// at this point, the lobby has been joined and is ready for use
// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
//-----------------------------------------------------------------------------
struct FavoritesListAccountsUpdated_t
{
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 16 };
EResult m_eResult;
};
#pragma pack( pop )
#endif // ISTEAMMATCHMAKING

View File

@ -0,0 +1,67 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
#ifndef ISTEAMMUSIC_H
#define ISTEAMMUSIC_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
enum AudioPlayback_Status
{
AudioPlayback_Undefined = 0,
AudioPlayback_Playing = 1,
AudioPlayback_Paused = 2,
AudioPlayback_Idle = 3
};
//-----------------------------------------------------------------------------
// Purpose: Functions to control music playback in the steam client
//-----------------------------------------------------------------------------
class ISteamMusic
{
public:
virtual bool BIsEnabled() = 0;
virtual bool BIsPlaying() = 0;
virtual AudioPlayback_Status GetPlaybackStatus() = 0;
virtual void Play() = 0;
virtual void Pause() = 0;
virtual void PlayPrevious() = 0;
virtual void PlayNext() = 0;
// volume is between 0.0 and 1.0
virtual void SetVolume( float flVolume ) = 0;
virtual float GetVolume() = 0;
};
#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 )
CALLBACK_MEMBER( 0, float, m_flNewVolume )
END_DEFINE_CALLBACK_1()
#pragma pack( pop )
#endif // #define ISTEAMMUSIC_H

View File

@ -0,0 +1,129 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
#ifndef ISTEAMMUSICREMOTE_H
#define ISTEAMMUSICREMOTE_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
#include "isteammusic.h"
#define k_SteamMusicNameMaxLength 255
#define k_SteamMusicPNGMaxLength 65535
class ISteamMusicRemote
{
public:
// Service Definition
virtual bool RegisterSteamMusicRemote( const char *pchName ) = 0;
virtual bool DeregisterSteamMusicRemote() = 0;
virtual bool BIsCurrentMusicRemote() = 0;
virtual bool BActivationSuccess( bool bValue ) = 0;
virtual bool SetDisplayName( const char *pchDisplayName ) = 0;
virtual bool SetPNGIcon_64x64( void *pvBuffer, uint32 cbBufferLength ) = 0;
// Abilities for the user interface
virtual bool EnablePlayPrevious(bool bValue) = 0;
virtual bool EnablePlayNext( bool bValue ) = 0;
virtual bool EnableShuffled( bool bValue ) = 0;
virtual bool EnableLooped( bool bValue ) = 0;
virtual bool EnableQueue( bool bValue ) = 0;
virtual bool EnablePlaylists( bool bValue ) = 0;
// Status
virtual bool UpdatePlaybackStatus( AudioPlayback_Status nStatus ) = 0;
virtual bool UpdateShuffled( bool bValue ) = 0;
virtual bool UpdateLooped( bool bValue ) = 0;
virtual bool UpdateVolume( float flValue ) = 0; // volume is between 0.0 and 1.0
// Current Entry
virtual bool CurrentEntryWillChange() = 0;
virtual bool CurrentEntryIsAvailable( bool bAvailable ) = 0;
virtual bool UpdateCurrentEntryText( const char *pchText ) = 0;
virtual bool UpdateCurrentEntryElapsedSeconds( int nValue ) = 0;
virtual bool UpdateCurrentEntryCoverArt( void *pvBuffer, uint32 cbBufferLength ) = 0;
virtual bool CurrentEntryDidChange() = 0;
// Queue
virtual bool QueueWillChange() = 0;
virtual bool ResetQueueEntries() = 0;
virtual bool SetQueueEntry( int nID, int nPosition, const char *pchEntryText ) = 0;
virtual bool SetCurrentQueueEntry( int nID ) = 0;
virtual bool QueueDidChange() = 0;
// Playlist
virtual bool PlaylistWillChange() = 0;
virtual bool ResetPlaylistEntries() = 0;
virtual bool SetPlaylistEntry( int nID, int nPosition, const char *pchEntryText ) = 0;
virtual bool SetCurrentPlaylistEntry( int nID ) = 0;
virtual bool PlaylistDidChange() = 0;
};
#define STEAMMUSICREMOTE_INTERFACE_VERSION "STEAMMUSICREMOTE_INTERFACE_VERSION001"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
DEFINE_CALLBACK( MusicPlayerRemoteWillActivate_t, k_iSteamMusicRemoteCallbacks + 1)
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerRemoteWillDeactivate_t, k_iSteamMusicRemoteCallbacks + 2 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerRemoteToFront_t, k_iSteamMusicRemoteCallbacks + 3 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerWillQuit_t, k_iSteamMusicRemoteCallbacks + 4 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerWantsPlay_t, k_iSteamMusicRemoteCallbacks + 5 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerWantsPause_t, k_iSteamMusicRemoteCallbacks + 6 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerWantsPlayPrevious_t, k_iSteamMusicRemoteCallbacks + 7 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerWantsPlayNext_t, k_iSteamMusicRemoteCallbacks + 8 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( MusicPlayerWantsShuffled_t, k_iSteamMusicRemoteCallbacks + 9 )
CALLBACK_MEMBER( 0, bool, m_bShuffled )
END_DEFINE_CALLBACK_1()
DEFINE_CALLBACK( MusicPlayerWantsLooped_t, k_iSteamMusicRemoteCallbacks + 10 )
CALLBACK_MEMBER(0, bool, m_bLooped )
END_DEFINE_CALLBACK_1()
DEFINE_CALLBACK( MusicPlayerWantsVolume_t, k_iSteamMusicCallbacks + 11 )
CALLBACK_MEMBER(0, float, m_flNewVolume)
END_DEFINE_CALLBACK_1()
DEFINE_CALLBACK( MusicPlayerSelectsQueueEntry_t, k_iSteamMusicCallbacks + 12 )
CALLBACK_MEMBER(0, int, nID )
END_DEFINE_CALLBACK_1()
DEFINE_CALLBACK( MusicPlayerSelectsPlaylistEntry_t, k_iSteamMusicCallbacks + 13 )
CALLBACK_MEMBER(0, int, nID )
END_DEFINE_CALLBACK_1()
DEFINE_CALLBACK( MusicPlayerWantsPlayingRepeatStatus_t, k_iSteamMusicRemoteCallbacks + 14 )
CALLBACK_MEMBER(0, int, m_nPlayingRepeatStatus )
END_DEFINE_CALLBACK_1()
#pragma pack( pop )
#endif // #define ISTEAMMUSICREMOTE_H

View File

@ -0,0 +1,306 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to steam managing network connections between game clients & servers
//
//=============================================================================
#ifndef ISTEAMNETWORKING
#define ISTEAMNETWORKING
#ifdef _WIN32
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
// list of possible errors returned by SendP2PPacket() API
// these will be posted in the P2PSessionConnectFail_t callback
enum EP2PSessionError
{
k_EP2PSessionErrorNone = 0,
k_EP2PSessionErrorNotRunningApp = 1, // target is not running the same game
k_EP2PSessionErrorNoRightsToApp = 2, // local user doesn't own the app that is running
k_EP2PSessionErrorDestinationNotLoggedIn = 3, // target user isn't connected to Steam
k_EP2PSessionErrorTimeout = 4, // target isn't responding, perhaps not calling AcceptP2PSessionWithUser()
// corporate firewalls can also block this (NAT traversal is not firewall traversal)
// make sure that UDP ports 3478, 4379, and 4380 are open in an outbound direction
k_EP2PSessionErrorMax = 5
};
// SendP2PPacket() send types
// Typically k_EP2PSendUnreliable is what you want for UDP-like packets, k_EP2PSendReliable for TCP-like packets
enum EP2PSend
{
// Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare).
// The sending API does have some knowledge of the underlying connection, so if there is no NAT-traversal accomplished or
// there is a recognized adjustment happening on the connection, the packet will be batched until the connection is open again.
k_EP2PSendUnreliable = 0,
// As above, but if the underlying p2p connection isn't yet established the packet will just be thrown away. Using this on the first
// packet sent to a remote host almost guarantees the packet will be dropped.
// This is only really useful for kinds of data that should never buffer up, i.e. voice payload packets
k_EP2PSendUnreliableNoDelay = 1,
// Reliable message send. Can send up to 1MB of data in a single message.
// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for efficient sends of large chunks of data.
k_EP2PSendReliable = 2,
// As above, but applies the Nagle algorithm to the send - sends will accumulate
// until the current MTU size (typically ~1200 bytes, but can change) or ~200ms has passed (Nagle algorithm).
// Useful if you want to send a set of smaller messages but have the coalesced into a single packet
// Since the reliable stream is all ordered, you can do several small message sends with k_EP2PSendReliableWithBuffering and then
// do a normal k_EP2PSendReliable to force all the buffered data to be sent.
k_EP2PSendReliableWithBuffering = 3,
};
// connection state to a specified user, returned by GetP2PSessionState()
// this is under-the-hood info about what's going on with a SendP2PPacket(), shouldn't be needed except for debuggin
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
struct P2PSessionState_t
{
uint8 m_bConnectionActive; // true if we've got an active open connection
uint8 m_bConnecting; // true if we're currently trying to establish a connection
uint8 m_eP2PSessionError; // last error recorded (see enum above)
uint8 m_bUsingRelay; // true if it's going through a relay server (TURN)
int32 m_nBytesQueuedForSend;
int32 m_nPacketsQueuedForSend;
uint32 m_nRemoteIP; // potential IP:Port of remote host. Could be TURN server.
uint16 m_nRemotePort; // Only exists for compatibility with older authentication api's
};
#pragma pack( pop )
// handle to a socket
typedef uint32 SNetSocket_t; // CreateP2PConnectionSocket()
typedef uint32 SNetListenSocket_t; // CreateListenSocket()
// connection progress indicators, used by CreateP2PConnectionSocket()
enum ESNetSocketState
{
k_ESNetSocketStateInvalid = 0,
// communication is valid
k_ESNetSocketStateConnected = 1,
// states while establishing a connection
k_ESNetSocketStateInitiated = 10, // the connection state machine has started
// p2p connections
k_ESNetSocketStateLocalCandidatesFound = 11, // we've found our local IP info
k_ESNetSocketStateReceivedRemoteCandidates = 12,// we've received information from the remote machine, via the Steam back-end, about their IP info
// direct connections
k_ESNetSocketStateChallengeHandshake = 15, // we've received a challenge packet from the server
// failure states
k_ESNetSocketStateDisconnecting = 21, // the API shut it down, and we're in the process of telling the other end
k_ESNetSocketStateLocalDisconnect = 22, // the API shut it down, and we've completed shutdown
k_ESNetSocketStateTimeoutDuringConnect = 23, // we timed out while trying to creating the connection
k_ESNetSocketStateRemoteEndDisconnected = 24, // the remote end has disconnected from us
k_ESNetSocketStateConnectionBroken = 25, // connection has been broken; either the other end has disappeared or our local network connection has broke
};
// describes how the socket is currently connected
enum ESNetSocketConnectionType
{
k_ESNetSocketConnectionTypeNotConnected = 0,
k_ESNetSocketConnectionTypeUDP = 1,
k_ESNetSocketConnectionTypeUDPRelay = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Functions for making connections and sending data between clients,
// traversing NAT's where possible
//-----------------------------------------------------------------------------
class ISteamNetworking
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
// Session-less connection functions
// automatically establishes NAT-traversing or Relay server connections
// Sends a P2P packet to the specified user
// UDP-like, unreliable and a max packet size of 1200 bytes
// the first packet send may be delayed as the NAT-traversal code runs
// if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t
// see EP2PSend enum above for the descriptions of the different ways of sending packets
//
// nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket()
// with the same channel number in order to retrieve the data on the other end
// using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources
virtual bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0 ) = 0;
// returns true if any data is available for read, and the amount of data that will need to be read
virtual bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel = 0 ) = 0;
// reads in a packet that has been sent from another user via SendP2PPacket()
// returns the size of the message and the steamID of the user who sent it in the last two parameters
// if the buffer passed in is too small, the message will be truncated
// this call is not blocking, and will return false if no data is available
virtual bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel = 0 ) = 0;
// AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback
// P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet
// if you don't want to talk to the user, just ignore the request
// if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically
// this may be called multiple times for a single user
// (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)
virtual bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
// call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood
// if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted
virtual bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
// call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels
// open channels to a user have been closed, the open session to the user will be closed and new data from this
// user will trigger a P2PSessionRequest_t callback
virtual bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) = 0;
// fills out P2PSessionState_t structure with details about the underlying connection to the user
// should only needed for debugging purposes
// returns false if no connection exists to the specified user
virtual bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) = 0;
// Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection
// or NAT-traversal cannot be established. Only applies to connections created after setting this value,
// or to existing connections that need to automatically reconnect after this value is set.
//
// P2P packet relay is allowed by default
virtual bool AllowP2PPacketRelay( bool bAllow ) = 0;
////////////////////////////////////////////////////////////////////////////////////////////
// LISTEN / CONNECT style interface functions
//
// This is an older set of functions designed around the Berkeley TCP sockets model
// it's preferential that you use the above P2P functions, they're more robust
// and these older functions will be removed eventually
//
////////////////////////////////////////////////////////////////////////////////////////////
// creates a socket and listens others to connect
// will trigger a SocketStatusCallback_t callback on another client connecting
// nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports
// this can usually just be 0 unless you want multiple sets of connections
// unIP is the local IP address to bind to
// pass in 0 if you just want the default local IP
// unPort is the port to use
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0;
// creates a socket and begin connection to a remote destination
// can connect via a known steamID (client or game server), or directly to an IP
// on success will trigger a SocketStatusCallback_t callback
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0;
virtual SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 0;
// disconnects the connection to the socket, if any, and invalidates the handle
// any unread data on the socket will be thrown away
// if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect
virtual bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
// destroying a listen socket will automatically kill all the regular sockets generated from it
virtual bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
// sending data
// must be a handle to a connected socket
// data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets
// use the reliable flag with caution; although the resend rate is pretty aggressive,
// it can still cause stalls in receiving data (like TCP)
virtual bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) = 0;
// receiving data
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
virtual bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) = 0;
// fills in pubDest with the contents of the message
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
virtual bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
// checks for data from any socket that has been connected off this listen socket
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
// fills out *phSocket with the socket that data is available on
virtual bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
// retrieves data from any socket that has been connected off this listen socket
// fills in pubDest with the contents of the message
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
// fills out *phSocket with the socket that data is available on
virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
// returns information about the specified socket, filling out the contents of the pointers
virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote ) = 0;
// returns which local port the listen socket is bound to
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) = 0;
// returns true to describe how the socket ended up connecting
virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0;
// max packet size, in bytes
virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0;
};
#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking005"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
// callback notification - a user wants to talk to us over the P2P channel via the SendP2PPacket() API
// in response, a call to AcceptP2PPacketsFromUser() needs to be made, if you want to talk with them
struct P2PSessionRequest_t
{
enum { k_iCallback = k_iSteamNetworkingCallbacks + 2 };
CSteamID m_steamIDRemote; // user who wants to talk to us
};
// callback notification - packets can't get through to the specified user via the SendP2PPacket() API
// all packets queued packets unsent at this point will be dropped
// further attempts to send will retry making the connection (but will be dropped if we fail again)
struct P2PSessionConnectFail_t
{
enum { k_iCallback = k_iSteamNetworkingCallbacks + 3 };
CSteamID m_steamIDRemote; // user we were sending packets to
uint8 m_eP2PSessionError; // EP2PSessionError indicating why we're having trouble
};
// callback notification - status of a socket has changed
// used as part of the CreateListenSocket() / CreateP2PConnectionSocket()
struct SocketStatusCallback_t
{
enum { k_iCallback = k_iSteamNetworkingCallbacks + 1 };
SNetSocket_t m_hSocket; // the socket used to send/receive data to the remote host
SNetListenSocket_t m_hListenSocket; // this is the server socket that we were listening on; NULL if this was an outgoing connection
CSteamID m_steamIDRemote; // remote steamID we have connected to, if it has one
int m_eSNetSocketState; // socket state, ESNetSocketState
};
#pragma pack( pop )
#endif // ISTEAMNETWORKING

View File

@ -0,0 +1,696 @@
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: public interface to user remote file storage in Steam
//
//=============================================================================
#ifndef ISTEAMREMOTESTORAGE_H
#define ISTEAMREMOTESTORAGE_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
//-----------------------------------------------------------------------------
// Purpose: Defines the largest allowed file size. Cloud files cannot be written
// in a single chunk over 100MB (and cannot be over 200MB total.)
//-----------------------------------------------------------------------------
const uint32 k_unMaxCloudFileChunkSize = 100 * 1024 * 1024;
//-----------------------------------------------------------------------------
// Purpose: Structure that contains an array of const char * strings and the number of those strings
//-----------------------------------------------------------------------------
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
struct SteamParamStringArray_t
{
const char ** m_ppStrings;
int32 m_nNumStrings;
};
#pragma pack( pop )
// A handle to a piece of user generated content
typedef uint64 UGCHandle_t;
typedef uint64 PublishedFileUpdateHandle_t;
typedef uint64 PublishedFileId_t;
const PublishedFileId_t k_PublishedFileIdInvalid = 0;
const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull;
const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull;
// Handle for writing to Steam Cloud
typedef uint64 UGCFileWriteStreamHandle_t;
const UGCFileWriteStreamHandle_t k_UGCFileStreamHandleInvalid = 0xffffffffffffffffull;
const uint32 k_cchPublishedDocumentTitleMax = 128 + 1;
const uint32 k_cchPublishedDocumentDescriptionMax = 8000;
const uint32 k_cchPublishedDocumentChangeDescriptionMax = 8000;
const uint32 k_unEnumeratePublishedFilesMaxResults = 50;
const uint32 k_cchTagListMax = 1024 + 1;
const uint32 k_cchFilenameMax = 260;
const uint32 k_cchPublishedFileURLMax = 256;
// Ways to handle a synchronization conflict
enum EResolveConflict
{
k_EResolveConflictKeepClient = 1, // The local version of each file will be used to overwrite the server version
k_EResolveConflictKeepServer = 2, // The server version of each file will be used to overwrite the local version
};
enum ERemoteStoragePlatform
{
k_ERemoteStoragePlatformNone = 0,
k_ERemoteStoragePlatformWindows = (1 << 0),
k_ERemoteStoragePlatformOSX = (1 << 1),
k_ERemoteStoragePlatformPS3 = (1 << 2),
k_ERemoteStoragePlatformLinux = (1 << 3),
k_ERemoteStoragePlatformReserved2 = (1 << 4),
k_ERemoteStoragePlatformAll = 0xffffffff
};
enum ERemoteStoragePublishedFileVisibility
{
k_ERemoteStoragePublishedFileVisibilityPublic = 0,
k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1,
k_ERemoteStoragePublishedFileVisibilityPrivate = 2,
};
enum EWorkshopFileType
{
k_EWorkshopFileTypeFirst = 0,
k_EWorkshopFileTypeCommunity = 0, // normal Workshop item that can be subscribed to
k_EWorkshopFileTypeMicrotransaction = 1, // Workshop item that is meant to be voted on for the purpose of selling in-game
k_EWorkshopFileTypeCollection = 2, // a collection of Workshop or Greenlight items
k_EWorkshopFileTypeArt = 3, // artwork
k_EWorkshopFileTypeVideo = 4, // external video
k_EWorkshopFileTypeScreenshot = 5, // screenshot
k_EWorkshopFileTypeGame = 6, // Greenlight game entry
k_EWorkshopFileTypeSoftware = 7, // Greenlight software entry
k_EWorkshopFileTypeConcept = 8, // Greenlight concept
k_EWorkshopFileTypeWebGuide = 9, // Steam web guide
k_EWorkshopFileTypeIntegratedGuide = 10, // application integrated guide
k_EWorkshopFileTypeMerch = 11, // Workshop merchandise meant to be voted on for the purpose of being sold
k_EWorkshopFileTypeControllerBinding = 12, // Steam Controller bindings
k_EWorkshopFileTypeSteamworksAccessInvite = 13, // internal
k_EWorkshopFileTypeSteamVideo = 14, // Steam video
k_EWorkshopFileTypeGameManagedItem = 15, // managed completely by the game, not the user, and not shown on the web
// Update k_EWorkshopFileTypeMax if you add values.
k_EWorkshopFileTypeMax = 16
};
enum EWorkshopVote
{
k_EWorkshopVoteUnvoted = 0,
k_EWorkshopVoteFor = 1,
k_EWorkshopVoteAgainst = 2,
k_EWorkshopVoteLater = 3,
};
enum EWorkshopFileAction
{
k_EWorkshopFileActionPlayed = 0,
k_EWorkshopFileActionCompleted = 1,
};
enum EWorkshopEnumerationType
{
k_EWorkshopEnumerationTypeRankedByVote = 0,
k_EWorkshopEnumerationTypeRecent = 1,
k_EWorkshopEnumerationTypeTrending = 2,
k_EWorkshopEnumerationTypeFavoritesOfFriends = 3,
k_EWorkshopEnumerationTypeVotedByFriends = 4,
k_EWorkshopEnumerationTypeContentByFriends = 5,
k_EWorkshopEnumerationTypeRecentFromFollowedUsers = 6,
};
enum EWorkshopVideoProvider
{
k_EWorkshopVideoProviderNone = 0,
k_EWorkshopVideoProviderYoutube = 1
};
enum EUGCReadAction
{
// Keeps the file handle open unless the last byte is read. You can use this when reading large files (over 100MB) in sequential chunks.
// If the last byte is read, this will behave the same as k_EUGCRead_Close. Otherwise, it behaves the same as k_EUGCRead_ContinueReading.
// This value maintains the same behavior as before the EUGCReadAction parameter was introduced.
k_EUGCRead_ContinueReadingUntilFinished = 0,
// Keeps the file handle open. Use this when using UGCRead to seek to different parts of the file.
// When you are done seeking around the file, make a final call with k_EUGCRead_Close to close it.
k_EUGCRead_ContinueReading = 1,
// Frees the file handle. Use this when you're done reading the content.
// To read the file from Steam again you will need to call UGCDownload again.
k_EUGCRead_Close = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing, reading and writing files stored remotely
// and cached locally
//-----------------------------------------------------------------------------
class ISteamRemoteStorage
{
public:
// NOTE
//
// Filenames are case-insensitive, and will be converted to lowercase automatically.
// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then
// iterate the files, the filename returned will be "foo.bar".
//
// file operations
virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0;
virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0;
CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0;
CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0;
virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0;
virtual bool FileForget( const char *pchFile ) = 0;
virtual bool FileDelete( const char *pchFile ) = 0;
CALL_RESULT( RemoteStorageFileShareResult_t )
virtual SteamAPICall_t FileShare( const char *pchFile ) = 0;
virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0;
// file operations that cause network IO
virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0;
virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0;
virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0;
virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0;
// file information
virtual bool FileExists( const char *pchFile ) = 0;
virtual bool FilePersisted( const char *pchFile ) = 0;
virtual int32 GetFileSize( const char *pchFile ) = 0;
virtual int64 GetFileTimestamp( const char *pchFile ) = 0;
virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0;
// iteration
virtual int32 GetFileCount() = 0;
virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0;
// configuration management
virtual bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes ) = 0;
virtual bool IsCloudEnabledForAccount() = 0;
virtual bool IsCloudEnabledForApp() = 0;
virtual void SetCloudEnabledForApp( bool bEnabled ) = 0;
// user generated content
// Downloads a UGC file. A priority value of 0 will download the file immediately,
// otherwise it will wait to download the file until all downloads with a lower priority
// value are completed. Downloads with equal priority will occur simultaneously.
CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0;
// Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false
// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0;
// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0;
// After download, gets the content of the file.
// Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file.
// Larger files can be read in chunks to reduce memory usage (since both sides of the IPC client and the game itself must allocate
// enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail
// unless UGCDownload is called again.
// For especially large files (anything over 100MB) it is a requirement that the file is read in chunks.
virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0;
// Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead()
virtual int32 GetCachedUGCCount() = 0;
virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0;
// The following functions are only necessary on the Playstation 3. On PC & Mac, the Steam client will handle these operations for you
// On Playstation 3, the game controls which files are stored in the cloud, via FilePersist, FileFetch, and FileForget.
#if defined(_PS3) || defined(_SERVER)
// Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback
virtual void GetFileListFromServer() = 0;
// Indicate this file should be downloaded in the next sync
virtual bool FileFetch( const char *pchFile ) = 0;
// Indicate this file should be persisted in the next sync
virtual bool FilePersist( const char *pchFile ) = 0;
// Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback
virtual bool SynchronizeToClient() = 0;
// Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback
virtual bool SynchronizeToServer() = 0;
// Reset any fetch/persist/etc requests
virtual bool ResetFileRequestState() = 0;
#endif
// publishing UGC
CALL_RESULT( RemoteStoragePublishFileProgress_t )
virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0;
virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0;
virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0;
virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0;
virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0;
virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0;
virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0;
virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0;
CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0;
// Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0,
// cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh.
// A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is.
CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0;
CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
// enumerate the files that the current user published with this app
CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0;
CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0;
CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0;
CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
CALL_RESULT( RemoteStorageUpdateUserPublishedItemVoteResult_t )
virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0;
CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0;
CALL_RESULT( RemoteStoragePublishFileProgress_t )
virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0;
CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0;
CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0;
// this method enumerates the public view of workshop files
CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0;
CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0;
};
#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION013"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: sent when the local file cache is fully synced with the server for an app
// That means that an application can be started and has all latest files
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncedClient_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 1 };
AppId_t m_nAppID;
EResult m_eResult;
int m_unNumDownloads;
};
//-----------------------------------------------------------------------------
// Purpose: sent when the server is fully synced with the local file cache for an app
// That means that we can shutdown Steam and our data is stored on the server
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncedServer_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 2 };
AppId_t m_nAppID;
EResult m_eResult;
int m_unNumUploads;
};
//-----------------------------------------------------------------------------
// Purpose: Status of up and downloads during a sync session
//
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncProgress_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 3 };
char m_rgchCurrentFile[k_cchFilenameMax]; // Current file being transferred
AppId_t m_nAppID; // App this info relates to
uint32 m_uBytesTransferredThisChunk; // Bytes transferred this chunk
double m_dAppPercentComplete; // Percent complete that this app's transfers are
bool m_bUploading; // if false, downloading
};
//
// IMPORTANT! k_iClientRemoteStorageCallbacks + 4 is used, see iclientremotestorage.h
//
//-----------------------------------------------------------------------------
// Purpose: Sent after we've determined the list of files that are out of sync
// with the server.
//-----------------------------------------------------------------------------
struct RemoteStorageAppSyncStatusCheck_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 5 };
AppId_t m_nAppID;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Sent after a conflict resolution attempt.
//-----------------------------------------------------------------------------
struct RemoteStorageConflictResolution_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 6 };
AppId_t m_nAppID;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to FileShare()
//-----------------------------------------------------------------------------
struct RemoteStorageFileShareResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 };
EResult m_eResult; // The result of the operation
UGCHandle_t m_hFile; // The handle that can be shared with users and features
char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared
};
// k_iClientRemoteStorageCallbacks + 8 is deprecated! Do not reuse
//-----------------------------------------------------------------------------
// Purpose: The result of a call to PublishFile()
//-----------------------------------------------------------------------------
struct RemoteStoragePublishFileResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 9 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to DeletePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageDeletePublishedFileResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 11 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to EnumerateUserPublishedFiles()
//-----------------------------------------------------------------------------
struct RemoteStorageEnumerateUserPublishedFilesResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 12 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to SubscribePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageSubscribePublishedFileResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 13 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to EnumerateSubscribePublishedFiles()
//-----------------------------------------------------------------------------
struct RemoteStorageEnumerateUserSubscribedFilesResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 14 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
uint32 m_rgRTimeSubscribed[ k_unEnumeratePublishedFilesMaxResults ];
};
#if defined(VALVE_CALLBACK_PACK_SMALL)
VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 );
#elif defined(VALVE_CALLBACK_PACK_LARGE)
VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 + 4 );
#else
#warning You must first include isteamclient.h
#endif
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UnsubscribePublishedFile()
//-----------------------------------------------------------------------------
struct RemoteStorageUnsubscribePublishedFileResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 15 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to CommitPublishedFileUpdate()
//-----------------------------------------------------------------------------
struct RemoteStorageUpdatePublishedFileResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 16 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UGCDownload()
//-----------------------------------------------------------------------------
struct RemoteStorageDownloadUGCResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 17 };
EResult m_eResult; // The result of the operation.
UGCHandle_t m_hFile; // The handle to the file that was attempted to be downloaded.
AppId_t m_nAppID; // ID of the app that created this file.
int32 m_nSizeInBytes; // The size of the file that was downloaded, in bytes.
char m_pchFileName[k_cchFilenameMax]; // The name of the file that was downloaded.
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetPublishedFileDetails()
//-----------------------------------------------------------------------------
struct RemoteStorageGetPublishedFileDetailsResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 18 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId;
AppId_t m_nCreatorAppID; // ID of the app that created this file.
AppId_t m_nConsumerAppID; // ID of the app that will consume this file.
char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document
char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document
UGCHandle_t m_hFile; // The handle of the primary file
UGCHandle_t m_hPreviewFile; // The handle of the preview file
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
uint32 m_rtimeCreated; // time when the published file was created
uint32 m_rtimeUpdated; // time when the published file was last updated
ERemoteStoragePublishedFileVisibility m_eVisibility;
bool m_bBanned;
char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file
bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer
char m_pchFileName[k_cchFilenameMax]; // The name of the primary file
int32 m_nFileSize; // Size of the primary file
int32 m_nPreviewFileSize; // Size of the preview file
char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website)
EWorkshopFileType m_eFileType; // Type of the file
bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop
};
struct RemoteStorageEnumerateWorkshopFilesResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 19 };
EResult m_eResult;
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ];
AppId_t m_nAppId;
uint32 m_unStartIndex;
};
//-----------------------------------------------------------------------------
// Purpose: The result of GetPublishedItemVoteDetails
//-----------------------------------------------------------------------------
struct RemoteStorageGetPublishedItemVoteDetailsResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 20 };
EResult m_eResult;
PublishedFileId_t m_unPublishedFileId;
int32 m_nVotesFor;
int32 m_nVotesAgainst;
int32 m_nReports;
float m_fScore;
};
//-----------------------------------------------------------------------------
// Purpose: User subscribed to a file for the app (from within the app or on the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileSubscribed_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 21 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: User unsubscribed from a file for the app (from within the app or on the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileUnsubscribed_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 22 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: Published file that a user owns was deleted (from within the app or the web)
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileDeleted_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 23 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to UpdateUserPublishedItemVote()
//-----------------------------------------------------------------------------
struct RemoteStorageUpdateUserPublishedItemVoteResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 24 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetUserPublishedItemVoteDetails()
//-----------------------------------------------------------------------------
struct RemoteStorageUserVoteDetails_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 25 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
EWorkshopVote m_eVote; // what the user voted
};
struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 26 };
EResult m_eResult; // The result of the operation.
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
};
struct RemoteStorageSetUserPublishedFileActionResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 27 };
EResult m_eResult; // The result of the operation.
PublishedFileId_t m_nPublishedFileId; // The published file id
EWorkshopFileAction m_eAction; // the action that was attempted
};
struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 28 };
EResult m_eResult; // The result of the operation.
EWorkshopFileAction m_eAction; // the action that was filtered on
int32 m_nResultsReturned;
int32 m_nTotalResultCount;
PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ];
uint32 m_rgRTimeUpdated[ k_unEnumeratePublishedFilesMaxResults ];
};
//-----------------------------------------------------------------------------
// Purpose: Called periodically while a PublishWorkshopFile is in progress
//-----------------------------------------------------------------------------
struct RemoteStoragePublishFileProgress_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 29 };
double m_dPercentFile;
bool m_bPreview;
};
//-----------------------------------------------------------------------------
// Purpose: Called when the content for a published file is updated
//-----------------------------------------------------------------------------
struct RemoteStoragePublishedFileUpdated_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 30 };
PublishedFileId_t m_nPublishedFileId; // The published file id
AppId_t m_nAppID; // ID of the app that will consume this file.
uint64 m_ulUnused; // not used anymore
};
//-----------------------------------------------------------------------------
// Purpose: Called when a FileWriteAsync completes
//-----------------------------------------------------------------------------
struct RemoteStorageFileWriteAsyncComplete_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 31 };
EResult m_eResult; // result
};
//-----------------------------------------------------------------------------
// Purpose: Called when a FileReadAsync completes
//-----------------------------------------------------------------------------
struct RemoteStorageFileReadAsyncComplete_t
{
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 32 };
SteamAPICall_t m_hFileReadAsync; // call handle of the async read which was made
EResult m_eResult; // result
uint32 m_nOffset; // offset in the file this read was at
uint32 m_cubRead; // amount read - will the <= the amount requested
};
#pragma pack( pop )
#endif // ISTEAMREMOTESTORAGE_H

View File

@ -0,0 +1,96 @@
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: public interface to user remote file storage in Steam
//
//=============================================================================
#ifndef ISTEAMSCREENSHOTS_H
#define ISTEAMSCREENSHOTS_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
const uint32 k_nScreenshotMaxTaggedUsers = 32;
const uint32 k_nScreenshotMaxTaggedPublishedFiles = 32;
const int k_cubUFSTagTypeMax = 255;
const int k_cubUFSTagValueMax = 255;
// Required with of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail
// one will be generated.
const int k_ScreenshotThumbWidth = 200;
// Handle is valid for the lifetime of your process and no longer
typedef uint32 ScreenshotHandle;
#define INVALID_SCREENSHOT_HANDLE 0
//-----------------------------------------------------------------------------
// Purpose: Functions for adding screenshots to the user's screenshot library
//-----------------------------------------------------------------------------
class ISteamScreenshots
{
public:
// Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format.
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
virtual ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight ) = 0;
// Adds a screenshot to the user's screenshot library from disk. If a thumbnail is provided, it must be 200 pixels wide and the same aspect ratio
// as the screenshot, otherwise a thumbnail will be generated if the user uploads the screenshot. The screenshots must be in either JPEG or TGA format.
// The return value is a handle that is valid for the duration of the game process and can be used to apply tags.
// JPEG, TGA, and PNG formats are supported.
virtual ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight ) = 0;
// Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead.
virtual void TriggerScreenshot() = 0;
// Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots,
// then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary
// in response.
virtual void HookScreenshots( bool bHook ) = 0;
// Sets metadata about a screenshot's location (for example, the name of the map)
virtual bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) = 0;
// Tags a user as being visible in the screenshot
virtual bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) = 0;
// Tags a published file as being visible in the screenshot
virtual bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID ) = 0;
};
#define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION002"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: Screenshot successfully written or otherwise added to the library
// and can now be tagged
//-----------------------------------------------------------------------------
struct ScreenshotReady_t
{
enum { k_iCallback = k_iSteamScreenshotsCallbacks + 1 };
ScreenshotHandle m_hLocal;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Screenshot has been requested by the user. Only sent if
// HookScreenshots() has been called, in which case Steam will not take
// the screenshot itself.
//-----------------------------------------------------------------------------
struct ScreenshotRequested_t
{
enum { k_iCallback = k_iSteamScreenshotsCallbacks + 2 };
};
#pragma pack( pop )
#endif // ISTEAMSCREENSHOTS_H

407
SpyCustom/sdk/isteamugc.h Normal file
View File

@ -0,0 +1,407 @@
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to steam ugc
//
//=============================================================================
#ifndef ISTEAMUGC_H
#define ISTEAMUGC_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
typedef uint64 UGCQueryHandle_t;
typedef uint64 UGCUpdateHandle_t;
const UGCQueryHandle_t k_UGCQueryHandleInvalid = 0xffffffffffffffffull;
const UGCUpdateHandle_t k_UGCUpdateHandleInvalid = 0xffffffffffffffffull;
// Matching UGC types for queries
enum EUGCMatchingUGCType
{
k_EUGCMatchingUGCType_Items = 0, // both mtx items and ready-to-use items
k_EUGCMatchingUGCType_Items_Mtx = 1,
k_EUGCMatchingUGCType_Items_ReadyToUse = 2,
k_EUGCMatchingUGCType_Collections = 3,
k_EUGCMatchingUGCType_Artwork = 4,
k_EUGCMatchingUGCType_Videos = 5,
k_EUGCMatchingUGCType_Screenshots = 6,
k_EUGCMatchingUGCType_AllGuides = 7, // both web guides and integrated guides
k_EUGCMatchingUGCType_WebGuides = 8,
k_EUGCMatchingUGCType_IntegratedGuides = 9,
k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides
k_EUGCMatchingUGCType_ControllerBindings = 11,
k_EUGCMatchingUGCType_GameManagedItems = 12, // game managed items (not managed by users)
k_EUGCMatchingUGCType_All = ~0, // return everything
};
// Different lists of published UGC for a user.
// If the current logged in user is different than the specified user, then some options may not be allowed.
enum EUserUGCList
{
k_EUserUGCList_Published,
k_EUserUGCList_VotedOn,
k_EUserUGCList_VotedUp,
k_EUserUGCList_VotedDown,
k_EUserUGCList_WillVoteLater,
k_EUserUGCList_Favorited,
k_EUserUGCList_Subscribed,
k_EUserUGCList_UsedOrPlayed,
k_EUserUGCList_Followed,
};
// Sort order for user published UGC lists (defaults to creation order descending)
enum EUserUGCListSortOrder
{
k_EUserUGCListSortOrder_CreationOrderDesc,
k_EUserUGCListSortOrder_CreationOrderAsc,
k_EUserUGCListSortOrder_TitleAsc,
k_EUserUGCListSortOrder_LastUpdatedDesc,
k_EUserUGCListSortOrder_SubscriptionDateDesc,
k_EUserUGCListSortOrder_VoteScoreDesc,
k_EUserUGCListSortOrder_ForModeration,
};
// Combination of sorting and filtering for queries across all UGC
enum EUGCQuery
{
k_EUGCQuery_RankedByVote = 0,
k_EUGCQuery_RankedByPublicationDate = 1,
k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate = 2,
k_EUGCQuery_RankedByTrend = 3,
k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate = 4,
k_EUGCQuery_CreatedByFriendsRankedByPublicationDate = 5,
k_EUGCQuery_RankedByNumTimesReported = 6,
k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate = 7,
k_EUGCQuery_NotYetRated = 8,
k_EUGCQuery_RankedByTotalVotesAsc = 9,
k_EUGCQuery_RankedByVotesUp = 10,
k_EUGCQuery_RankedByTextSearch = 11,
k_EUGCQuery_RankedByTotalUniqueSubscriptions = 12,
};
enum EItemUpdateStatus
{
k_EItemUpdateStatusInvalid = 0, // The item update handle was invalid, job might be finished, listen too SubmitItemUpdateResult_t
k_EItemUpdateStatusPreparingConfig = 1, // The item update is processing configuration data
k_EItemUpdateStatusPreparingContent = 2, // The item update is reading and processing content files
k_EItemUpdateStatusUploadingContent = 3, // The item update is uploading content changes to Steam
k_EItemUpdateStatusUploadingPreviewFile = 4, // The item update is uploading new preview file image
k_EItemUpdateStatusCommittingChanges = 5 // The item update is committing all changes
};
enum EItemState
{
k_EItemStateNone = 0, // item not tracked on client
k_EItemStateSubscribed = 1, // current user is subscribed to this item. Not just cached.
k_EItemStateLegacyItem = 2, // item was created with ISteamRemoteStorage
k_EItemStateInstalled = 4, // item is installed and usable (but maybe out of date)
k_EItemStateNeedsUpdate = 8, // items needs an update. Either because it's not installed yet or creator updated content
k_EItemStateDownloading = 16, // item update is currently downloading
k_EItemStateDownloadPending = 32, // DownloadItem() was called for this item, content isn't available until DownloadItemResult_t is fired
};
enum EItemStatistic
{
k_EItemStatistic_NumSubscriptions = 0,
k_EItemStatistic_NumFavorites = 1,
k_EItemStatistic_NumFollowers = 2,
k_EItemStatistic_NumUniqueSubscriptions = 3,
k_EItemStatistic_NumUniqueFavorites = 4,
k_EItemStatistic_NumUniqueFollowers = 5,
k_EItemStatistic_NumUniqueWebsiteViews = 6,
k_EItemStatistic_ReportScore = 7,
};
enum EItemPreviewType
{
k_EItemPreviewType_Image = 0,
k_EItemPreviewType_YouTubeVideo = 1,
k_EItemPreviewType_Sketchfab = 2,
k_EItemPreviewType_ReservedMax = 255, // you can specify your own types above this value
};
const uint32 kNumUGCResultsPerPage = 50;
const uint32 k_cchDeveloperMetadataMax = 5000;
// Details for a single published file/UGC
struct SteamUGCDetails_t
{
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult; // The result of the operation.
EWorkshopFileType m_eFileType; // Type of the file
AppId_t m_nCreatorAppID; // ID of the app that created this file.
AppId_t m_nConsumerAppID; // ID of the app that will consume this file.
char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document
char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
uint32 m_rtimeCreated; // time when the published file was created
uint32 m_rtimeUpdated; // time when the published file was last updated
uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable)
ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility
bool m_bBanned; // whether the file was banned
bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop
bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer
char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file
// file/url information
UGCHandle_t m_hFile; // The handle of the primary file
UGCHandle_t m_hPreviewFile; // The handle of the preview file
char m_pchFileName[k_cchFilenameMax]; // The cloud filename of the primary file
int32 m_nFileSize; // Size of the primary file
int32 m_nPreviewFileSize; // Size of the preview file
char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website)
// voting information
uint32 m_unVotesUp; // number of votes up
uint32 m_unVotesDown; // number of votes down
float m_flScore; // calculated score
// collection details
uint32 m_unNumChildren;
};
//-----------------------------------------------------------------------------
// Purpose: Steam UGC support API
//-----------------------------------------------------------------------------
class ISteamUGC
{
public:
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
// Send the query to Steam
CALL_RESULT( SteamUGCQueryCompleted_t )
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
// Retrieve an individual result after receiving the callback for querying UGC
virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0;
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0;
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0;
virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0;
virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint32 *pStatValue ) = 0;
virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType ) = 0;
virtual uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
// Release the request to free up memory, after retrieving results
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
// Options to set for querying UGC
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0;
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0;
virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0;
virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0;
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0;
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
// Options only for querying user UGC
virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0;
// Options only for querying all UGC
virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0;
virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0;
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0;
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
// Steam Workshop Creator API
CALL_RESULT( CreateItemResult_t )
virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet
virtual UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()
virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item
virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item
virtual bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item
virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) = 0; // change the tags of an UGC item
virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder
virtual bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) = 0; // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size
virtual bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
virtual bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue ) = 0; // add new key-value tags for the item. Note that there can be multiple values for a tag.
virtual bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
virtual bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) = 0; // add preview video for this item
virtual bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
virtual bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
CALL_RESULT( SubmitItemUpdateResult_t )
virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate()
virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0;
// Steam Workshop Consumer API
CALL_RESULT( SetUserItemVoteResult_t )
virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0;
CALL_RESULT( GetUserItemVoteResult_t )
virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0;
CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
// get EItemState flags about item on this client
virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0;
// get info about currently installed content on disc for items that have k_EItemStateInstalled set
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
// download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,
// then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0;
// game servers can set a specific workshop folder before issuing any UGC commands.
// This is helpful if you want to support multiple game servers running out of the same install folder
virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0;
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
virtual void SuspendDownloads( bool bSuspend ) = 0;
};
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION008"
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
//-----------------------------------------------------------------------------
struct SteamUGCQueryCompleted_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 1 };
UGCQueryHandle_t m_handle;
EResult m_eResult;
uint32 m_unNumResultsReturned;
uint32 m_unTotalMatchingResults;
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
};
//-----------------------------------------------------------------------------
// Purpose: Callback for requesting details on one piece of UGC
//-----------------------------------------------------------------------------
struct SteamUGCRequestUGCDetailsResult_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 2 };
SteamUGCDetails_t m_details;
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
};
//-----------------------------------------------------------------------------
// Purpose: result for ISteamUGC::CreateItem()
//-----------------------------------------------------------------------------
struct CreateItemResult_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 3 };
EResult m_eResult;
PublishedFileId_t m_nPublishedFileId; // new item got this UGC PublishFileID
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: result for ISteamUGC::SubmitItemUpdate()
//-----------------------------------------------------------------------------
struct SubmitItemUpdateResult_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 4 };
EResult m_eResult;
bool m_bUserNeedsToAcceptWorkshopLegalAgreement;
};
//-----------------------------------------------------------------------------
// Purpose: a Workshop item has been installed or updated
//-----------------------------------------------------------------------------
struct ItemInstalled_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 5 };
AppId_t m_unAppID;
PublishedFileId_t m_nPublishedFileId;
};
//-----------------------------------------------------------------------------
// Purpose: result of DownloadItem(), existing item files can be accessed again
//-----------------------------------------------------------------------------
struct DownloadItemResult_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 6 };
AppId_t m_unAppID;
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: result of AddItemToFavorites() or RemoveItemFromFavorites()
//-----------------------------------------------------------------------------
struct UserFavoriteItemsListChanged_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 7 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
bool m_bWasAddRequest;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to SetUserItemVote()
//-----------------------------------------------------------------------------
struct SetUserItemVoteResult_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 8 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
bool m_bVoteUp;
};
//-----------------------------------------------------------------------------
// Purpose: The result of a call to GetUserItemVote()
//-----------------------------------------------------------------------------
struct GetUserItemVoteResult_t
{
enum { k_iCallback = k_iClientUGCCallbacks + 9 };
PublishedFileId_t m_nPublishedFileId;
EResult m_eResult;
bool m_bVotedUp;
bool m_bVotedDown;
bool m_bVoteSkipped;
};
#pragma pack( pop )
#endif // ISTEAMUGC_H

View File

@ -0,0 +1,63 @@
//====== Copyright <20> 1996-2007, Valve Corporation, All rights reserved. =======
//
// Purpose: Interface to unified messages client
//
// You should not need to use this interface except if your product is using a language other than C++.
// Contact your Steam Tech contact for more details.
//
//=============================================================================
#ifndef ISTEAMUNIFIEDMESSAGES_H
#define ISTEAMUNIFIEDMESSAGES_H
#ifdef _WIN32
#pragma once
#endif
typedef uint64 ClientUnifiedMessageHandle;
class ISteamUnifiedMessages
{
public:
static const ClientUnifiedMessageHandle k_InvalidUnifiedMessageHandle = 0;
// Sends a service method (in binary serialized form) using the Steam Client.
// Returns a unified message handle (k_InvalidUnifiedMessageHandle if could not send the message).
virtual ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void *pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext ) = 0;
// Gets the size of the response and the EResult. Returns false if the response is not ready yet.
virtual bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult ) = 0;
// Gets a response in binary serialized form (and optionally release the corresponding allocated memory).
virtual bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease ) = 0;
// Releases the message and its corresponding allocated memory.
virtual bool ReleaseMethod( ClientUnifiedMessageHandle hHandle ) = 0;
// Sends a service notification (in binary serialized form) using the Steam Client.
// Returns true if the notification was sent successfully.
virtual bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize ) = 0;
};
#define STEAMUNIFIEDMESSAGES_INTERFACE_VERSION "STEAMUNIFIEDMESSAGES_INTERFACE_VERSION001"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
struct SteamUnifiedMessagesSendMethodResult_t
{
enum { k_iCallback = k_iClientUnifiedMessagesCallbacks + 1 };
ClientUnifiedMessageHandle m_hHandle; // The handle returned by SendMethod().
uint64 m_unContext; // Context provided when calling SendMethod().
EResult m_eResult; // The result of the method call.
uint32 m_unResponseSize; // The size of the response.
};
#pragma pack( pop )
#endif // ISTEAMUNIFIEDMESSAGES_H

350
SpyCustom/sdk/isteamuser.h Normal file
View File

@ -0,0 +1,350 @@
//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to user account information in Steam
//
//=============================================================================
#ifndef ISTEAMUSER_H
#define ISTEAMUSER_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h" "
// structure that contains client callback data
// see callbacks documentation for more details
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
struct CallbackMsg_t
{
HSteamUser m_hSteamUser;
int m_iCallback;
uint8 *m_pubParam;
int m_cubParam;
};
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Result from RequestEncryptedAppTicket
//-----------------------------------------------------------------------------
struct EncryptedAppTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 54 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing and manipulating a steam account
// associated with one client instance
//-----------------------------------------------------------------------------
class ISteamUser
{
public:
// returns the HSteamUser this interface represents
// this is only used internally by the API, and by a few select interfaces that support multi-user
virtual HSteamUser GetHSteamUser() = 0;
// returns true if the Steam client current has a live connection to the Steam servers.
// If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy.
// The Steam client will automatically be trying to recreate the connection as often as possible.
virtual bool BLoggedOn() = 0;
// returns the CSteamID of the account currently logged into the Steam client
// a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API
virtual CSteamID GetSteamID() = 0;
// Multiplayer Authentication functions
// InitiateGameConnection() starts the state machine for authenticating the game client with the game server
// It is the client portion of a three-way handshake between the client, the game server, and the steam servers
//
// Parameters:
// void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token.
// int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes.
// CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
// CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( <appID> )
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
// bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running)
//
// return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed
// The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process.
virtual int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) = 0;
// notify of disconnect
// needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call
virtual void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) = 0;
// Legacy functions
// used by only a few games to track usage events
virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0;
// get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
// this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0;
// Starts voice recording. Once started, use GetVoice() to get the data
virtual void StartVoiceRecording( ) = 0;
// Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for
// a little bit after this function is called. GetVoice() should continue to be called until it returns
// k_eVoiceResultNotRecording
virtual void StopVoiceRecording( ) = 0;
// Determine the amount of captured audio data that is available in bytes.
// This provides both the compressed and uncompressed data. Please note that the uncompressed
// data is not the raw feed from the microphone: data may only be available if audible
// levels of speech are detected.
// nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case)
// If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate
virtual EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate ) = 0;
// Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to
// DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format.
// Please note that the uncompressed data is not the raw feed from the microphone: data may only be available if audible
// levels of speech are detected, and may have passed through denoising filters, etc.
// This function should be called as often as possible once recording has started; once per frame at least.
// nBytesWritten is set to the number of bytes written to pDestBuffer.
// nUncompressedBytesWritten is set to the number of bytes written to pUncompressedDestBuffer.
// You must grab both compressed and uncompressed here at the same time, if you want both.
// Matching data that is not read during this call will be thrown away.
// GetAvailableVoice() can be used to determine how much data is actually available.
// If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate
virtual EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 *nUncompressBytesWritten, uint32 nUncompressedVoiceDesiredSampleRate ) = 0;
// Decompresses a chunk of compressed data produced by GetVoice().
// nBytesWritten is set to the number of bytes written to pDestBuffer unless the return value is k_EVoiceResultBufferTooSmall.
// In that case, nBytesWritten is set to the size of the buffer required to decompress the given
// data. The suggested buffer size for the destination buffer is 22 kilobytes.
// The output format of the data is 16-bit signed at the requested samples per second.
// If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nDesiredSampleRate
virtual EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate ) = 0;
// This returns the frequency of the voice data as it's stored internally; calling DecompressVoice() with this size will yield the best results
virtual uint32 GetVoiceOptimalSampleRate() = 0;
// Retrieve ticket to be sent to the entity who wishes to authenticate you.
// pcbTicket retrieves the length of the actual ticket.
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
// Authenticate ticket from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
virtual void EndAuthSession( CSteamID steamID ) = 0;
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
// After receiving a user's authentication data, and passing it to BeginAuthSession, use this function
// to determine if the user owns downloadable content specified by the provided AppID.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
// returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam
// (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.
virtual bool BIsBehindNAT() = 0;
// set data to be replicated to friends so that they can join your game
// CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
virtual void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer ) = 0;
// Requests a ticket encrypted with an app specific shared key
// pDataToInclude, cbDataToInclude will be encrypted into the ticket
// ( This is asynchronous, you must wait for the ticket to be completed by the server )
CALL_RESULT( EncryptedAppTicketResponse_t )
virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0;
// retrieve a finished ticket
virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
// Trading Card badges data access
// if you only have one set of cards, the series will be 1
// the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)
virtual int GetGameBadgeLevel( int nSeries, bool bFoil ) = 0;
// gets the Steam Level of the user, as shown on their profile
virtual int GetPlayerSteamLevel() = 0;
// Requests a URL which authenticates an in-game browser for store check-out,
// and then redirects to the specified URL. As long as the in-game browser
// accepts and handles session cookies, Steam microtransaction checkout pages
// will automatically recognize the user instead of presenting a login page.
// The result of this API call will be a StoreAuthURLResponse_t callback.
// NOTE: The URL has a very short lifetime to prevent history-snooping attacks,
// so you should only call this API when you are about to launch the browser,
// or else immediately navigate to the result URL using a hidden browser window.
// NOTE 2: The resulting authorization cookie has an expiration time of one day,
// so it would be a good idea to request and visit a new auth URL every 12 hours.
CALL_RESULT( StoreAuthURLResponse_t )
virtual SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL ) = 0;
// gets whether the users phone number is verified
virtual bool BIsPhoneVerified() = 0;
// gets whether the user has two factor enabled on their account
virtual bool BIsTwoFactorEnabled() = 0;
};
#define STEAMUSER_INTERFACE_VERSION "SteamUser019"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: called when a connections to the Steam back-end has been established
// this means the Steam client now has a working connection to the Steam servers
// usually this will have occurred before the game has launched, and should
// only be seen if the user has dropped connection due to a networking issue
// or a Steam server update
//-----------------------------------------------------------------------------
struct SteamServersConnected_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 1 };
};
//-----------------------------------------------------------------------------
// Purpose: called when a connection attempt has failed
// this will occur periodically if the Steam client is not connected,
// and has failed in it's retry to establish a connection
//-----------------------------------------------------------------------------
struct SteamServerConnectFailure_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 2 };
EResult m_eResult;
bool m_bStillRetrying;
};
//-----------------------------------------------------------------------------
// Purpose: called if the client has lost connection to the Steam servers
// real-time services will be disabled until a matching SteamServersConnected_t has been posted
//-----------------------------------------------------------------------------
struct SteamServersDisconnected_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 3 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Sent by the Steam server to the client telling it to disconnect from the specified game server,
// which it may be in the process of or already connected to.
// The game client should immediately disconnect upon receiving this message.
// This can usually occur if the user doesn't have rights to play on the game server.
//-----------------------------------------------------------------------------
struct ClientGameServerDeny_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 13 };
uint32 m_uAppID;
uint32 m_unGameServerIP;
uint16 m_usGameServerPort;
uint16 m_bSecure;
uint32 m_uReason;
};
//-----------------------------------------------------------------------------
// Purpose: called when the callback system for this client is in an error state (and has flushed pending callbacks)
// When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect.
// This usually occurs in the rare event the Steam client has some kind of fatal error.
//-----------------------------------------------------------------------------
struct IPCFailure_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 17 };
enum EFailureType
{
k_EFailureFlushedCallbackQueue,
k_EFailurePipeFail,
};
uint8 m_eFailureType;
};
//-----------------------------------------------------------------------------
// Purpose: Signaled whenever licenses change
//-----------------------------------------------------------------------------
struct LicensesUpdated_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 25 };
};
//-----------------------------------------------------------------------------
// callback for BeginAuthSession
//-----------------------------------------------------------------------------
struct ValidateAuthTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 43 };
CSteamID m_SteamID;
EAuthSessionResponse m_eAuthSessionResponse;
CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed
};
//-----------------------------------------------------------------------------
// Purpose: called when a user has responded to a microtransaction authorization request
//-----------------------------------------------------------------------------
struct MicroTxnAuthorizationResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 52 };
uint32 m_unAppID; // AppID for this microtransaction
uint64 m_ulOrderID; // OrderID provided for the microtransaction
uint8 m_bAuthorized; // if user authorized transaction
};
//-----------------------------------------------------------------------------
// callback for GetAuthSessionTicket
//-----------------------------------------------------------------------------
struct GetAuthSessionTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 63 };
HAuthTicket m_hAuthTicket;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to a steam://gamewebcallback/ command
//-----------------------------------------------------------------------------
struct GameWebCallback_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 64 };
char m_szURL[256];
};
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to ISteamUser::RequestStoreAuthURL
//-----------------------------------------------------------------------------
struct StoreAuthURLResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 65 };
char m_szURL[512];
};
#pragma pack( pop )
#endif // ISTEAMUSER_H

View File

@ -0,0 +1,476 @@
//====== Copyright <20> 1996-2009, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to stats, achievements, and leaderboards
//
//=============================================================================
#ifndef ISTEAMUSERSTATS_H
#define ISTEAMUSERSTATS_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
#include "isteamremotestorage.h"
// size limit on stat or achievement name (UTF-8 encoded)
enum { k_cchStatNameMax = 128 };
// maximum number of bytes for a leaderboard name (UTF-8 encoded)
enum { k_cchLeaderboardNameMax = 128 };
// maximum number of details int32's storable for a single leaderboard entry
enum { k_cLeaderboardDetailsMax = 64 };
// handle to a single leaderboard
typedef uint64 SteamLeaderboard_t;
// handle to a set of downloaded entries in a leaderboard
typedef uint64 SteamLeaderboardEntries_t;
// type of data request, when downloading leaderboard entries
enum ELeaderboardDataRequest
{
k_ELeaderboardDataRequestGlobal = 0,
k_ELeaderboardDataRequestGlobalAroundUser = 1,
k_ELeaderboardDataRequestFriends = 2,
k_ELeaderboardDataRequestUsers = 3
};
// the sort order of a leaderboard
enum ELeaderboardSortMethod
{
k_ELeaderboardSortMethodNone = 0,
k_ELeaderboardSortMethodAscending = 1, // top-score is lowest number
k_ELeaderboardSortMethodDescending = 2, // top-score is highest number
};
// the display type (used by the Steam Community web site) for a leaderboard
enum ELeaderboardDisplayType
{
k_ELeaderboardDisplayTypeNone = 0,
k_ELeaderboardDisplayTypeNumeric = 1, // simple numerical score
k_ELeaderboardDisplayTypeTimeSeconds = 2, // the score represents a time, in seconds
k_ELeaderboardDisplayTypeTimeMilliSeconds = 3, // the score represents a time, in milliseconds
};
enum ELeaderboardUploadScoreMethod
{
k_ELeaderboardUploadScoreMethodNone = 0,
k_ELeaderboardUploadScoreMethodKeepBest = 1, // Leaderboard will keep user's best score
k_ELeaderboardUploadScoreMethodForceUpdate = 2, // Leaderboard will always replace score with specified
};
// a single entry in a leaderboard, as returned by GetDownloadedLeaderboardEntry()
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
struct LeaderboardEntry_t
{
CSteamID m_steamIDUser; // user with the entry - use SteamFriends()->GetFriendPersonaName() & SteamFriends()->GetFriendAvatar() to get more info
int32 m_nGlobalRank; // [1..N], where N is the number of users with an entry in the leaderboard
int32 m_nScore; // score as set in the leaderboard
int32 m_cDetails; // number of int32 details available for this entry
UGCHandle_t m_hUGC; // handle for UGC attached to the entry
};
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing stats, achievements, and leaderboard information
//-----------------------------------------------------------------------------
class ISteamUserStats
{
public:
// Ask the server to send down this user's data and achievements for this game
CALL_BACK( UserStatsReceived_t )
virtual bool RequestCurrentStats() = 0;
// Data accessors
virtual bool GetStat( const char *pchName, int32 *pData ) = 0;
virtual bool GetStat( const char *pchName, float *pData ) = 0;
// Set / update data
virtual bool SetStat( const char *pchName, int32 nData ) = 0;
virtual bool SetStat( const char *pchName, float fData ) = 0;
virtual bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength ) = 0;
// Achievement flag accessors
virtual bool GetAchievement( const char *pchName, bool *pbAchieved ) = 0;
virtual bool SetAchievement( const char *pchName ) = 0;
virtual bool ClearAchievement( const char *pchName ) = 0;
// Get the achievement status, and the time it was unlocked if unlocked.
// If the return value is true, but the unlock time is zero, that means it was unlocked before Steam
// began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970.
virtual bool GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0;
// Store the current data on the server, will get a callback when set
// And one callback for every new achievement
//
// If the callback has a result of k_EResultInvalidParam, one or more stats
// uploaded has been rejected, either because they broke constraints
// or were out of date. In this case the server sends back updated values.
// The stats should be re-iterated to keep in sync.
virtual bool StoreStats() = 0;
// Achievement / GroupAchievement metadata
// Gets the icon of the achievement, which is a handle to be used in ISteamUtils::GetImageRGBA(), or 0 if none set.
// A return value of 0 may indicate we are still fetching data, and you can wait for the UserAchievementIconFetched_t callback
// which will notify you when the bits are ready. If the callback still returns zero, then there is no image set for the
// specified achievement.
virtual int GetAchievementIcon( const char *pchName ) = 0;
// Get general attributes for an achievement. Accepts the following keys:
// - "name" and "desc" for retrieving the localized achievement name and description (returned in UTF8)
// - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden)
virtual const char *GetAchievementDisplayAttribute( const char *pchName, const char *pchKey ) = 0;
// Achievement progress - triggers an AchievementProgress callback, that is all.
// Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.
virtual bool IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress ) = 0;
// Used for iterating achievements. In general games should not need these functions because they should have a
// list of existing achievements compiled into them
virtual uint32 GetNumAchievements() = 0;
// Get achievement name iAchievement in [0,GetNumAchievements)
virtual const char *GetAchievementName( uint32 iAchievement ) = 0;
// Friends stats & achievements
// downloads stats for the user
// returns a UserStatsReceived_t received when completed
// if the other user has no stats, UserStatsReceived_t.m_eResult will be set to k_EResultFail
// these stats won't be auto-updated; you'll need to call RequestUserStats() again to refresh any data
CALL_RESULT( UserStatsReceived_t )
virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0;
// requests stat information for a user, usable after a successful call to RequestUserStats()
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0;
virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0;
virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0;
// See notes for GetAchievementAndUnlockTime above
virtual bool GetUserAchievementAndUnlockTime( CSteamID steamIDUser, const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0;
// Reset stats
virtual bool ResetAllStats( bool bAchievementsToo ) = 0;
// Leaderboard functions
// asks the Steam back-end for a leaderboard by name, and will create it if it's not yet
// This call is asynchronous, with the result returned in LeaderboardFindResult_t
CALL_RESULT(LeaderboardFindResult_t)
virtual SteamAPICall_t FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType ) = 0;
// as above, but won't create the leaderboard if it's not found
// This call is asynchronous, with the result returned in LeaderboardFindResult_t
CALL_RESULT( LeaderboardFindResult_t )
virtual SteamAPICall_t FindLeaderboard( const char *pchLeaderboardName ) = 0;
// returns the name of a leaderboard
virtual const char *GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// returns the total number of entries in a leaderboard, as of the last request
virtual int GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// returns the sort method of the leaderboard
virtual ELeaderboardSortMethod GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// returns the display type of the leaderboard
virtual ELeaderboardDisplayType GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard ) = 0;
// Asks the Steam back-end for a set of rows in the leaderboard.
// This call is asynchronous, with the result returned in LeaderboardScoresDownloaded_t
// LeaderboardScoresDownloaded_t will contain a handle to pull the results from GetDownloadedLeaderboardEntries() (below)
// You can ask for more entries than exist, and it will return as many as do exist.
// k_ELeaderboardDataRequestGlobal requests rows in the leaderboard from the full table, with nRangeStart & nRangeEnd in the range [1, TotalEntries]
// k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate
// e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after
// k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user
CALL_RESULT( LeaderboardScoresDownloaded_t )
virtual SteamAPICall_t DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd ) = 0;
// as above, but downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers
// if a user doesn't have a leaderboard entry, they won't be included in the result
// a max of 100 users can be downloaded at a time, with only one outstanding call at a time
METHOD_DESC(Downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers)
CALL_RESULT( LeaderboardScoresDownloaded_t )
virtual SteamAPICall_t DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard,
ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers ) = 0;
// Returns data about a single leaderboard entry
// use a for loop from 0 to LeaderboardScoresDownloaded_t::m_cEntryCount to get all the downloaded entries
// e.g.
// void OnLeaderboardScoresDownloaded( LeaderboardScoresDownloaded_t *pLeaderboardScoresDownloaded )
// {
// for ( int index = 0; index < pLeaderboardScoresDownloaded->m_cEntryCount; index++ )
// {
// LeaderboardEntry_t leaderboardEntry;
// int32 details[3]; // we know this is how many we've stored previously
// GetDownloadedLeaderboardEntry( pLeaderboardScoresDownloaded->m_hSteamLeaderboardEntries, index, &leaderboardEntry, details, 3 );
// assert( leaderboardEntry.m_cDetails == 3 );
// ...
// }
// once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid
virtual bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t *pLeaderboardEntry, int32 *pDetails, int cDetailsMax ) = 0;
// Uploads a user score to the Steam back-end.
// This call is asynchronous, with the result returned in LeaderboardScoreUploaded_t
// Details are extra game-defined information regarding how the user got that score
// pScoreDetails points to an array of int32's, cScoreDetailsCount is the number of int32's in the list
CALL_RESULT( LeaderboardScoreUploaded_t )
virtual SteamAPICall_t UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount ) = 0;
// Attaches a piece of user generated content the user's entry on a leaderboard.
// hContent is a handle to a piece of user generated content that was shared using ISteamUserRemoteStorage::FileShare().
// This call is asynchronous, with the result returned in LeaderboardUGCSet_t.
CALL_RESULT( LeaderboardUGCSet_t )
virtual SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC ) = 0;
// Retrieves the number of players currently playing your game (online + offline)
// This call is asynchronous, with the result returned in NumberOfCurrentPlayers_t
CALL_RESULT( NumberOfCurrentPlayers_t )
virtual SteamAPICall_t GetNumberOfCurrentPlayers() = 0;
// Requests that Steam fetch data on the percentage of players who have received each achievement
// for the game globally.
// This call is asynchronous, with the result returned in GlobalAchievementPercentagesReady_t.
CALL_RESULT( GlobalAchievementPercentagesReady_t )
virtual SteamAPICall_t RequestGlobalAchievementPercentages() = 0;
// Get the info on the most achieved achievement for the game, returns an iterator index you can use to fetch
// the next most achieved afterwards. Will return -1 if there is no data on achievement
// percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback).
virtual int GetMostAchievedAchievementInfo( char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0;
// Get the info on the next most achieved achievement for the game. Call this after GetMostAchievedAchievementInfo or another
// GetNextMostAchievedAchievementInfo call passing the iterator from the previous call. Returns -1 after the last
// achievement has been iterated.
virtual int GetNextMostAchievedAchievementInfo( int iIteratorPrevious, char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0;
// Returns the percentage of users who have achieved the specified achievement.
virtual bool GetAchievementAchievedPercent( const char *pchName, float *pflPercent ) = 0;
// Requests global stats data, which is available for stats marked as "aggregated".
// This call is asynchronous, with the results returned in GlobalStatsReceived_t.
// nHistoryDays specifies how many days of day-by-day history to retrieve in addition
// to the overall totals. The limit is 60.
CALL_RESULT( GlobalStatsReceived_t )
virtual SteamAPICall_t RequestGlobalStats( int nHistoryDays ) = 0;
// Gets the lifetime totals for an aggregated stat
virtual bool GetGlobalStat( const char *pchStatName, int64 *pData ) = 0;
virtual bool GetGlobalStat( const char *pchStatName, double *pData ) = 0;
// Gets history for an aggregated stat. pData will be filled with daily values, starting with today.
// So when called, pData[0] will be today, pData[1] will be yesterday, and pData[2] will be two days ago,
// etc. cubData is the size in bytes of the pubData buffer. Returns the number of
// elements actually set.
virtual int32 GetGlobalStatHistory( const char *pchStatName, ARRAY_COUNT(cubData) int64 *pData, uint32 cubData ) = 0;
virtual int32 GetGlobalStatHistory( const char *pchStatName, ARRAY_COUNT(cubData) double *pData, uint32 cubData ) = 0;
#ifdef _PS3
// Call to kick off installation of the PS3 trophies. This call is asynchronous, and the results will be returned in a PS3TrophiesInstalled_t
// callback.
virtual bool InstallPS3Trophies() = 0;
// Returns the amount of space required at boot to install trophies. This value can be used when comparing the amount of space needed
// by the game to the available space value passed to the game at boot. The value is set during InstallPS3Trophies().
virtual uint64 GetTrophySpaceRequiredBeforeInstall() = 0;
// On PS3, user stats & achievement progress through Steam must be stored with the user's saved game data.
// At startup, before calling RequestCurrentStats(), you must pass the user's stats data to Steam via this method.
// If you do not have any user data, call this function with pvData = NULL and cubData = 0
virtual bool SetUserStatsData( const void *pvData, uint32 cubData ) = 0;
// Call to get the user's current stats data. You should retrieve this data after receiving successful UserStatsReceived_t & UserStatsStored_t
// callbacks, and store the data with the user's save game data. You can call this method with pvData = NULL and cubData = 0 to get the required
// buffer size.
virtual bool GetUserStatsData( void *pvData, uint32 cubData, uint32 *pcubWritten ) = 0;
#endif
};
#define STEAMUSERSTATS_INTERFACE_VERSION "STEAMUSERSTATS_INTERFACE_VERSION011"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: called when the latests stats and achievements have been received
// from the server
//-----------------------------------------------------------------------------
struct UserStatsReceived_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 1 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // Success / error fetching the stats
CSteamID m_steamIDUser; // The user for whom the stats are retrieved for
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the user stats for a game
//-----------------------------------------------------------------------------
struct UserStatsStored_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 2 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // success / error
};
//-----------------------------------------------------------------------------
// Purpose: result of a request to store the achievements for a game, or an
// "indicate progress" call. If both m_nCurProgress and m_nMaxProgress
// are zero, that means the achievement has been fully unlocked.
//-----------------------------------------------------------------------------
struct UserAchievementStored_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 3 };
uint64 m_nGameID; // Game this is for
bool m_bGroupAchievement; // if this is a "group" achievement
char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement
uint32 m_nCurProgress; // current progress towards the achievement
uint32 m_nMaxProgress; // "out of" this many
};
//-----------------------------------------------------------------------------
// Purpose: call result for finding a leaderboard, returned as a result of FindOrCreateLeaderboard() or FindLeaderboard()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardFindResult_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 4 };
SteamLeaderboard_t m_hSteamLeaderboard; // handle to the leaderboard serarched for, 0 if no leaderboard found
uint8 m_bLeaderboardFound; // 0 if no leaderboard found
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating scores for a leaderboard have been downloaded and are ready to be retrieved, returned as a result of DownloadLeaderboardEntries()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardScoresDownloaded_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 5 };
SteamLeaderboard_t m_hSteamLeaderboard;
SteamLeaderboardEntries_t m_hSteamLeaderboardEntries; // the handle to pass into GetDownloadedLeaderboardEntries()
int m_cEntryCount; // the number of entries downloaded
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating scores has been uploaded, returned as a result of UploadLeaderboardScore()
// use CCallResult<> to map this async result to a member function
//-----------------------------------------------------------------------------
struct LeaderboardScoreUploaded_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 6 };
uint8 m_bSuccess; // 1 if the call was successful
SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was
int32 m_nScore; // the score that was attempted to set
uint8 m_bScoreChanged; // true if the score in the leaderboard change, false if the existing score was better
int m_nGlobalRankNew; // the new global rank of the user in this leaderboard
int m_nGlobalRankPrevious; // the previous global rank of the user in this leaderboard; 0 if the user had no existing entry in the leaderboard
};
struct NumberOfCurrentPlayers_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 7 };
uint8 m_bSuccess; // 1 if the call was successful
int32 m_cPlayers; // Number of players currently playing
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that a user's stats have been unloaded.
// Call RequestUserStats again to access stats for this user
//-----------------------------------------------------------------------------
struct UserStatsUnloaded_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 };
CSteamID m_steamIDUser; // User whose stats have been unloaded
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that an achievement icon has been fetched
//-----------------------------------------------------------------------------
struct UserAchievementIconFetched_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 9 };
CGameID m_nGameID; // Game this is for
char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement
bool m_bAchieved; // Is the icon for the achieved or not achieved version?
int m_nIconHandle; // Handle to the image, which can be used in SteamUtils()->GetImageRGBA(), 0 means no image is set for the achievement
};
//-----------------------------------------------------------------------------
// Purpose: Callback indicating that global achievement percentages are fetched
//-----------------------------------------------------------------------------
struct GlobalAchievementPercentagesReady_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 10 };
uint64 m_nGameID; // Game this is for
EResult m_eResult; // Result of the operation
};
//-----------------------------------------------------------------------------
// Purpose: call result indicating UGC has been uploaded, returned as a result of SetLeaderboardUGC()
//-----------------------------------------------------------------------------
struct LeaderboardUGCSet_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 11 };
EResult m_eResult; // The result of the operation
SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating that PS3 trophies have been installed
//-----------------------------------------------------------------------------
struct PS3TrophiesInstalled_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // The result of the operation
uint64 m_ulRequiredDiskSpace; // If m_eResult is k_EResultDiskFull, will contain the amount of space needed to install trophies
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating global stats have been received.
// Returned as a result of RequestGlobalStats()
//-----------------------------------------------------------------------------
struct GlobalStatsReceived_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 };
uint64 m_nGameID; // Game global stats were requested for
EResult m_eResult; // The result of the request
};
#pragma pack( pop )
#endif // ISTEAMUSER_H

254
SpyCustom/sdk/isteamutils.h Normal file
View File

@ -0,0 +1,254 @@
//====== Copyright <20> 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to utility functions in Steam
//
//=============================================================================
#ifndef ISTEAMUTILS_H
#define ISTEAMUTILS_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
// Steam API call failure results
enum ESteamAPICallFailure
{
k_ESteamAPICallFailureNone = -1, // no failure
k_ESteamAPICallFailureSteamGone = 0, // the local Steam process has gone away
k_ESteamAPICallFailureNetworkFailure = 1, // the network connection to Steam has been broken, or was already broken
// SteamServersDisconnected_t callback will be sent around the same time
// SteamServersConnected_t will be sent when the client is able to talk to the Steam servers again
k_ESteamAPICallFailureInvalidHandle = 2, // the SteamAPICall_t handle passed in no longer exists
k_ESteamAPICallFailureMismatchedCallback = 3,// GetAPICallResult() was called with the wrong callback type for this API call
};
// Input modes for the Big Picture gamepad text entry
enum EGamepadTextInputMode
{
k_EGamepadTextInputModeNormal = 0,
k_EGamepadTextInputModePassword = 1
};
// Controls number of allowed lines for the Big Picture gamepad text entry
enum EGamepadTextInputLineMode
{
k_EGamepadTextInputLineModeSingleLine = 0,
k_EGamepadTextInputLineModeMultipleLines = 1
};
// function prototype for warning message hook
#if defined( POSIX )
#define __cdecl
#endif
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
//-----------------------------------------------------------------------------
// Purpose: interface to user independent utility functions
//-----------------------------------------------------------------------------
class ISteamUtils
{
public:
// return the number of seconds since the user
virtual uint32 GetSecondsSinceAppActive() = 0;
virtual uint32 GetSecondsSinceComputerActive() = 0;
// the universe this client is connecting to
virtual EUniverse GetConnectedUniverse() = 0;
// Steam server time - in PST, number of seconds since January 1, 1970 (i.e unix time)
virtual uint32 GetServerRealTime() = 0;
// returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database)
// e.g "US" or "UK".
virtual const char *GetIPCountry() = 0;
// returns true if the image exists, and valid sizes were filled out
virtual bool GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight ) = 0;
// returns true if the image exists, and the buffer was successfully filled out
// results are returned in RGBA format
// the destination buffer size should be 4 * height * width * sizeof(char)
virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0;
// returns the IP of the reporting server for valve - currently only used in Source engine games
virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0;
// return the amount of battery power left in the current system in % [0..100], 255 for being on AC power
virtual uint8 GetCurrentBatteryPower() = 0;
// returns the appID of the current process
virtual uint32 GetAppID() = 0;
// Sets the position where the overlay instance for the currently calling game should show notifications.
// This position is per-game and if this function is called from outside of a game context it will do nothing.
virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0;
// API asynchronous call results
// can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)
virtual bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed ) = 0;
virtual ESteamAPICallFailure GetAPICallFailureReason( SteamAPICall_t hSteamAPICall ) = 0;
virtual bool GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) = 0;
// Deprecated. Applications should use SteamAPI_RunCallbacks() instead. Game servers do not need to call this function.
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
// Every IPC call is at minimum a thread context switch if not a process one so you want to rate
// control how often you do them.
virtual uint32 GetIPCCallCount() = 0;
// API warning handling
// 'int' is the severity; 0 for msg, 1 for warning
// 'const char *' is the text of the message
// callbacks will occur directly after the API function is called that generated the warning or message
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
// Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to
// start & hook the game process, so this function will initially return false while the overlay is loading.
virtual bool IsOverlayEnabled() = 0;
// Normally this call is unneeded if your game has a constantly running frame loop that calls the
// D3D Present API, or OGL SwapBuffers API every frame.
//
// However, if you have a game that only refreshes the screen on an event driven basis then that can break
// the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also
// need to Present() to the screen any time an even needing a notification happens or when the overlay is
// brought up over the game by a user. You can use this API to ask the overlay if it currently need a present
// in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you
// refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.
virtual bool BOverlayNeedsPresent() = 0;
// Asynchronous call to check if an executable file has been signed using the public key set on the signing tab
// of the partner site, for example to refuse to load modified executable files.
// The result is returned in CheckFileSignature_t.
// k_ECheckFileSignatureNoSignaturesFoundForThisApp - This app has not been configured on the signing tab of the partner site to enable this function.
// k_ECheckFileSignatureNoSignaturesFoundForThisFile - This file is not listed on the signing tab for the partner site.
// k_ECheckFileSignatureFileNotFound - The file does not exist on disk.
// k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match.
// k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid.
CALL_RESULT( CheckFileSignature_t )
virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0;
// Activates the Big Picture text input dialog which only supports gamepad input
virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0;
// Returns previously entered text & length
virtual uint32 GetEnteredGamepadTextLength() = 0;
virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0;
// returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases
virtual const char *GetSteamUILanguage() = 0;
// returns true if Steam itself is running in VR mode
virtual bool IsSteamRunningInVR() = 0;
// Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.
virtual void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset ) = 0;
// returns true if Steam & the Steam Overlay are running in Big Picture mode
// Games much be launched through the Steam client to enable the Big Picture overlay. During development,
// a game can be added as a non-steam game to the developers library to test this feature
virtual bool IsSteamInBigPictureMode() = 0;
// ask SteamUI to create and render its OpenVR dashboard
virtual void StartVRDashboard() = 0;
};
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils008"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: The country of the user changed
//-----------------------------------------------------------------------------
struct IPCountry_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 1 };
};
//-----------------------------------------------------------------------------
// Purpose: Fired when running on a laptop and less than 10 minutes of battery is left, fires then every minute
//-----------------------------------------------------------------------------
struct LowBatteryPower_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 2 };
uint8 m_nMinutesBatteryLeft;
};
//-----------------------------------------------------------------------------
// Purpose: called when a SteamAsyncCall_t has completed (or failed)
//-----------------------------------------------------------------------------
struct SteamAPICallCompleted_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 3 };
SteamAPICall_t m_hAsyncCall;
int m_iCallback;
uint32 m_cubParam;
};
//-----------------------------------------------------------------------------
// called when Steam wants to shutdown
//-----------------------------------------------------------------------------
struct SteamShutdown_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 4 };
};
//-----------------------------------------------------------------------------
// results for CheckFileSignature
//-----------------------------------------------------------------------------
enum ECheckFileSignature
{
k_ECheckFileSignatureInvalidSignature = 0,
k_ECheckFileSignatureValidSignature = 1,
k_ECheckFileSignatureFileNotFound = 2,
k_ECheckFileSignatureNoSignaturesFoundForThisApp = 3,
k_ECheckFileSignatureNoSignaturesFoundForThisFile = 4,
};
//-----------------------------------------------------------------------------
// callback for CheckFileSignature
//-----------------------------------------------------------------------------
struct CheckFileSignature_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 5 };
ECheckFileSignature m_eCheckFileSignature;
};
// k_iSteamUtilsCallbacks + 13 is taken
//-----------------------------------------------------------------------------
// Big Picture gamepad text input has been closed
//-----------------------------------------------------------------------------
struct GamepadTextInputDismissed_t
{
enum { k_iCallback = k_iSteamUtilsCallbacks + 14 };
bool m_bSubmitted; // true if user entered & accepted text (Call ISteamUtils::GetEnteredGamepadTextInput() for text), false if canceled input
uint32 m_unSubmittedText;
};
// k_iSteamUtilsCallbacks + 15 is taken
#pragma pack( pop )
#endif // ISTEAMUTILS_H

View File

@ -0,0 +1,60 @@
//====== Copyright © 1996-2014 Valve Corporation, All rights reserved. =======
//
// Purpose: interface to Steam Video
//
//=============================================================================
#ifndef ISTEAMVIDEO_H
#define ISTEAMVIDEO_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: Steam Video API
//-----------------------------------------------------------------------------
class ISteamVideo
{
public:
// Get a URL suitable for streaming the given Video app ID's video
virtual void GetVideoURL( AppId_t unVideoAppID ) = 0;
// returns true if user is uploading a live broadcast
virtual bool IsBroadcasting( int *pnNumViewers ) = 0;
};
#define STEAMVIDEO_INTERFACE_VERSION "STEAMVIDEO_INTERFACE_V001"
DEFINE_CALLBACK( BroadcastUploadStart_t, k_iClientVideoCallbacks + 4 )
END_DEFINE_CALLBACK_0()
DEFINE_CALLBACK( BroadcastUploadStop_t, k_iClientVideoCallbacks + 5 )
CALLBACK_MEMBER( 0, EBroadcastUploadResult, m_eResult )
END_DEFINE_CALLBACK_1()
DEFINE_CALLBACK( GetVideoURLResult_t, k_iClientVideoCallbacks + 11 )
CALLBACK_MEMBER( 0, EResult, m_eResult )
CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
CALLBACK_MEMBER( 2, char, m_rgchURL[256] )
END_DEFINE_CALLBACK_1()
#pragma pack( pop )
#endif // ISTEAMVIDEO_H

73
SpyCustom/sdk/iviewport.h Normal file
View File

@ -0,0 +1,73 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#if !defined( IVIEWPORT_H )
#define IVIEWPORT_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui.h"
#include "viewport_panel_names.h"
class KeyValues;
abstract_class IViewPortPanel
{
public:
virtual ~IViewPortPanel() {};
virtual const char *GetName( void ) = 0;// return identifer name
virtual void SetData(KeyValues *data) = 0; // set ViewPortPanel data
virtual void Reset( void ) = 0; // clears internal state, deactivates it
virtual void Update( void ) = 0; // updates all (size, position, content, etc)
virtual bool NeedsUpdate( void ) = 0; // query panel if content needs to be updated
virtual bool HasInputElements( void ) = 0; // true if panel contains elments which accepts input
virtual void ReloadScheme( void ) {}
virtual bool CanReplace( const char *panelName ) const { return true; } // returns true if this panel can appear on top of the given panel
virtual bool CanBeReopened( void ) const { return true; } // returns true if this panel can be re-opened after being hidden by another panel
virtual void ShowPanel( bool state ) = 0; // activate VGUI Frame
// VGUI functions:
virtual vgui::VPANEL GetVPanel( void ) = 0; // returns VGUI panel handle
virtual bool IsVisible() = 0; // true if panel is visible
virtual void SetParent( vgui::VPANEL parent ) = 0;
virtual bool WantsBackgroundBlurred( void ) = 0;
virtual void UpdateVisibility( void ) {}
virtual void ViewportThink( void ) {}
virtual void LevelInit( void ) {}
};
abstract_class IViewPort
{
public:
virtual void UpdateAllPanels( void ) = 0;
virtual void ShowPanel( const char *pName, bool state, KeyValues *data, bool autoDeleteData = true ) = 0;
virtual void ShowPanel( const char *pName, bool state ) = 0;
virtual void ShowPanel( IViewPortPanel* pPanel, bool state ) = 0;
virtual void ShowBackGround(bool bShow) = 0;
virtual IViewPortPanel* FindPanelByName(const char *szPanelName) = 0;
virtual IViewPortPanel* GetActivePanel( void ) = 0;
virtual void LevelInit( void ) = 0;
virtual void RecreatePanel( const char *szPanelName ) = 0;
virtual void PostMessageToPanel( const char *pName, KeyValues *pKeyValues ) = 0;
};
extern IViewPort *GetViewPortInterface();
extern IViewPort *GetFullscreenViewPortInterface();
#endif // IVIEWPORT_H

View File

@ -0,0 +1,251 @@
//========= Copyright <20> 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef MATCHMAKINGTYPES_H
#define MATCHMAKINGTYPES_H
#ifdef _WIN32
#pragma once
#endif
#ifdef POSIX
#ifndef _snprintf
#define _snprintf snprintf
#endif
#endif
#include <stdio.h>
#include <string.h>
//
// Max size (in bytes of UTF-8 data, not in characters) of server fields, including null terminator.
// WARNING: These cannot be changed easily, without breaking clients using old interfaces.
//
const int k_cbMaxGameServerGameDir = 32;
const int k_cbMaxGameServerMapName = 32;
const int k_cbMaxGameServerGameDescription = 64;
const int k_cbMaxGameServerName = 64;
const int k_cbMaxGameServerTags = 128;
const int k_cbMaxGameServerGameData = 2048;
/// Store key/value pair used in matchmaking queries.
///
/// Actually, the name Key/Value is a bit misleading. The "key" is better
/// understood as "filter operation code" and the "value" is the operand to this
/// filter operation. The meaning of the operand depends upon the filter.
struct MatchMakingKeyValuePair_t
{
MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; }
MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue )
{
strncpy( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only!
m_szKey[ sizeof( m_szKey ) - 1 ] = '\0';
strncpy( m_szValue, pchValue, sizeof(m_szValue) );
m_szValue[ sizeof( m_szValue ) - 1 ] = '\0';
}
char m_szKey[ 256 ];
char m_szValue[ 256 ];
};
enum EMatchMakingServerResponse
{
eServerResponded = 0,
eServerFailedToRespond,
eNoServersListedOnMasterServer // for the Internet query type, returned in response callback if no servers of this type match
};
// servernetadr_t is all the addressing info the serverbrowser needs to know about a game server,
// namely: its IP, its connection port, and its query port.
class servernetadr_t
{
public:
servernetadr_t() : m_usConnectionPort( 0 ), m_usQueryPort( 0 ), m_unIP( 0 ) {}
void Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort );
#ifdef NETADR_H
netadr_t GetIPAndQueryPort();
#endif
// Access the query port.
uint16 GetQueryPort() const;
void SetQueryPort( uint16 usPort );
// Access the connection port.
uint16 GetConnectionPort() const;
void SetConnectionPort( uint16 usPort );
// Access the IP
uint32 GetIP() const;
void SetIP( uint32 );
// This gets the 'a.b.c.d:port' string with the connection port (instead of the query port).
const char *GetConnectionAddressString() const;
const char *GetQueryAddressString() const;
// Comparison operators and functions.
bool operator<(const servernetadr_t &netadr) const;
void operator=( const servernetadr_t &that )
{
m_usConnectionPort = that.m_usConnectionPort;
m_usQueryPort = that.m_usQueryPort;
m_unIP = that.m_unIP;
}
private:
const char *ToString( uint32 unIP, uint16 usPort ) const;
uint16 m_usConnectionPort; // (in HOST byte order)
uint16 m_usQueryPort;
uint32 m_unIP;
};
inline void servernetadr_t::Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort )
{
m_unIP = ip;
m_usQueryPort = usQueryPort;
m_usConnectionPort = usConnectionPort;
}
#ifdef NETADR_H
inline netadr_t servernetadr_t::GetIPAndQueryPort()
{
return netadr_t( m_unIP, m_usQueryPort );
}
#endif
inline uint16 servernetadr_t::GetQueryPort() const
{
return m_usQueryPort;
}
inline void servernetadr_t::SetQueryPort( uint16 usPort )
{
m_usQueryPort = usPort;
}
inline uint16 servernetadr_t::GetConnectionPort() const
{
return m_usConnectionPort;
}
inline void servernetadr_t::SetConnectionPort( uint16 usPort )
{
m_usConnectionPort = usPort;
}
inline uint32 servernetadr_t::GetIP() const
{
return m_unIP;
}
inline void servernetadr_t::SetIP( uint32 unIP )
{
m_unIP = unIP;
}
inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const
{
static char s[4][64];
static int nBuf = 0;
unsigned char *ipByte = (unsigned char *)&unIP;
#ifdef VALVE_BIG_ENDIAN
_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort );
#else
_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort );
#endif
const char *pchRet = s[nBuf];
++nBuf;
nBuf %= ( (sizeof(s)/sizeof(s[0])) );
return pchRet;
}
inline const char* servernetadr_t::GetConnectionAddressString() const
{
return ToString( m_unIP, m_usConnectionPort );
}
inline const char* servernetadr_t::GetQueryAddressString() const
{
return ToString( m_unIP, m_usQueryPort );
}
inline bool servernetadr_t::operator<(const servernetadr_t &netadr) const
{
return ( m_unIP < netadr.m_unIP ) || ( m_unIP == netadr.m_unIP && m_usQueryPort < netadr.m_usQueryPort );
}
//-----------------------------------------------------------------------------
// Purpose: Data describing a single server
//-----------------------------------------------------------------------------
class gameserveritem_t
{
public:
gameserveritem_t();
const char* GetName() const;
void SetName( const char *pName );
public:
servernetadr_t m_NetAdr; ///< IP/Query Port/Connection Port for this server
int m_nPing; ///< current ping time in milliseconds
bool m_bHadSuccessfulResponse; ///< server has responded successfully in the past
bool m_bDoNotRefresh; ///< server is marked as not responding and should no longer be refreshed
char m_szGameDir[k_cbMaxGameServerGameDir]; ///< current game directory
char m_szMap[k_cbMaxGameServerMapName]; ///< current map
char m_szGameDescription[k_cbMaxGameServerGameDescription]; ///< game description
uint32 m_nAppID; ///< Steam App ID of this server
int m_nPlayers; ///< total number of players currently on the server. INCLUDES BOTS!!
int m_nMaxPlayers; ///< Maximum players that can join this server
int m_nBotPlayers; ///< Number of bots (i.e simulated players) on this server
bool m_bPassword; ///< true if this server needs a password to join
bool m_bSecure; ///< Is this server protected by VAC
uint32 m_ulTimeLastPlayed; ///< time (in unix time) when this server was last played on (for favorite/history servers)
int m_nServerVersion; ///< server version as reported to Steam
private:
/// Game server name
char m_szServerName[k_cbMaxGameServerName];
// For data added after SteamMatchMaking001 add it here
public:
/// the tags this server exposes
char m_szGameTags[k_cbMaxGameServerTags];
/// steamID of the game server - invalid if it's doesn't have one (old server, or not connected to Steam)
CSteamID m_steamID;
};
inline gameserveritem_t::gameserveritem_t()
{
m_szGameDir[0] = m_szMap[0] = m_szGameDescription[0] = m_szServerName[0] = 0;
m_bHadSuccessfulResponse = m_bDoNotRefresh = m_bPassword = m_bSecure = false;
m_nPing = m_nAppID = m_nPlayers = m_nMaxPlayers = m_nBotPlayers = m_ulTimeLastPlayed = m_nServerVersion = 0;
m_szGameTags[0] = 0;
}
inline const char* gameserveritem_t::GetName() const
{
// Use the IP address as the name if nothing is set yet.
if ( m_szServerName[0] == 0 )
return m_NetAdr.GetConnectionAddressString();
else
return m_szServerName;
}
inline void gameserveritem_t::SetName( const char *pName )
{
strncpy( m_szServerName, pName, sizeof( m_szServerName ) );
m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0';
}
#endif // MATCHMAKINGTYPES_H

556
SpyCustom/sdk/netmessages.h Normal file
View File

@ -0,0 +1,556 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef NETMESSAGES_H
#define NETMESSAGES_H
#ifdef _WIN32
#pragma once
#pragma warning(disable : 4100) // unreferenced formal parameter
#endif
#include "inetmessage.h"
#include "checksum_crc.h"
#include "checksum_md5.h"
#include "const.h"
#include "utlvector.h"
#include "qlimits.h"
#include "vector.h"
#include "soundflags.h"
#include "bitbuf.h"
#include "inetchannel.h"
#include "protocol.h"
#include "inetmsghandler.h"
#include "igameevents.h"
#include "bitvec.h"
#include "inetworksystem.h"
//#include "iserverplugin.h"
//#include "color.h"
#include "tslist.h"
#include "utldelegate.h"
#include "utlstring.h"
#include "tokenset.h"
#include "netmessages_signon.h"
// eliminates a conflict with TYPE_BOOL in OSX
#ifdef TYPE_BOOL
#undef TYPE_BOOL
#endif
//#include "netmessages.pb.h"
//https://github.com/pmrowla/hl2sdk-csgo/blob/master/public/engine/protobuf/netmessages.pb.h
#include <google/protobuf/stubs/common.h>
template< int msgType, typename PB_OBJECT_TYPE, int groupType = INetChannelInfo::GENERIC, bool bReliable = true >
class CNetMessagePB : public INetMessage, public PB_OBJECT_TYPE
{
public:
typedef CNetMessagePB< msgType, PB_OBJECT_TYPE, groupType, bReliable > MyType_t;
typedef PB_OBJECT_TYPE PBType_t;
static const int sk_Type = msgType;
CNetMessagePB() :
m_bReliable( bReliable )
{
}
virtual ~CNetMessagePB()
{
}
virtual bool ReadFromBuffer( bf_read &buffer )
{
int size = buffer.ReadVarInt32();
if ( size < 0 || size > NET_MAX_PAYLOAD )
{
return false;
}
// Check its valid
if ( size > buffer.GetNumBytesLeft() )
{
return false;
}
// If the read buffer is byte aligned, we can parse right out of it
if ( ( buffer.GetNumBitsRead() % 8 ) == 0 )
{
bool parseResult = PB_OBJECT_TYPE::ParseFromArray( buffer.GetBasePointer() + buffer.GetNumBytesRead(), size );
buffer.SeekRelative( size * 8 );
return parseResult;
}
// otherwise we have to do a temp allocation so we can read it all shifted
#ifdef NET_SHOW_UNALIGNED_MSGS
DevMsg("Warning: unaligned read of protobuf message %s (%d bytes)\n", PB_OBJECT_TYPE::GetTypeName().c_str(), size );
#endif
void *parseBuffer = stackalloc( size );
if ( !buffer.ReadBytes( parseBuffer, size ) )
{
return false;
}
if ( ! PB_OBJECT_TYPE::ParseFromArray( parseBuffer, size ) )
{
return false;
}
return true;
}
virtual bool WriteToBuffer( bf_write &buffer ) const
{
if ( !PB_OBJECT_TYPE::IsInitialized() )
{
Msg("WriteToBuffer Message %s is not initialized! Probably missing required fields!\n", PB_OBJECT_TYPE::GetTypeName().c_str() );
}
int size = PB_OBJECT_TYPE::ByteSize();
// If the write is byte aligned we can go direct
if ( ( buffer.GetNumBitsWritten() % 8 ) == 0 )
{
int sizeWithHeader = size + 1 + buffer.ByteSizeVarInt32( GetType() ) + buffer.ByteSizeVarInt32( size );
if ( buffer.GetNumBytesLeft() >= sizeWithHeader )
{
buffer.WriteVarInt32( GetType() );
buffer.WriteVarInt32( size );
if ( !PB_OBJECT_TYPE::SerializeWithCachedSizesToArray( ( google::protobuf::uint8 * )buffer.GetData() + buffer.GetNumBytesWritten() ) )
{
return false;
}
// Tell the buffer we just splatted into it
buffer.SeekToBit( buffer.GetNumBitsWritten() + ( size * 8 ) );
return true;
}
// Won't fit
return false;
}
// otherwise we have to do a temp allocation so we can write it all shifted
#ifdef NET_SHOW_UNALIGNED_MSGS
DevMsg("Warning: unaligned write of protobuf message %s (%d bytes)\n", PB_OBJECT_TYPE::GetTypeName().c_str(), size );
#endif
void *serializeBuffer = stackalloc( size );
if ( ! PB_OBJECT_TYPE::SerializeWithCachedSizesToArray( ( google::protobuf::uint8 * )serializeBuffer ) )
{
return false;
}
buffer.WriteVarInt32( GetType() );
buffer.WriteVarInt32( size );
return buffer.WriteBytes( serializeBuffer, size );
}
virtual const char *ToString() const
{
m_toString = PB_OBJECT_TYPE::DebugString();
return m_toString.c_str();
}
virtual int GetType() const
{
return msgType;
}
virtual size_t GetSize() const
{
return sizeof( *this );
}
virtual const char *GetName() const
{
if ( s_typeName.empty() )
{
s_typeName = PB_OBJECT_TYPE::GetTypeName();
}
return s_typeName.c_str();
}
virtual int GetGroup() const
{
return groupType;
}
virtual void SetReliable( bool state )
{
m_bReliable = state;
}
virtual bool IsReliable() const
{
return m_bReliable;
}
virtual INetMessage *Clone() const
{
MyType_t *pClone = new MyType_t;
pClone->CopyFrom( *this );
pClone->m_bReliable = m_bReliable;
return pClone;
}
protected:
bool m_bReliable; // true if message should be sent reliable
mutable std::string m_toString; // cached copy of ToString()
static std::string s_typeName;
};
template< int msgType, typename PB_OBJECT_TYPE, int groupType , bool bReliable >
std::string CNetMessagePB< msgType, PB_OBJECT_TYPE, groupType , bReliable >::s_typeName;
class CNetMessageBinder
{
public:
CNetMessageBinder()
: m_pBind( NULL )
{
}
~CNetMessageBinder()
{
delete m_pBind;
}
template< class _N >
void Bind( INetChannel *pNetChannel, CUtlDelegate< bool ( const typename _N::PBType_t & obj ) > handler )
{
delete m_pBind;
m_pBind = new BindParams<_N>( pNetChannel, handler );
}
void Unbind()
{
delete m_pBind;
m_pBind = NULL;
}
bool IsBound() const
{
return m_pBind != NULL;
}
private:
template < class _N >
struct BindParams : public INetMessageBinder
{
BindParams( INetChannel *pNetChannel, CUtlDelegate< bool ( const typename _N::PBType_t & obj ) > handler )
: m_NetChannel( pNetChannel )
, m_handler( handler )
{
if ( m_NetChannel )
{
m_NetChannel->RegisterMessage( this );
}
}
virtual ~BindParams()
{
if ( m_NetChannel )
{
m_NetChannel->UnregisterMessage( this );
}
}
virtual int GetType( void ) const
{
return _N::sk_Type;
}
virtual void SetNetChannel(INetChannel * netchan)
{
if( m_NetChannel != netchan )
{
if( m_NetChannel )
m_NetChannel->UnregisterMessage( this );
m_NetChannel = netchan;
if( m_NetChannel )
m_NetChannel->RegisterMessage( this );
}
}
virtual INetMessage *CreateFromBuffer( bf_read &buffer )
{
INetMessage *pMsg = new typename _N::MyType_t;
if ( !pMsg->ReadFromBuffer( buffer ) )
{
delete pMsg;
return NULL;
}
return pMsg;
}
virtual bool Process( const INetMessage &src )
{
const typename _N::MyType_t &typedSrc = static_cast< const typename _N::MyType_t & >( src );
Assert( m_handler );
if( m_handler )
{
return m_handler( static_cast< typename _N::PBType_t const & >( typedSrc ) );
}
return false;
}
INetChannel *m_NetChannel; // netchannel this message is from/for
CUtlDelegate< bool ( const typename _N::PBType_t & obj ) > m_handler;
};
INetMessageBinder *m_pBind;
};
///////////////////////////////////////////////////////////////////////////////////////
// bidirectional net messages:
///////////////////////////////////////////////////////////////////////////////////////
class CNETMsg_Tick_t : public CNetMessagePB< net_Tick, CNETMsg_Tick >
{
public:
static float FrametimeToFloat( uint32 frametime ) { return ( float )frametime / 1000000.0f; }
CNETMsg_Tick_t( int tick, float host_computationtime, float host_computationtime_stddeviation, float host_framestarttime_std_deviation )
{
SetReliable( false );
set_tick( tick );
set_host_computationtime( MIN( ( uint32 )( 1000000.0 * host_computationtime ), 1000000u ) );
set_host_computationtime_std_deviation( MIN( ( uint32 )( 1000000.0 * host_computationtime_stddeviation ), 1000000u ) );
set_host_framestarttime_std_deviation( MIN( ( uint32 )( 1000000.0 * host_framestarttime_std_deviation ), 1000000u ) );
}
};
class CNETMsg_StringCmd_t : public CNetMessagePB< net_StringCmd, CNETMsg_StringCmd, INetChannelInfo::STRINGCMD >
{
public:
CNETMsg_StringCmd_t( const char *command )
{
set_command( command );
}
};
class CNETMsg_PlayerAvatarData_t : public CNetMessagePB< net_PlayerAvatarData, CNETMsg_PlayerAvatarData, INetChannelInfo::PAINTMAP >
{
// 12 KB player avatar 64x64 rgb only no alpha
// WARNING-WARNING-WARNING
// This message is extremely large for our net channels
// and must be pumped through special fragmented waiting list
// via chunk-based ack mechanism!
// See: INetChannel::EnqueueVeryLargeAsyncTransfer
// WARNING-WARNING-WARNING
public:
CNETMsg_PlayerAvatarData_t() {}
CNETMsg_PlayerAvatarData_t( uint32 unAccountID, void const *pvData, uint32 cbData )
{
set_accountid( unAccountID );
set_rgb( ( const char * ) pvData, cbData );
}
};
class CNETMsg_SignonState_t : public CNetMessagePB< net_SignonState, CNETMsg_SignonState, INetChannelInfo::SIGNON >
{
public:
CNETMsg_SignonState_t( int state, int spawncount )
{
set_signon_state( state );
set_spawn_count( spawncount );
set_num_server_players( 0 );
}
};
inline void NetMsgSetCVarUsingDictionary( CMsg_CVars::CVar *convar, char const * name, char const * value )
{
convar->set_value( value );
if ( 0 ) ( void ) 0;
/** Removed for partner depot **/
else
{
#ifdef _DEBUG
DevWarning( "Missing dictionary entry for cvar '%s'\n", name );
#endif
convar->set_name( name );
}
}
inline void NetMsgExpandCVarUsingDictionary( CMsg_CVars::CVar *convar )
{
if ( convar->has_name() )
return;
switch ( convar->dictionary_name() )
{
case 0: return;
/** Removed for partner depot **/
default:
DevWarning( "Invalid dictionary entry for cvar # %d\n", convar->dictionary_name() );
convar->set_name( "undefined" );
break;
}
}
inline const char * NetMsgGetCVarUsingDictionary( CMsg_CVars::CVar const &convar )
{
if ( convar.has_name() )
return convar.name().c_str();
switch ( convar.dictionary_name() )
{
case 0: return "";
/** Removed for partner depot **/
default:
DevWarning( "Invalid dictionary entry for cvar # %d\n", convar.dictionary_name() );
return "undefined";
}
}
class CNETMsg_SetConVar_t : public CNetMessagePB< net_SetConVar, CNETMsg_SetConVar, INetChannelInfo::STRINGCMD >
{
public:
CNETMsg_SetConVar_t() {}
CNETMsg_SetConVar_t( const char * name, const char * value )
{
AddToTail( name, value );
}
void AddToTail( const char * name, const char * value )
{
NetMsgSetCVarUsingDictionary( mutable_convars()->add_cvars(), name, value );
}
};
typedef CNetMessagePB< net_NOP, CNETMsg_NOP > CNETMsg_NOP_t;
typedef CNetMessagePB< net_Disconnect, CNETMsg_Disconnect > CNETMsg_Disconnect_t;
typedef CNetMessagePB< net_File, CNETMsg_File > CNETMsg_File_t;
typedef CNetMessagePB< net_SplitScreenUser, CNETMsg_SplitScreenUser > CNETMsg_SplitScreenUser_t;
///////////////////////////////////////////////////////////////////////////////////////
// Client messages: Sent from the client to the server
///////////////////////////////////////////////////////////////////////////////////////
typedef CNetMessagePB< clc_SplitPlayerConnect, CCLCMsg_SplitPlayerConnect > CCLCMsg_SplitPlayerConnect_t;
typedef CNetMessagePB< clc_Move, CCLCMsg_Move, INetChannelInfo::MOVE, false > CCLCMsg_Move_t;
typedef CNetMessagePB< clc_ClientInfo, CCLCMsg_ClientInfo > CCLCMsg_ClientInfo_t;
typedef CNetMessagePB< clc_VoiceData, CCLCMsg_VoiceData, INetChannelInfo::VOICE, false > CCLCMsg_VoiceData_t;
typedef CNetMessagePB< clc_BaselineAck, CCLCMsg_BaselineAck > CCLCMsg_BaselineAck_t;
typedef CNetMessagePB< clc_ListenEvents, CCLCMsg_ListenEvents > CCLCMsg_ListenEvents_t;
typedef CNetMessagePB< clc_RespondCvarValue, CCLCMsg_RespondCvarValue > CCLCMsg_RespondCvarValue_t;
typedef CNetMessagePB< clc_LoadingProgress, CCLCMsg_LoadingProgress > CCLCMsg_LoadingProgress_t;
typedef CNetMessagePB< clc_CmdKeyValues, CCLCMsg_CmdKeyValues > CCLCMsg_CmdKeyValues_t;
typedef CNetMessagePB< clc_HltvReplay, CCLCMsg_HltvReplay > CCLCMsg_HltvReplay_t;
class CCLCMsg_FileCRCCheck_t : public CNetMessagePB< clc_FileCRCCheck, CCLCMsg_FileCRCCheck >
{
public:
// Warning: These routines may use the va() function...
static void SetPath( CCLCMsg_FileCRCCheck& msg, const char *path );
static const char *GetPath( const CCLCMsg_FileCRCCheck& msg );
static void SetFileName( CCLCMsg_FileCRCCheck& msg, const char *fileName );
static const char *GetFileName( const CCLCMsg_FileCRCCheck& msg );
};
///////////////////////////////////////////////////////////////////////////////////////
// Server messages: Sent from the server to the client
///////////////////////////////////////////////////////////////////////////////////////
typedef CNetMessagePB< svc_ServerInfo, CSVCMsg_ServerInfo, INetChannelInfo::SIGNON > CSVCMsg_ServerInfo_t;
typedef CNetMessagePB< svc_ClassInfo, CSVCMsg_ClassInfo, INetChannelInfo::SIGNON > CSVCMsg_ClassInfo_t;
typedef CNetMessagePB< svc_SendTable, CSVCMsg_SendTable, INetChannelInfo::SIGNON > CSVCMsg_SendTable_t;
typedef CNetMessagePB< svc_Print, CSVCMsg_Print, INetChannelInfo::GENERIC, false > CSVCMsg_Print_t;
typedef CNetMessagePB< svc_SetPause, CSVCMsg_SetPause > CSVCMsg_SetPause_t;
typedef CNetMessagePB< svc_SetView, CSVCMsg_SetView > CSVCMsg_SetView_t;
typedef CNetMessagePB< svc_CreateStringTable, CSVCMsg_CreateStringTable, INetChannelInfo::SIGNON > CSVCMsg_CreateStringTable_t;
typedef CNetMessagePB< svc_UpdateStringTable, CSVCMsg_UpdateStringTable, INetChannelInfo::STRINGTABLE > CSVCMsg_UpdateStringTable_t;
typedef CNetMessagePB< svc_VoiceInit, CSVCMsg_VoiceInit, INetChannelInfo::SIGNON > CSVCMsg_VoiceInit_t;
typedef CNetMessagePB< svc_VoiceData, CSVCMsg_VoiceData, INetChannelInfo::VOICE, false > CSVCMsg_VoiceData_t;
typedef CNetMessagePB< svc_FixAngle, CSVCMsg_FixAngle, INetChannelInfo::GENERIC, false > CSVCMsg_FixAngle_t;
typedef CNetMessagePB< svc_Prefetch, CSVCMsg_Prefetch, INetChannelInfo::SOUNDS > CSVCMsg_Prefetch_t;
typedef CNetMessagePB< svc_CrosshairAngle, CSVCMsg_CrosshairAngle > CSVCMsg_CrosshairAngle_t;
typedef CNetMessagePB< svc_BSPDecal, CSVCMsg_BSPDecal > CSVCMsg_BSPDecal_t;
typedef CNetMessagePB< svc_SplitScreen, CSVCMsg_SplitScreen > CSVCMsg_SplitScreen_t;
typedef CNetMessagePB< svc_GetCvarValue, CSVCMsg_GetCvarValue > CSVCMsg_GetCvarValue_t;
typedef CNetMessagePB< svc_Menu, CSVCMsg_Menu, INetChannelInfo::GENERIC, false > CSVCMsg_Menu_t;
typedef CNetMessagePB< svc_UserMessage, CSVCMsg_UserMessage, INetChannelInfo::USERMESSAGES, false > CSVCMsg_UserMessage_t;
typedef CNetMessagePB< svc_PaintmapData, CSVCMsg_PaintmapData, INetChannelInfo::PAINTMAP > CSVCMsg_PaintmapData_t;
typedef CNetMessagePB< svc_GameEvent, CSVCMsg_GameEvent, INetChannelInfo::EVENTS > CSVCMsg_GameEvent_t;
typedef CNetMessagePB< svc_GameEventList, CSVCMsg_GameEventList > CSVCMsg_GameEventList_t;
typedef CNetMessagePB< svc_TempEntities, CSVCMsg_TempEntities, INetChannelInfo::TEMPENTS, false > CSVCMsg_TempEntities_t;
typedef CNetMessagePB< svc_PacketEntities, CSVCMsg_PacketEntities, INetChannelInfo::ENTITIES > CSVCMsg_PacketEntities_t;
typedef CNetMessagePB< svc_Sounds, CSVCMsg_Sounds, INetChannelInfo::SOUNDS > CSVCMsg_Sounds_t;
typedef CNetMessagePB< svc_EntityMessage, CSVCMsg_EntityMsg, INetChannelInfo::ENTMESSAGES, false > CSVCMsg_EntityMsg_t;
typedef CNetMessagePB< svc_CmdKeyValues, CSVCMsg_CmdKeyValues > CSVCMsg_CmdKeyValues_t;
typedef CNetMessagePB< svc_EncryptedData, CSVCMsg_EncryptedData, INetChannelInfo::ENCRYPTED > CSVCMsg_EncryptedData_t;
typedef CNetMessagePB< svc_HltvReplay, CSVCMsg_HltvReplay, INetChannelInfo::ENTITIES > CSVCMsg_HltvReplay_t;
typedef CNetMessagePB< svc_Broadcast_Command, CSVCMsg_Broadcast_Command, INetChannelInfo::STRINGCMD > CSVCMsg_Broadcast_Command_t;
///////////////////////////////////////////////////////////////////////////////////////
// Utility classes
///////////////////////////////////////////////////////////////////////////////////////
class CmdKeyValuesHelper
{
public:
static void CLCMsg_SetKeyValues( CCLCMsg_CmdKeyValues& msg, const KeyValues *keyValues );
static KeyValues* CLCMsg_GetKeyValues ( const CCLCMsg_CmdKeyValues& msg );
static void SVCMsg_SetKeyValues( CSVCMsg_CmdKeyValues& msg, const KeyValues *keyValues );
static KeyValues *SVCMsg_GetKeyValues ( const CSVCMsg_CmdKeyValues& msg );
};
class INetChannel;
class CmdEncryptedDataMessageCodec
{
public:
static bool SVCMsg_EncryptedData_EncryptMessage( CSVCMsg_EncryptedData_t &msgEncryptedResult, INetMessage *pMsgPlaintextInput, char const *key );
static bool SVCMsg_EncryptedData_Process( CSVCMsg_EncryptedData const &msgEncryptedInput, INetChannel *pProcessingChannel, char const *key );
};
//////////////////////////////////////////////////////////////////////////
// Helper class to share network buffers in the entire process
//////////////////////////////////////////////////////////////////////////
class net_scratchbuffer_t
{
public:
net_scratchbuffer_t()
{
m_pBufferNetMaxMessage = sm_NetScratchBuffers.Get();
if ( !m_pBufferNetMaxMessage )
m_pBufferNetMaxMessage = new buffer_t;
}
~net_scratchbuffer_t()
{
sm_NetScratchBuffers.PutObject( m_pBufferNetMaxMessage );
}
byte * GetBuffer() const
{
return m_pBufferNetMaxMessage->buf;
}
int Size() const
{
return NET_MAX_MESSAGE;
}
private:
struct buffer_t { byte buf[ NET_MAX_MESSAGE ]; };
buffer_t *m_pBufferNetMaxMessage; // buffer that is allocated and returned to shared pool
private:
net_scratchbuffer_t( const net_scratchbuffer_t& ); // FORBID
net_scratchbuffer_t& operator=( const net_scratchbuffer_t& ); // FORBID
static CTSPool< buffer_t > sm_NetScratchBuffers;
};
#endif // NETMESSAGES_H

View File

@ -24,7 +24,53 @@ extern bool g_bUseNetworkVars;
#define CHECK_USENETWORKVARS
#endif
//
// Networkvar flags.
//
#define NETWORKVAR_IS_A_VECTOR 0x0001 // Is it any type of network vector?
#define NETWORKVAR_VECTOR_XYZ_FLAG 0x0002 // Is it a CNetworkVectorXYZ?
#define NETWORKVAR_VECTOR_XY_SEPARATEZ_FLAG 0x0004 // Is it a CNetworkVectorXY_SeparateZ?
#define NETWORKVAR_ALL_FLAGS ( NETWORKVAR_IS_A_VECTOR | NETWORKVAR_VECTOR_XYZ_FLAG | NETWORKVAR_VECTOR_XY_SEPARATEZ_FLAG )
// network vars use memcmp when fields are set. To ensure proper behavior your
// object's memory should be initialized to zero. This happens for entities automatically
// use this for other classes.
class CMemZeroOnNew
{
public:
void* operator new(size_t nSize)
{
void* pMem = MemAlloc_Alloc(nSize);
V_memset(pMem, 0, nSize);
return pMem;
}
void* operator new(size_t nSize, int nBlockUse, const char* pFileName, int nLine)
{
void* pMem = MemAlloc_Alloc(nSize, pFileName, nLine);
V_memset(pMem, 0, nSize);
return pMem;
}
void operator delete(void* pData)
{
if (pData)
{
g_pMemAlloc->Free(pData);
}
}
void operator delete(void* pData, int nBlockUse, const char* pFileName, int nLine)
{
if (pData)
{
g_pMemAlloc->Free(pData, pFileName, nLine);
}
}
};
inline int InternalCheckDeclareClass(const char* pClassName, const char* pClassNameMatch, void* pTestPtr, void* pBasePtr)
{

188
SpyCustom/sdk/panel2d.h Normal file
View File

@ -0,0 +1,188 @@
#pragma once
//https://github.com/lua9520/source-engine-2018-hl2_src/blob/3bf9df6b2785fa6d951086978a3e66f49427166a/public/panorama/controls/panel2d.h
#include "../PatternScan.hpp"
//#include "types.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wreorder"
//#include "utldelegateimpl.h"
#pragma GCC diagnostic pop
namespace panorama
{
class CPanel2D;
class IUIPanel;
class IUIEvent;
class IUIEngineFrameListener;
class IUIPanelStyle;
class IUIJSObject;
class IUIWindow;
class IUISettings;
class IUITextLayout;
class IUIInputEngine;
class IUILocalize;
class IUISoundSystem;
class IUISettings;
class IUILayoutManager;
class IUIFileSystem;
class IUIPanelClient;
// E Prefix for enums?
class EFontStyle;
class EFontWeight;
class ETextAlign;
class EPanelRepaint;
class EStyleRepaint;
class EStyleFlags;
class EFocusMoveDirection;
class EMouseCanActivate;
class EAnimationTimingFunction;
class EAnimationDirection;
class CUILength;
class CLayoutFile;
typedef unsigned short CPanoramaSymbol;
typedef unsigned long long PanelHandle_t;
class CJSONWebAPIParams;
class UIEventFactory;
class EPanelEventSource_t;
class CPanel2DFactory;
class RegisterJSType_t;
class RegisterJSScopeInfo_t;
class RegisterJSEntryInfo_t;
class KeyData_t;
class GamePadData_t;
class MouseData_t;
// Returned by the CreatePanel functions. TODO: Look at panelRefs this might be that.
class PanelWrapper {
public:
void* vtable;
IUIPanel* panel;
};
struct ScrollBehavior_t;
}
// xref "CPanel2D::BSetProperty" to BSetProperty (libclient)
namespace panorama
{
class CPanel2D
{
public:
virtual panorama::IUIPanel* UIPanel(void) = 0;
virtual void OnDeletePanel(void) = 0;
virtual panorama::CPanoramaSymbol GetPanelType(void) = 0;
virtual void Paint(void) = 0;
virtual void sub_4554560() = 0;
virtual void sub_4554570() = 0;
virtual void OnContentSizeTraverse(float *, float *, float, float, bool) = 0;
virtual void OnLayoutTraverse(float, float) = 0;
virtual void OnKeyDown(panorama::KeyData_t const &) = 0;
virtual void OnKeyUp(panorama::KeyData_t const &) = 0;
virtual void OnKeyTyped(panorama::KeyData_t const &) = 0;
virtual void OnGamePadDown(panorama::GamePadData_t const &) = 0;
virtual void OnGamePadUp(panorama::GamePadData_t const &) = 0;
virtual void OnGamePadAnalog(panorama::GamePadData_t const &) = 0;
virtual void OnMouseButtonDown(panorama::MouseData_t const &) = 0;
virtual void OnMouseButtonUp(panorama::MouseData_t const &) = 0;
virtual void OnMouseButtonDoubleClick(panorama::MouseData_t const &) = 0;
virtual void OnMouseButtonTripleClick(panorama::MouseData_t const &) = 0;
virtual void OnMouseWheel(panorama::MouseData_t const &) = 0;
virtual void OnMouseMove(float, float) = 0;
virtual void OnClick(panorama::IUIPanel *panel, panorama::MouseData_t const &) = 0;
virtual void sub_23BF260() = 0;
virtual bool BIsClientPanelEvent(panorama::CPanoramaSymbol) = 0;
virtual bool sub_3BC94E0() = 0;
virtual void sub_4555580() = 0;
virtual bool BSetProperty(panorama::CPanoramaSymbol, const char *) = 0;
virtual bool BIsDelayedProperty(panorama::CPanoramaSymbol) = 0;
virtual void OnBeforeChildrenChanged(void) = 0;
virtual void OnRemoveChild(panorama::IUIPanel* child) = 0;
virtual void OnAfterChildrenChanged(void) = 0;
virtual void OnInitializedFromLayout(void) = 0;
virtual void OnStylesChanged(void) = 0;
virtual void OnChildStylesChanged(void) = 0;
virtual void OnVisibilityChanged(void) = 0;
virtual void OnSetFocusToNextPanel(int, panorama::EFocusMoveDirection, bool, float, float, float, float ,float) = 0;
virtual void* GetLocalizationParent(void) = 0;
virtual bool BRequiresContentClipLayer(void) = 0;
virtual void OnCallBeforeStyleAndLayout(void) = 0;
virtual void OnPanelEventSet(panorama::CPanoramaSymbol event) = 0;
virtual void* GetMouseCursor(void) = 0;
virtual void OnUIScaleFactorChanged(float scaleFactor) = 0;
virtual void SetupJavascriptObjectTemplate(void) = 0;
virtual void CreateNewVerticalScrollBar(float) = 0;
virtual void CreateNewHorizontalScrollBar(float) = 0;
virtual void HideTooltip(void) = 0;
virtual void GetDefaultInputFocus(void) = 0;
virtual void GetPositionWithinAncestor(panorama::CPanel2D* ancestor, float *x, float *y) = 0;
virtual void sub_23BF380() = 0;
virtual void sub_23BF390() = 0; // These are in these 6 somewhere
virtual void sub_23BF3A0() = 0; // panorama::CPanel2D::BCanCustomScrollUp(void)
virtual void sub_23BF3B0() = 0; // panorama::CPanel2D::BCanCustomScrollDown(void)
virtual void sub_23BF3C0() = 0; // panorama::CPanel2D::BCanCustomScrollLeft(void)
virtual void sub_23BF3D0() = 0; // panorama::CPanel2D::BCanCustomScrollRight(void)
virtual void UnloadImages(void) = 0;
virtual void ReloadImages(void) = 0;
virtual void DESTROY1() = 0;
virtual void DESTROY2() = 0;
virtual void GetContextUIBounds(float *x1, float *y1, float *x2, float *y2) = 0;
virtual void ScrollToXPercent(float value) = 0;
virtual void ScrollToYPercent(float value) = 0;
virtual void OnMoveUp(int) = 0;
virtual void OnMoveDown(int) = 0;
virtual void OnMoveLeft(int) = 0;
virtual void OnMoveRight(int) = 0;
virtual void OnTabForward(int) = 0;
virtual void OnTabBackward(int) = 0;
virtual void sub_23BF270() = 0;
virtual void sub_23BF290() = 0;
virtual void sub_4554580() = 0;
virtual bool IsClonable() = 0;
virtual panorama::CPanel2D* Clone(void) = 0;
virtual void ReSortChild(bool (*)(panorama::IUIPanelClient * const&,panorama::IUIPanelClient * const&),panorama::CPanel2D*) = 0;
virtual bool HasBeenLayedOut(void) = 0;
virtual void* AccessRenderingEngine(void) = 0;
virtual void sub_23BF420() = 0;
virtual void InitClonedPanel(panorama::CPanel2D* ) = 0;
virtual void AddDisabledFlagToChildren(void) = 0;
virtual void RemoveDisabledFlagFromChildren(void) = 0;
virtual void FireGameEvent(void* IGameEvent) = 0;
virtual void OnDOTAGameUIStateChange(int DotaGameUIStateOld, int DotaGameUIStateNew) = 0;
//https://www.unknowncheats.me/forum/counterstrike-global-offensive/342743-finding-sigging-chud-pointer-chud-findelement.html
void ShowAlert_v(const char* text, const int mode)
{
//How to find CPanel2D::ShowAlert
// 1. Search for "AlertVisible"
// 2. First and only cross - reference will be to ShowAlert
static void* ptr = (void*)(FindPatternV2("client.dll", "55 8B EC A1 ? ? ? ? 83 EC 08 56 8B F1 57 A8 01 75 26 8B 0D ? ? ? ? 83 C8 01 A3 ? ? ? ? 68 ? ? ? ? 8B 01 FF 90 ? ? ? ? 66 A3 ? ? ? ? A1"));
static auto fn = reinterpret_cast<void(__thiscall*)(CPanel2D*, const char*, int)>(ptr);
return fn(this, text, mode);
}
void HidePanel_v()
{
//How to find CPanel2D::HidePanel
// 1. Search for "HideFlash"
// 2. First cross - reference is to the HidePanel function
/*
static auto fn = memory::follow_relative_jump(FindPatternV2("client.dll", "E8 ? ? ? ? 5F 5E 5B 8B E5 5D C2 04 00 8B D3 B9 ? ? ? ? E8 ? ? ? ? 85 C0 0F 85 ? ? ? ? 8B 44 24 14"))
.as<void(__thiscall*)(CPanel2D*, bool)>();
return fn(this, false);
*/
}
};
}

View File

@ -896,10 +896,21 @@ FORCEINLINE unsigned long LoadLittleDWord(const unsigned long* base, unsigned in
return LittleDWord(base[dwordIndex]);
}
FORCEINLINE uint32 LoadLittleDWord(const uint32* base, unsigned int dwordIndex)
{
return LittleDWord(base[dwordIndex]);
}
FORCEINLINE void StoreLittleDWord(unsigned long* base, unsigned int dwordIndex, unsigned long dword)
{
base[dwordIndex] = LittleDWord(dword);
}
FORCEINLINE void StoreLittleDWord(uint32* base, unsigned int dwordIndex, unsigned long dword)
{
base[dwordIndex] = LittleDWord(dword);
}
#endif

36
SpyCustom/sdk/qlimits.h Normal file
View File

@ -0,0 +1,36 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef QLIMITS_H
#define QLIMITS_H
#if defined( _WIN32 )
#pragma once
#endif
// DATA STRUCTURE INFO
#define MAX_NUM_ARGVS 50
// SYSTEM INFO
#define MAX_QPATH 96 // max length of a game pathname
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define ON_EPSILON 0.1 // point on plane side epsilon
// Resource counts;
// Must have this value in sync(-1) with const.h and effect_dispatch_data.cpp
#define MAX_MODEL_INDEX_BITS 12 // sent as a short
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
#define MAX_GENERIC_INDEX_BITS 9
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
#define MAX_DECAL_INDEX_BITS 9
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)
#endif // QLIMITS_H

View File

@ -63,15 +63,16 @@ public:
CHAT_FILTER_ACHIEVEMENT = 0x000020,
};
void ChatPrintf2(int iPlayerIndex, int iFilter, const char* fmt, ...)
void ChatPrintf_v(int iPlayerIndex, int iFilter, const char* fmt, ...)
{
char msg[1024];
va_list args;
va_start(args, fmt);
vsnprintf(msg, 1024, fmt, args);
vsnprintf(msg, 1024, fmt, args);
getvfunc<void(__cdecl*)(void*, int, int, const char*, ...)>(this, 27)(this, iPlayerIndex, iFilter, fmt);
va_end(args);
}
}
int GetChatInputOffset(void);
};

393
SpyCustom/sdk/steam_api.h Normal file
View File

@ -0,0 +1,393 @@
//====== Copyright 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef STEAM_API_H
#define STEAM_API_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
#include "isteamuser.h"
#include "isteamfriends.h"
#include "isteamutils.h"
#include "isteammatchmaking.h"
#include "isteamuserstats.h"
#include "isteamapps.h"
#include "isteamnetworking.h"
#include "isteamremotestorage.h"
#include "isteamscreenshots.h"
#include "isteammusic.h"
#include "isteammusicremote.h"
#include "isteamhttp.h"
#include "isteamunifiedmessages.h"
#include "isteamcontroller.h"
#include "isteamugc.h"
#include "isteamapplist.h"
#include "isteamhtmlsurface.h"
#include "isteaminventory.h"
#include "isteamvideo.h"
// Steam API export macro
#if defined( _WIN32 ) && !defined( _X360 )
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __declspec( dllexport )
#elif defined( STEAM_API_NODLL )
#define S_API extern "C"
#else
#define S_API extern "C" __declspec( dllimport )
#endif // STEAM_API_EXPORTS
#elif defined( GNUC )
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __attribute__ ((visibility("default")))
#else
#define S_API extern "C"
#endif // STEAM_API_EXPORTS
#else // !WIN32
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C"
#else
#define S_API extern "C"
#endif // STEAM_API_EXPORTS
#endif
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Steam API setup & shutdown
//
// These functions manage loading, initializing and shutdown of the steamclient.dll
//
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// SteamAPI_Init must be called before using any other API functions. If it fails, an
// error message will be output to the debugger (or stderr) with further information.
S_API bool S_CALLTYPE SteamAPI_Init();
// SteamAPI_Shutdown should be called during process shutdown if possible.
S_API void S_CALLTYPE SteamAPI_Shutdown();
// SteamAPI_RestartAppIfNecessary ensures that your executable was launched through Steam.
//
// Returns true if the current process should terminate. Steam is now re-launching your application.
//
// Returns false if no action needs to be taken. This means that your executable was started through
// the Steam client, or a steam_appid.txt file is present in your game's directory (for development).
// Your current process should continue if false is returned.
//
// NOTE: If you use the Steam DRM wrapper on your primary executable file, this check is unnecessary
// since the DRM wrapper will ensure that your application was launched properly through Steam.
S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID );
// Most Steam API functions allocate some amount of thread-local memory for parameter storage.
// SteamAPI_ReleaseCurrentThreadMemory() will free API memory associated with the calling thread.
// This function is also called automatically by SteamAPI_RunCallbacks(), so a single-threaded
// program never needs to explicitly call this function.
S_API void S_CALLTYPE SteamAPI_ReleaseCurrentThreadMemory();
// crash dump recording functions
S_API void S_CALLTYPE SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID );
S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg );
// If your application contains modules or libraries which could be built against different SDK
// versions, then you should define VERSION_SAFE_STEAM_API_INTERFACES to enforce that you cannot
// use the un-versioned global accessors. Instead, always create and use CSteamAPIContext objects
// to retrieve interface pointers which match the Steamworks SDK headers which match your build.
#if !defined( VERSION_SAFE_STEAM_API_INTERFACES ) && !defined( STEAM_API_EXPORTS )
inline ISteamClient *SteamClient();
inline ISteamUser *SteamUser();
inline ISteamFriends *SteamFriends();
inline ISteamUtils *SteamUtils();
inline ISteamMatchmaking *SteamMatchmaking();
inline ISteamUserStats *SteamUserStats();
inline ISteamApps *SteamApps();
inline ISteamNetworking *SteamNetworking();
inline ISteamMatchmakingServers *SteamMatchmakingServers();
inline ISteamRemoteStorage *SteamRemoteStorage();
inline ISteamScreenshots *SteamScreenshots();
inline ISteamHTTP *SteamHTTP();
inline ISteamUnifiedMessages *SteamUnifiedMessages();
inline ISteamController *SteamController();
inline ISteamUGC *SteamUGC();
inline ISteamAppList *SteamAppList();
inline ISteamMusic *SteamMusic();
inline ISteamMusicRemote *SteamMusicRemote();
inline ISteamHTMLSurface *SteamHTMLSurface();
inline ISteamInventory *SteamInventory();
inline ISteamVideo *SteamVideo();
#endif // VERSION_SAFE_STEAM_API_INTERFACES
// Every compiled module will have its own inlined definitions of CSteamAPIContext::Init.
// Do NOT share CSteamAPIContext pointers across modules unless you are sure that they will
// all be compiled against the same SDK!
class CSteamAPIContext
{
public:
CSteamAPIContext() { Clear(); }
void Clear();
bool Init();
ISteamClient* SteamClient() const { return m_pSteamClient; }
ISteamUser* SteamUser() const { return m_pSteamUser; }
ISteamFriends* SteamFriends() const { return m_pSteamFriends; }
ISteamUtils* SteamUtils() const { return m_pSteamUtils; }
ISteamMatchmaking* SteamMatchmaking() const { return m_pSteamMatchmaking; }
ISteamUserStats* SteamUserStats() const { return m_pSteamUserStats; }
ISteamApps* SteamApps() const { return m_pSteamApps; }
ISteamMatchmakingServers* SteamMatchmakingServers() const { return m_pSteamMatchmakingServers; }
ISteamNetworking* SteamNetworking() const { return m_pSteamNetworking; }
ISteamRemoteStorage* SteamRemoteStorage() const { return m_pSteamRemoteStorage; }
ISteamScreenshots* SteamScreenshots() const { return m_pSteamScreenshots; }
ISteamHTTP* SteamHTTP() const { return m_pSteamHTTP; }
ISteamUnifiedMessages* SteamUnifiedMessages() const { return m_pSteamUnifiedMessages; }
ISteamController* SteamController() const { return m_pController; }
ISteamUGC* SteamUGC() const { return m_pSteamUGC; }
ISteamAppList* SteamAppList() const { return m_pSteamAppList; }
ISteamMusic* SteamMusic() const { return m_pSteamMusic; }
ISteamMusicRemote* SteamMusicRemote() const { return m_pSteamMusicRemote; }
ISteamHTMLSurface* SteamHTMLSurface() const { return m_pSteamHTMLSurface; }
ISteamInventory* SteamInventory() const { return m_pSteamInventory; }
ISteamVideo* SteamVideo() const { return m_pSteamVideo; }
private:
ISteamClient *m_pSteamClient;
ISteamUser *m_pSteamUser;
ISteamFriends *m_pSteamFriends;
ISteamUtils *m_pSteamUtils;
ISteamMatchmaking *m_pSteamMatchmaking;
ISteamUserStats *m_pSteamUserStats;
ISteamApps *m_pSteamApps;
ISteamMatchmakingServers *m_pSteamMatchmakingServers;
ISteamNetworking *m_pSteamNetworking;
ISteamRemoteStorage *m_pSteamRemoteStorage;
ISteamScreenshots *m_pSteamScreenshots;
ISteamHTTP *m_pSteamHTTP;
ISteamUnifiedMessages *m_pSteamUnifiedMessages;
ISteamController *m_pController;
ISteamUGC *m_pSteamUGC;
ISteamAppList *m_pSteamAppList;
ISteamMusic *m_pSteamMusic;
ISteamMusicRemote *m_pSteamMusicRemote;
ISteamHTMLSurface *m_pSteamHTMLSurface;
ISteamInventory *m_pSteamInventory;
ISteamVideo *m_pSteamVideo;
};
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steam callback and call-result helpers
//
// The following macros and classes are used to register your application for
// callbacks and call-results, which are delivered in a predictable manner.
//
// STEAM_CALLBACK macros are meant for use inside of a C++ class definition.
// They map a Steam notification callback directly to a class member function
// which is automatically prototyped as "void func( callback_type *pParam )".
//
// CCallResult is used with specific Steam APIs that return "result handles".
// The handle can be passed to a CCallResult object's Set function, along with
// an object pointer and member-function pointer. The member function will
// be executed once the results of the Steam API call are available.
//
// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK
// macros if you require finer control over registration and unregistration.
//
// Callbacks and call-results are queued automatically and are only
// delivered/executed when your application calls SteamAPI_RunCallbacks().
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// SteamAPI_RunCallbacks is safe to call from multiple threads simultaneously,
// but if you choose to do this, callback code could be executed on any thread.
// One alternative is to call SteamAPI_RunCallbacks from the main thread only,
// and call SteamAPI_ReleaseCurrentThreadMemory regularly on other threads.
S_API void S_CALLTYPE SteamAPI_RunCallbacks();
// Declares a callback member function plus a helper member variable which
// registers the callback on object creation and unregisters on destruction.
// The optional fourth 'var' param exists only for backwards-compatibility
// and can be ignored.
#define STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
// Declares a callback function and a named CCallbackManual variable which
// has Register and Unregister functions instead of automatic registration.
#define STEAM_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \
CCallbackManual< thisclass, callback_type > var; void func( callback_type *pParam )
// Internal functions used by the utility CCallback objects to receive callbacks
S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback );
S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback );
// Internal functions used by the utility CCallResult objects to receive async call results
S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
//-----------------------------------------------------------------------------
// Purpose: base for callbacks and call results - internal implementation detail
//-----------------------------------------------------------------------------
class CCallbackBase
{
public:
CCallbackBase() { m_nCallbackFlags = 0; m_iCallback = 0; }
// don't add a virtual destructor because we export this binary interface across dll's
virtual void Run( void *pvParam ) = 0;
virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) = 0;
int GetICallback() { return m_iCallback; }
virtual int GetCallbackSizeBytes() = 0;
protected:
enum { k_ECallbackFlagsRegistered = 0x01, k_ECallbackFlagsGameServer = 0x02 };
uint8 m_nCallbackFlags;
int m_iCallback;
friend class CCallbackMgr;
private:
CCallbackBase( const CCallbackBase& );
CCallbackBase& operator=( const CCallbackBase& );
};
//-----------------------------------------------------------------------------
// Purpose: templated base for callbacks - internal implementation detail
//-----------------------------------------------------------------------------
template< int sizeof_P >
class CCallbackImpl : protected CCallbackBase
{
public:
~CCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) SteamAPI_UnregisterCallback( this ); }
void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; }
protected:
virtual void Run( void *pvParam ) = 0;
virtual void Run( void *pvParam, bool /*bIOFailure*/, SteamAPICall_t /*hSteamAPICall*/ ) { Run( pvParam ); }
virtual int GetCallbackSizeBytes() { return sizeof_P; }
};
//-----------------------------------------------------------------------------
// Purpose: maps a steam async call result to a class member function
// template params: T = local class, P = parameter struct
//-----------------------------------------------------------------------------
template< class T, class P >
class CCallResult : private CCallbackBase
{
public:
typedef void (T::*func_t)( P*, bool );
CCallResult();
~CCallResult();
void Set( SteamAPICall_t hAPICall, T *p, func_t func );
bool IsActive() const;
void Cancel();
void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; }
private:
virtual void Run( void *pvParam );
virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
virtual int GetCallbackSizeBytes() { return sizeof( P ); }
SteamAPICall_t m_hAPICall;
T *m_pObj;
func_t m_Func;
};
//-----------------------------------------------------------------------------
// Purpose: maps a steam callback to a class member function
// template params: T = local class, P = parameter struct,
// bGameserver = listen for gameserver callbacks instead of client callbacks
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameserver = false >
class CCallback : public CCallbackImpl< sizeof( P ) >
{
public:
typedef void (T::*func_t)(P*);
// NOTE: If you can't provide the correct parameters at construction time, you should
// use the CCallbackManual callback object (STEAM_CALLBACK_MANUAL macro) instead.
CCallback( T *pObj, func_t func );
void Register( T *pObj, func_t func );
void Unregister();
protected:
virtual void Run( void *pvParam );
T *m_pObj;
func_t m_Func;
};
//-----------------------------------------------------------------------------
// Purpose: subclass of CCallback which allows default-construction in
// an unregistered state; you must call Register manually
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameServer = false >
class CCallbackManual : public CCallback< T, P, bGameServer >
{
public:
CCallbackManual() : CCallback< T, P, bGameServer >( NULL, NULL ) {}
// Inherits public Register and Unregister functions from base class
};
#ifdef _WIN32
// disable this warning; this pattern need for steam callback registration
#pragma warning( disable: 4355 ) // 'this' : used in base member initializer list
#endif
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steamclient.dll private wrapper functions
//
// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// SteamAPI_IsSteamRunning() returns true if Steam is currently running
S_API bool S_CALLTYPE SteamAPI_IsSteamRunning();
// Pumps out all the steam messages, calling registered callbacks.
// NOT THREADSAFE - do not call from multiple threads simultaneously.
S_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks );
// register the callback funcs to use to interact with the steam dll
S_API void Steam_RegisterInterfaceFuncs( void *hModule );
// returns the HSteamUser of the last user to dispatch a callback
S_API HSteamUser Steam_GetHSteamUserCurrent();
// returns the filename path of the current running Steam process, used if you need to load an explicit steam dll by name.
// DEPRECATED - implementation is Windows only, and the path returned is a UTF-8 string which must be converted to UTF-16 for use with Win32 APIs
S_API const char *SteamAPI_GetSteamInstallPath();
// returns the pipe we are communicating to Steam with
S_API HSteamPipe SteamAPI_GetHSteamPipe();
// sets whether or not Steam_RunCallbacks() should do a try {} catch (...) {} around calls to issuing callbacks
S_API void SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks );
// backwards compat export, passes through to SteamAPI_ variants
S_API HSteamPipe GetHSteamPipe();
S_API HSteamUser GetHSteamUser();
#if defined( VERSION_SAFE_STEAM_API_INTERFACES )
// backwards compat with older SDKs
S_API bool S_CALLTYPE SteamAPI_InitSafe();
#endif
#include "steam_api_internal.h"
#endif // STEAM_API_H

View File

@ -0,0 +1,327 @@
//====== Copyright 1996-2015, Valve Corporation, All rights reserved. =======
//
// Purpose: Internal private Steamworks API declarations and definitions
//
//=============================================================================
#ifndef STEAM_API_INTERNAL_H
#define STEAM_API_INTERNAL_H
S_API HSteamUser SteamAPI_GetHSteamUser();
S_API bool S_CALLTYPE SteamInternal_Init();
S_API void * S_CALLTYPE SteamInternal_CreateInterface( const char *ver );
S_API void * S_CALLTYPE SteamGameServerInternal_CreateInterface( const char *ver );
#if !defined( STEAM_API_EXPORTS )
#if !defined( VERSION_SAFE_STEAM_API_INTERFACES )
inline CSteamAPIContext& SteamInternal_ModuleContext()
{
// NOTE: declaring "static CSteamAPIConext" creates a large function
// which queries the initialization status of the object. We know that
// it is pointer-aligned and fully memset with zeros, so just alias a
// static buffer of the appropriate size and call it a CSteamAPIContext.
static void* ctx[ sizeof(CSteamAPIContext)/sizeof(void*) ];
return *(CSteamAPIContext*)ctx;
}
#define _STEAMINTERNAL_ACCESSOR_BODY( AccessFunc ) \
if ( !SteamAPI_GetHSteamPipe() ) return 0; \
CSteamAPIContext &ctx = SteamInternal_ModuleContext(); \
if ( !ctx.AccessFunc() ) ctx.Init(); \
return ctx.AccessFunc();
inline ISteamClient *SteamClient() { _STEAMINTERNAL_ACCESSOR_BODY( SteamClient ) }
inline ISteamUser *SteamUser() { _STEAMINTERNAL_ACCESSOR_BODY( SteamUser ) }
inline ISteamFriends *SteamFriends() { _STEAMINTERNAL_ACCESSOR_BODY( SteamFriends ) }
inline ISteamUtils *SteamUtils() { _STEAMINTERNAL_ACCESSOR_BODY( SteamUtils ) }
inline ISteamMatchmaking *SteamMatchmaking() { _STEAMINTERNAL_ACCESSOR_BODY( SteamMatchmaking ) }
inline ISteamUserStats *SteamUserStats() { _STEAMINTERNAL_ACCESSOR_BODY( SteamUserStats ) }
inline ISteamApps *SteamApps() { _STEAMINTERNAL_ACCESSOR_BODY( SteamApps ) }
inline ISteamMatchmakingServers *SteamMatchmakingServers() { _STEAMINTERNAL_ACCESSOR_BODY( SteamMatchmakingServers ) }
inline ISteamNetworking *SteamNetworking() { _STEAMINTERNAL_ACCESSOR_BODY( SteamNetworking ) }
inline ISteamRemoteStorage *SteamRemoteStorage() { _STEAMINTERNAL_ACCESSOR_BODY( SteamRemoteStorage ) }
inline ISteamScreenshots *SteamScreenshots() { _STEAMINTERNAL_ACCESSOR_BODY( SteamScreenshots ) }
inline ISteamHTTP *SteamHTTP() { _STEAMINTERNAL_ACCESSOR_BODY( SteamHTTP ) }
inline ISteamUnifiedMessages *SteamUnifiedMessages() { _STEAMINTERNAL_ACCESSOR_BODY( SteamUnifiedMessages ) }
inline ISteamController *SteamController() { _STEAMINTERNAL_ACCESSOR_BODY( SteamController ) }
inline ISteamUGC *SteamUGC() { _STEAMINTERNAL_ACCESSOR_BODY( SteamUGC ) }
inline ISteamAppList *SteamAppList() { _STEAMINTERNAL_ACCESSOR_BODY( SteamAppList ) }
inline ISteamMusic *SteamMusic() { _STEAMINTERNAL_ACCESSOR_BODY( SteamMusic ) }
inline ISteamMusicRemote *SteamMusicRemote() { _STEAMINTERNAL_ACCESSOR_BODY( SteamMusicRemote ) }
inline ISteamHTMLSurface *SteamHTMLSurface() { _STEAMINTERNAL_ACCESSOR_BODY( SteamHTMLSurface ) }
inline ISteamInventory *SteamInventory() { _STEAMINTERNAL_ACCESSOR_BODY( SteamInventory ) }
inline ISteamVideo *SteamVideo() { _STEAMINTERNAL_ACCESSOR_BODY( SteamVideo ) }
#undef _STEAMINTERNAL_ACCESSOR_BODY
#endif // !defined( VERSION_SAFE_STEAM_API_INTERFACES )
#endif // !defined( STEAM_API_EXPORTS )
inline void CSteamAPIContext::Clear()
{
m_pSteamClient = NULL;
m_pSteamUser = NULL;
m_pSteamFriends = NULL;
m_pSteamUtils = NULL;
m_pSteamMatchmaking = NULL;
m_pSteamUserStats = NULL;
m_pSteamApps = NULL;
m_pSteamMatchmakingServers = NULL;
m_pSteamNetworking = NULL;
m_pSteamRemoteStorage = NULL;
m_pSteamHTTP = NULL;
m_pSteamScreenshots = NULL;
m_pSteamMusic = NULL;
m_pSteamUnifiedMessages = NULL;
m_pController = NULL;
m_pSteamUGC = NULL;
m_pSteamAppList = NULL;
m_pSteamMusic = NULL;
m_pSteamMusicRemote = NULL;
m_pSteamHTMLSurface = NULL;
m_pSteamInventory = NULL;
}
// This function must be declared inline in the header so the module using steam_api.dll gets the version names they want.
inline bool CSteamAPIContext::Init()
{
HSteamUser hSteamUser = SteamAPI_GetHSteamUser();
HSteamPipe hSteamPipe = SteamAPI_GetHSteamPipe();
if ( !hSteamPipe )
return false;
m_pSteamClient = (ISteamClient*) SteamInternal_CreateInterface( STEAMCLIENT_INTERFACE_VERSION );
if ( !m_pSteamClient )
return false;
m_pSteamUser = m_pSteamClient->GetISteamUser( hSteamUser, hSteamPipe, STEAMUSER_INTERFACE_VERSION );
if ( !m_pSteamUser )
return false;
m_pSteamFriends = m_pSteamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION );
if ( !m_pSteamFriends )
return false;
m_pSteamUtils = m_pSteamClient->GetISteamUtils( hSteamPipe, STEAMUTILS_INTERFACE_VERSION );
if ( !m_pSteamUtils )
return false;
m_pSteamMatchmaking = m_pSteamClient->GetISteamMatchmaking( hSteamUser, hSteamPipe, STEAMMATCHMAKING_INTERFACE_VERSION );
if ( !m_pSteamMatchmaking )
return false;
m_pSteamMatchmakingServers = m_pSteamClient->GetISteamMatchmakingServers( hSteamUser, hSteamPipe, STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION );
if ( !m_pSteamMatchmakingServers )
return false;
m_pSteamUserStats = m_pSteamClient->GetISteamUserStats( hSteamUser, hSteamPipe, STEAMUSERSTATS_INTERFACE_VERSION );
if ( !m_pSteamUserStats )
return false;
m_pSteamApps = m_pSteamClient->GetISteamApps( hSteamUser, hSteamPipe, STEAMAPPS_INTERFACE_VERSION );
if ( !m_pSteamApps )
return false;
m_pSteamNetworking = m_pSteamClient->GetISteamNetworking( hSteamUser, hSteamPipe, STEAMNETWORKING_INTERFACE_VERSION );
if ( !m_pSteamNetworking )
return false;
m_pSteamRemoteStorage = m_pSteamClient->GetISteamRemoteStorage( hSteamUser, hSteamPipe, STEAMREMOTESTORAGE_INTERFACE_VERSION );
if ( !m_pSteamRemoteStorage )
return false;
m_pSteamScreenshots = m_pSteamClient->GetISteamScreenshots( hSteamUser, hSteamPipe, STEAMSCREENSHOTS_INTERFACE_VERSION );
if ( !m_pSteamScreenshots )
return false;
m_pSteamHTTP = m_pSteamClient->GetISteamHTTP( hSteamUser, hSteamPipe, STEAMHTTP_INTERFACE_VERSION );
if ( !m_pSteamHTTP )
return false;
m_pSteamUnifiedMessages = m_pSteamClient->GetISteamUnifiedMessages( hSteamUser, hSteamPipe, STEAMUNIFIEDMESSAGES_INTERFACE_VERSION );
if ( !m_pSteamUnifiedMessages )
return false;
m_pController = m_pSteamClient->GetISteamController( hSteamUser, hSteamPipe, STEAMCONTROLLER_INTERFACE_VERSION );
if ( !m_pController )
return false;
m_pSteamUGC = m_pSteamClient->GetISteamUGC( hSteamUser, hSteamPipe, STEAMUGC_INTERFACE_VERSION );
if ( !m_pSteamUGC )
return false;
m_pSteamAppList = m_pSteamClient->GetISteamAppList( hSteamUser, hSteamPipe, STEAMAPPLIST_INTERFACE_VERSION );
if ( !m_pSteamAppList )
return false;
m_pSteamMusic = m_pSteamClient->GetISteamMusic( hSteamUser, hSteamPipe, STEAMMUSIC_INTERFACE_VERSION );
if ( !m_pSteamMusic )
return false;
m_pSteamMusicRemote = m_pSteamClient->GetISteamMusicRemote( hSteamUser, hSteamPipe, STEAMMUSICREMOTE_INTERFACE_VERSION );
if ( !m_pSteamMusicRemote )
return false;
m_pSteamHTMLSurface = m_pSteamClient->GetISteamHTMLSurface( hSteamUser, hSteamPipe, STEAMHTMLSURFACE_INTERFACE_VERSION );
if ( !m_pSteamHTMLSurface )
return false;
m_pSteamInventory = m_pSteamClient->GetISteamInventory( hSteamUser, hSteamPipe, STEAMINVENTORY_INTERFACE_VERSION );
if ( !m_pSteamInventory )
return false;
m_pSteamVideo = m_pSteamClient->GetISteamVideo( hSteamUser, hSteamPipe, STEAMVIDEO_INTERFACE_VERSION );
if ( !m_pSteamVideo )
return false;
return true;
}
//-----------------------------------------------------------------------------
// The following macros are implementation details, not intended for public use
//-----------------------------------------------------------------------------
#define _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param )
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED
#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y
#define _STEAM_CALLBACK_3( extra_code, thisclass, func, param ) \
struct CCallbackInternal_ ## func : private CCallbackImpl< sizeof( param ) > { \
CCallbackInternal_ ## func () { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \
CCallbackInternal_ ## func ( const CCallbackInternal_ ## func & ) { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \
CCallbackInternal_ ## func & operator=( const CCallbackInternal_ ## func & ) { return *this; } \
private: virtual void Run( void *pvParam ) { _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) \
thisclass *pOuter = reinterpret_cast<thisclass*>( reinterpret_cast<char*>(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \
pOuter->func( reinterpret_cast<param*>( pvParam ) ); \
} \
} m_steamcallback_ ## func ; void func( param *pParam )
#define _STEAM_CALLBACK_4( _, thisclass, func, param, var ) \
CCallback< thisclass, param > var; void func( param *pParam )
//-----------------------------------------------------------------------------
// Purpose: maps a steam async call result to a class member function
// template params: T = local class, P = parameter struct
//-----------------------------------------------------------------------------
template< class T, class P >
inline CCallResult<T, P>::CCallResult()
{
m_hAPICall = k_uAPICallInvalid;
m_pObj = NULL;
m_Func = NULL;
m_iCallback = P::k_iCallback;
}
template< class T, class P >
inline void CCallResult<T, P>::Set( SteamAPICall_t hAPICall, T *p, func_t func )
{
if ( m_hAPICall )
SteamAPI_UnregisterCallResult( this, m_hAPICall );
m_hAPICall = hAPICall;
m_pObj = p;
m_Func = func;
if ( hAPICall )
SteamAPI_RegisterCallResult( this, hAPICall );
}
template< class T, class P >
inline bool CCallResult<T, P>::IsActive() const
{
return (m_hAPICall != k_uAPICallInvalid);
}
template< class T, class P >
inline void CCallResult<T, P>::Cancel()
{
if ( m_hAPICall != k_uAPICallInvalid )
{
SteamAPI_UnregisterCallResult( this, m_hAPICall );
m_hAPICall = k_uAPICallInvalid;
}
}
template< class T, class P >
inline CCallResult<T, P>::~CCallResult()
{
Cancel();
}
template< class T, class P >
inline void CCallResult<T, P>::Run( void *pvParam )
{
m_hAPICall = k_uAPICallInvalid; // caller unregisters for us
(m_pObj->*m_Func)((P *)pvParam, false);
}
template< class T, class P >
inline void CCallResult<T, P>::Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall )
{
if ( hSteamAPICall == m_hAPICall )
{
m_hAPICall = k_uAPICallInvalid; // caller unregisters for us
(m_pObj->*m_Func)((P *)pvParam, bIOFailure);
}
}
//-----------------------------------------------------------------------------
// Purpose: maps a steam callback to a class member function
// template params: T = local class, P = parameter struct,
// bGameserver = listen for gameserver callbacks instead of client callbacks
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameserver >
inline CCallback< T, P, bGameserver >::CCallback( T *pObj, func_t func )
: m_pObj( NULL ), m_Func( NULL )
{
if ( bGameserver )
{
this->SetGameserverFlag();
}
Register( pObj, func );
}
template< class T, class P, bool bGameserver >
inline void CCallback< T, P, bGameserver >::Register( T *pObj, func_t func )
{
if ( !pObj || !func )
return;
if ( this->m_nCallbackFlags & CCallbackBase::k_ECallbackFlagsRegistered )
Unregister();
m_pObj = pObj;
m_Func = func;
// SteamAPI_RegisterCallback sets k_ECallbackFlagsRegistered
SteamAPI_RegisterCallback( this, P::k_iCallback );
}
template< class T, class P, bool bGameserver >
inline void CCallback< T, P, bGameserver >::Unregister()
{
// SteamAPI_UnregisterCallback removes k_ECallbackFlagsRegistered
SteamAPI_UnregisterCallback( this );
}
template< class T, class P, bool bGameserver >
inline void CCallback< T, P, bGameserver >::Run( void *pvParam )
{
(m_pObj->*m_Func)((P *)pvParam);
}
#if defined(USE_BREAKPAD_HANDLER) || defined(STEAM_API_EXPORTS)
// this should be called before the game initialized the steam APIs
// pchDate should be of the format "Mmm dd yyyy" (such as from the __ DATE __ macro )
// pchTime should be of the format "hh:mm:ss" (such as from the __ TIME __ macro )
// bFullMemoryDumps (Win32 only) -- writes out a uuid-full.dmp in the client/dumps folder
// pvContext-- can be NULL, will be the void * context passed into m_pfnPreMinidumpCallback
// PFNPreMinidumpCallback m_pfnPreMinidumpCallback -- optional callback which occurs just before a .dmp file is written during a crash. Applications can hook this to allow adding additional information into the .dmp comment stream.
S_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback );
S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID );
#endif
#endif // STEAM_API_INTERNAL_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
//====== Copyright © 1996-2010, Valve Corporation, All rights reserved. =======
//
// Purpose: HTTP related enums, stuff that is shared by both clients and servers, and our
// UI projects goes here.
//
//=============================================================================
#ifndef STEAMHTTPENUMS_H
#define STEAMHTTPENUMS_H
#ifdef _WIN32
#pragma once
#endif
// HTTP related types
// This enum is used in client API methods, do not re-number existing values.
enum EHTTPMethod
{
k_EHTTPMethodInvalid = 0,
k_EHTTPMethodGET,
k_EHTTPMethodHEAD,
k_EHTTPMethodPOST,
k_EHTTPMethodPUT,
k_EHTTPMethodDELETE,
k_EHTTPMethodOPTIONS,
k_EHTTPMethodPATCH,
// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for
// a compliant general purpose server. We'll likely add more as we find uses for them.
// k_EHTTPMethodTRACE,
// k_EHTTPMethodCONNECT
};
// HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions
// of each of these.
enum EHTTPStatusCode
{
// Invalid status code (this isn't defined in HTTP, used to indicate unset in our code)
k_EHTTPStatusCodeInvalid = 0,
// Informational codes
k_EHTTPStatusCode100Continue = 100,
k_EHTTPStatusCode101SwitchingProtocols = 101,
// Success codes
k_EHTTPStatusCode200OK = 200,
k_EHTTPStatusCode201Created = 201,
k_EHTTPStatusCode202Accepted = 202,
k_EHTTPStatusCode203NonAuthoritative = 203,
k_EHTTPStatusCode204NoContent = 204,
k_EHTTPStatusCode205ResetContent = 205,
k_EHTTPStatusCode206PartialContent = 206,
// Redirection codes
k_EHTTPStatusCode300MultipleChoices = 300,
k_EHTTPStatusCode301MovedPermanently = 301,
k_EHTTPStatusCode302Found = 302,
k_EHTTPStatusCode303SeeOther = 303,
k_EHTTPStatusCode304NotModified = 304,
k_EHTTPStatusCode305UseProxy = 305,
//k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1)
k_EHTTPStatusCode307TemporaryRedirect = 307,
// Error codes
k_EHTTPStatusCode400BadRequest = 400,
k_EHTTPStatusCode401Unauthorized = 401, // You probably want 403 or something else. 401 implies you're sending a WWW-Authenticate header and the client can sent an Authorization header in response.
k_EHTTPStatusCode402PaymentRequired = 402, // This is reserved for future HTTP specs, not really supported by clients
k_EHTTPStatusCode403Forbidden = 403,
k_EHTTPStatusCode404NotFound = 404,
k_EHTTPStatusCode405MethodNotAllowed = 405,
k_EHTTPStatusCode406NotAcceptable = 406,
k_EHTTPStatusCode407ProxyAuthRequired = 407,
k_EHTTPStatusCode408RequestTimeout = 408,
k_EHTTPStatusCode409Conflict = 409,
k_EHTTPStatusCode410Gone = 410,
k_EHTTPStatusCode411LengthRequired = 411,
k_EHTTPStatusCode412PreconditionFailed = 412,
k_EHTTPStatusCode413RequestEntityTooLarge = 413,
k_EHTTPStatusCode414RequestURITooLong = 414,
k_EHTTPStatusCode415UnsupportedMediaType = 415,
k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416,
k_EHTTPStatusCode417ExpectationFailed = 417,
k_EHTTPStatusCode4xxUnknown = 418, // 418 is reserved, so we'll use it to mean unknown
k_EHTTPStatusCode429TooManyRequests = 429,
// Server error codes
k_EHTTPStatusCode500InternalServerError = 500,
k_EHTTPStatusCode501NotImplemented = 501,
k_EHTTPStatusCode502BadGateway = 502,
k_EHTTPStatusCode503ServiceUnavailable = 503,
k_EHTTPStatusCode504GatewayTimeout = 504,
k_EHTTPStatusCode505HTTPVersionNotSupported = 505,
k_EHTTPStatusCode5xxUnknown = 599,
};
#endif // STEAMHTTPENUMS_H

View File

@ -1,3 +1,9 @@
//========= Copyright <20> 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose:
//
//=============================================================================
#ifndef STEAMTYPES_H
#define STEAMTYPES_H
#ifdef _WIN32
@ -6,6 +12,7 @@
#define S_CALLTYPE __cdecl
// Steam-specific types. Defined here so this header file can be included in other code bases.
#ifndef WCHARTYPES_H
typedef unsigned char uint8;
#endif
@ -21,6 +28,7 @@ typedef unsigned char uint8;
#define X64BITS
#endif
// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code.
#if !defined(VALVE_BIG_ENDIAN) && defined(_PS3)
#define VALVE_BIG_ENDIAN
#endif
@ -41,14 +49,14 @@ typedef int64 lint64;
typedef uint64 ulint64;
#ifdef X64BITS
typedef __int64 intp;
typedef unsigned __int64 uintp;
typedef __int64 intp; // intp is an integer that can accomodate a pointer
typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
#else
typedef __int32 intp;
typedef unsigned __int32 uintp;
#endif
#else
#else // _WIN32
typedef short int16;
typedef unsigned short uint16;
@ -57,6 +65,12 @@ 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;
@ -68,9 +82,9 @@ typedef int intp;
typedef unsigned int uintp;
#endif
#endif
#endif // else _WIN32
#ifdef __clang__
#ifdef API_GEN
# define CLANG_ATTR(ATTR) __attribute__((annotate( ATTR )))
#else
# define CLANG_ATTR(ATTR)
@ -79,6 +93,7 @@ typedef unsigned int uintp;
#define METHOD_DESC(DESC) CLANG_ATTR( "desc:" #DESC ";" )
#define IGNOREATTR() CLANG_ATTR( "ignore" )
#define OUT_STRUCT() CLANG_ATTR( "out_struct: ;" )
#define OUT_STRING() CLANG_ATTR( "out_string: ;" )
#define OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" )
#define OUT_ARRAY_COUNT(COUNTER, DESC) CLANG_ATTR( "out_array_count:" #COUNTER ";desc:" #DESC )
#define ARRAY_COUNT(COUNTER) CLANG_ATTR( "array_count:" #COUNTER ";" )
@ -87,23 +102,33 @@ typedef unsigned int uintp;
#define OUT_BUFFER_COUNT(COUNTER) CLANG_ATTR( "out_buffer_count:" #COUNTER ";" )
#define OUT_STRING_COUNT(COUNTER) CLANG_ATTR( "out_string_count:" #COUNTER ";" )
#define DESC(DESC) CLANG_ATTR("desc:" #DESC ";")
#define CALL_RESULT(RESULT_TYPE) CLANG_ATTR("callresult:" #RESULT_TYPE ";")
#define CALL_BACK(RESULT_TYPE) CLANG_ATTR("callback:" #RESULT_TYPE ";")
const int k_cubSaltSize = 8;
typedef uint8 Salt_t[k_cubSaltSize];
//-----------------------------------------------------------------------------
// GID (GlobalID) stuff
// This is a globally unique identifier. It's guaranteed to be unique across all
// racks and servers for as long as a given universe persists.
//-----------------------------------------------------------------------------
// NOTE: for GID parsing/rendering and other utils, see gid.h
typedef uint64 GID_t;
const GID_t k_GIDNil = 0xffffffffffffffffull;
typedef uint64 JobID_t;
typedef GID_t TxnID_t;
// For convenience, we define a number of types that are just new names for GIDs
typedef uint64 JobID_t; // Each Job has a unique ID
typedef GID_t TxnID_t; // Each financial transaction has a unique ID
const GID_t k_TxnIDNil = k_GIDNil;
const GID_t k_TxnIDUnknown = 0;
const JobID_t k_JobIDNil = 0xffffffffffffffffull;
// this is baked into client messages and interfaces as an int,
// make sure we never break this.
typedef uint32 PackageId_t;
const PackageId_t k_uPackageIdFreeSub = 0x0;
const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;
@ -111,6 +136,8 @@ const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;
typedef uint32 BundleId_t;
const BundleId_t k_uBundleIdInvalid = 0;
// this is baked into client messages and interfaces as an int,
// make sure we never break this.
typedef uint32 AppId_t;
const AppId_t k_uAppIdInvalid = 0x0;
@ -121,14 +148,22 @@ typedef uint32 PhysicalItemId_t;
const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0;
// this is baked into client messages and interfaces as an int,
// make sure we never break this. AppIds and DepotIDs also presently
// share the same namespace, but since we'd like to change that in the future
// I've defined it seperately here.
typedef uint32 DepotId_t;
const DepotId_t k_uDepotIdInvalid = 0x0;
// RTime32
// We use this 32 bit time representing real world time.
// It offers 1 second resolution beginning on January 1, 1970 (Unix time)
typedef uint32 RTime32;
typedef uint32 CellID_t;
const CellID_t k_uCellIDInvalid = 0xFFFFFFFF;
// handle to a Steam API call
typedef uint64 SteamAPICall_t;
const SteamAPICall_t k_uAPICallInvalid = 0x0;
@ -137,9 +172,10 @@ typedef uint32 AccountID_t;
typedef uint32 PartnerId_t;
const PartnerId_t k_uPartnerIdInvalid = 0;
// ID for a depot content manifest
typedef uint64 ManifestId_t;
const ManifestId_t k_uManifestIdInvalid = 0;
#endif
#endif // STEAMTYPES_H

View File

@ -0,0 +1,27 @@
//========= Copyright <20> 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

121
SpyCustom/sdk/tokenset.h Normal file
View File

@ -0,0 +1,121 @@
//========= Copyright © 2008, Valve Corporation, All rights reserved. ============//
#ifndef __TOKENSET_H
#define __TOKENSET_H
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
//
// This class is a handy way to match a series of values to stings and vice
// versa. It should be initalized as static like an array, for example:
//
// const tokenset_t<int> tokens[] = {
// { "token1", 1 },
// { "token2", 2 },
// { "token3", 3 },
// { NULL, -1 }
// };
//
// Then you can call the operators on it by using:
//
// int t = tokens->GetToken( s );
//
// If s is "token1" it returns 1, etc. Invalid string returns the last NULL
// value. GetNameByToken() returns "__UNKNOWN__" when passed a mismatched
// token. GetNameByToken() returns szMismatchResult when passed a mismatched
// token and a string to return in case of mismatch.
//
//-----------------------------------------------------------------------------
template <class _T>
struct tokenset_t
{
const char *name;
_T token;
_T GetToken( const char *s ) const;
_T GetTokenI( const char *s ) const;
const char *GetNameByToken( _T token ) const;
const char *GetNameByToken( _T token, const char *szMismatchResult ) const;
};
template <class _T>
inline _T tokenset_t< _T >::GetToken( const char *s ) const
{
const tokenset_t< _T > *c;
for ( c = this; c->name; ++c )
{
if ( !s )
{
continue; // Loop to the last NULL value
}
if ( Q_strcmp( s, c->name ) == 0 )
{
return c->token;
}
}
return c->token; // c points to the last NULL value
}
template <class _T>
inline _T tokenset_t< _T >::GetTokenI( const char *s ) const
{
const tokenset_t< _T > *c;
for ( c = this; c->name; ++c )
{
if ( !s )
{
continue; // Loop to the last NULL value
}
if ( Q_stricmp( s, c->name ) == 0 )
{
return c->token;
}
}
return c->token; // c points to the last NULL value
}
template <class _T>
inline const char *tokenset_t< _T >::GetNameByToken( _T token ) const
{
static const char *unknown = "__UNKNOWN__";
const tokenset_t< _T > *c;
for ( c = this; c->name; ++c )
{
if ( c->token == token )
{
return c->name;
}
}
return unknown;
}
template <class _T>
inline const char *tokenset_t< _T >::GetNameByToken( _T token, char const *szMismatchResult ) const
{
const tokenset_t< _T > *c;
for ( c = this; c->name; ++c )
{
if ( c->token == token )
{
return c->name;
}
}
return szMismatchResult;
}
#endif //__TOKENSET_H

View File

@ -0,0 +1,97 @@
//========== Copyright (c) Valve Corporation, All rights reserved. ==========//
//
// Purpose: A header describing use of the delegate system. It's hiding
// the highly complex implementation details of the delegate system
//
// $NoKeywords: $
//
//===========================================================================//
#ifndef UTLDELEGATE_H
#define UTLDELEGATE_H
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
// The delegate system: A method of invoking methods, whether they are
// member methods of classes, static methods of classes, or free functions,
// dealing with all the nastiness in differences between how the calls have
// to happen yet works in a highly optimal fashion. For details, see
//
// http://www.codeproject.com/cpp/FastDelegate.asp
//
// The delegate design pattern is described here
//
// http://en.wikipedia.org/wiki/Delegation_(programming)
//-----------------------------------------------------------------------------
#ifdef UTLDELEGATE_USAGE_DEMONSTRATION
//-----------------------------------------------------------------------------
// Here, we show how to use this system (the ifdef UTLDELEGATE_USAGE_DEMONSTRATION is used to get syntax coloring).
//-----------------------------------------------------------------------------
// First, define the functions you wish to call.
int Test1( char *pString, float x );
class CTestClass
{
public:
void Test2();
static float Test3( int x );
};
void Test()
{
CTestClass testClass;
// CUtlDelegate is a class that can be used to invoke methods of classes
// or static functions in a highly efficient manner.
// There are a couple ways to hook up a delegate. One is in a constructor
// Note that the template parameter of CUtlFastDelegate looks like the
// function type: first, you have the return type, then ( parameter list )
CUtlDelegate< int ( char *, float ) > delegate1( &Test1 );
// Another way is to use the UtlMakeDelegate method, allowing you to
// define the delegate later. Note that UtlMakeDelegate does *not* do a heap allocation
CUtlDelegate< void () > delegate2;
delegate2 = UtlMakeDelegate( &testClass, &CTestClass::Test2 );
// A third method is to use the Bind() method of CUtlFastDelegate
// Note that you do not pass in the class pointer for static functions
CUtlDelegate< float ( int ) > delegate3;
delegate3.Bind( &CTestClass::Test3 );
// Use the () operator to invoke the function calls.
int x = delegate1( "hello", 1.0f );
delegate2();
float y = delegate3( 5 );
// Use the Clear() method to unbind a delegate.
delegate1.Clear();
// You can use operator! or IsEmpty() to see if a delegate is bound
if ( !delegate1.IsEmpty() )
{
delegate1( "hello2" );
}
// Delegates maintain an internal non-templatized representation of the
// functions they are bound to called CUtlAbstractDelegate. These are
// useful when keeping a list of untyped delegates or when passing
// delegates across interface boundaries.
const CUtlAbstractDelegate &abstractDelegate3 = delegate3.GetAbstractDelegate();
CUtlDelegate< float ( int ) > delegate4;
delegate4.SetAbstractDelegate( abstractDelegate3 );
delegate4( 10 );
}
#endif // UTLDELEGATE_USAGE_DEMONSTRATION
// Looking in this file may cause blindness.
// #include "tier1/utldelegateimpl.h"
#endif // UTLDELEGATE_H

View File

@ -0,0 +1,139 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef VGUITEXTWINDOW_H
#define VGUITEXTWINDOW_H
#ifdef _WIN32
#pragma once
#endif
#include "Frame.h"
#include "Button.h"
#include "HTML.h"
#include "iviewport.h"
#include "shareddefs.h"
#include "GameEventListener.h"
namespace vgui
{
class TextEntry;
}
enum
{
FADE_STATUS_IN = 0,
FADE_STATUS_HOLD,
FADE_STATUS_OUT,
FADE_STATUS_OFF
};
//-----------------------------------------------------------------------------
// Purpose: displays the MOTD
//-----------------------------------------------------------------------------
class CTextWindow : public vgui::Frame, public IViewPortPanel, public CGameEventListener
{
private:
DECLARE_CLASS_SIMPLE( CTextWindow, vgui::Frame );
public:
CTextWindow(IViewPort *pViewPort);
virtual ~CTextWindow();
virtual const char *GetName( void ) { return PANEL_INFO; }
virtual void SetData(KeyValues *data);
virtual void Reset();
virtual void Update();
// virtual void UpdateContents( void );
virtual bool NeedsUpdate( void ) { return false; }
virtual bool HasInputElements( void ) { return true; }
virtual void ShowPanel( bool bShow );
void ShowPanel2( bool bShow );
bool HasMotd();
virtual void PaintBackground();
// both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
virtual bool IsVisible() { return BaseClass::IsVisible(); }
virtual void SetParent( vgui::VPANEL parent ) { BaseClass::SetParent( parent ); }
virtual void FireGameEvent( IGameEvent *event ) { return; };
virtual bool WantsBackgroundBlurred( void ) { return false; };
public:
//=============================================================================
// HPE_BEGIN:
// [Forrest] Replaced text window command string with TEXTWINDOW_CMD enumeration
// of options. Passing a command string is dangerous and allowed a server network
// message to run arbitrary commands on the client.
//=============================================================================
virtual void SetData( int type, const char *title, const char *message, const char *message_fallback, int command );
//=============================================================================
// HPE_END
//=============================================================================
virtual void ShowFile( const char *filename );
virtual void ShowText( const char *text );
virtual void ShowURL( const char *URL, bool bAllowUserToDisable = true );
virtual void ShowIndex( const char *entry );
virtual void ShowHtmlString( const char *entry );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
protected:
// vgui overrides
virtual void OnCommand( const char *command );
virtual void OnKeyCodePressed( vgui::KeyCode code );
int GetNumSecondsRequiredByServer() const;
int GetNumSecondsSponsorRequiredRemaining() const;
bool m_bHasMotd;
IViewPort *m_pViewPort;
char m_szTitle[255];
char m_szMessage[2048];
char m_szMessageFallback[2048];
//=============================================================================
// HPE_BEGIN:
// [Forrest] Replaced text window command string with TEXTWINDOW_CMD enumeration
// of options. Passing a command string is dangerous and allowed a server network
// message to run arbitrary commands on the client.
//=============================================================================
int m_nExitCommand;
double m_dblTimeExecutedExitCommand;
//=============================================================================
// HPE_END
//=============================================================================
int m_nContentType;
vgui::TextEntry *m_pTextMessage;
class CMOTDHTML : public vgui::HTML
{
private:
DECLARE_CLASS_SIMPLE( CMOTDHTML, vgui::HTML );
public:
CMOTDHTML( Panel *parent, const char *pchName ) : vgui::HTML( parent, pchName ) {}
virtual bool OnStartRequest( const char *url, const char *target, const char *pchPostData, bool bIsRedirect );
};
CMOTDHTML *m_pHTMLMessage;
vgui::Button *m_pOK;
vgui::Label *m_pTitleLabel;
vgui::Label *m_pInfoLabelTicker;
uint32 m_uiTimestampStarted, m_uiTimestampInfoLabelUpdated;
bool m_bForcingWindowCloseRegardlessOfTime;
};
#endif // VGUITEXTWINDOW_H

View File

@ -0,0 +1,45 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef VIEWPORT_PANEL_NAMES_H
#define VIEWPORT_PANEL_NAMES_H
#ifdef _WIN32
#pragma once
#endif
// default panel name definitions
#define PANEL_ALL "all" // all current panels
#define PANEL_ACTIVE "active" // current active panel
#define PANEL_SCOREBOARD "scores"
#define PANEL_PLAYERDETAILS "playerdetails"
#define PANEL_OVERVIEW "overview"
#define PANEL_CLASS "class"
#define PANEL_TEAM "team"
#define PANEL_SPECGUI "specgui" // passive spectator elements (top/bottom bars)
#define PANEL_SPECMENU "specmenu" // active spectator elements (options menus etc)
#define PANEL_INFO "info"
#define PANEL_BUY "buy"
#define PANEL_BUY_CT "buy_ct"
#define PANEL_BUY_TER "buy_ter"
#define PANEL_BUY_EQUIP_CT "buyequip_ct"
#define PANEL_BUY_EQUIP_TER "buyequip_ter"
#define PANEL_NAV_PROGRESS "nav_progress"
#define PANEL_BUYPRESET_MAIN "buypreset_main"
#define PANEL_BUYPRESET_EDIT "buypreset_edit"
#define PANEL_INTRO "intro"
#define PANEL_COMMENTARY_MODELVIEWER "commentary_modelviewer"
#define PANEL_SURVEY "surveypanel"
#ifdef PORTAL2
#define PANEL_RADIAL_MENU "radialmenupanel"
#endif // PORTAL2
#endif // VIEWPORT_PANEL_NAMES_H

42
SpyCustom/sdk/worldsize.h Normal file
View File

@ -0,0 +1,42 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// worldsize.h -- extent of world and resolution/size of coordinate messages used in engine
#ifndef WORLDSIZE_H
#define WORLDSIZE_H
#pragma once
// These definitions must match the coordinate message sizes in coordsize.h
// Following values should be +16384, -16384, +15/16, -15/16
// NOTE THAT IF THIS GOES ANY BIGGER THEN DISK NODES/LEAVES CANNOT USE SHORTS TO STORE THE BOUNDS
#define MAX_COORD_INTEGER (16384)
#define MIN_COORD_INTEGER (-MAX_COORD_INTEGER)
#define MAX_COORD_FRACTION (1.0-(1.0/16.0))
#define MIN_COORD_FRACTION (-1.0+(1.0/16.0))
#define MAX_COORD_FLOAT (16384.0f)
#define MIN_COORD_FLOAT (-MAX_COORD_FLOAT)
// Width of the coord system, which is TOO BIG to send as a client/server coordinate value
#define COORD_EXTENT (2*MAX_COORD_INTEGER)
// Maximum traceable distance ( assumes cubic world and trace from one corner to opposite )
// COORD_EXTENT * sqrt(3)
#define MAX_TRACE_LENGTH ( 1.732050807569 * COORD_EXTENT )
// This value is the LONGEST possible range (limited by max valid coordinate number, not 2x)
#define MAX_COORD_RANGE (MAX_COORD_INTEGER)
#define ASSERT_COORD( v ) Assert( (v.x>=MIN_COORD_INTEGER*2) && (v.x<=MAX_COORD_INTEGER*2) && \
(v.y>=MIN_COORD_INTEGER*2) && (v.y<=MAX_COORD_INTEGER*2) && \
(v.z>=MIN_COORD_INTEGER*2) && (v.z<=MAX_COORD_INTEGER*2) ); \
#endif // WORLDSIZE_H