Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.5 KiB

  1. //====== Copyright �, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: interface to the game coordinator for this application
  4. //
  5. //=============================================================================
  6. #ifndef ISTEAMGAMECOORDINATOR
  7. #define ISTEAMGAMECOORDINATOR
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "steamtypes.h"
  12. #include "steamclientpublic.h"
  13. // list of possible return values from the ISteamGameCoordinator API
  14. enum EGCResults
  15. {
  16. k_EGCResultOK = 0,
  17. k_EGCResultNoMessage = 1, // There is no message in the queue
  18. k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message
  19. k_EGCResultNotLoggedOn = 3, // The client is not logged onto Steam
  20. k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage
  21. };
  22. //-----------------------------------------------------------------------------
  23. // Purpose: Functions for sending and receiving messages from the Game Coordinator
  24. // for this application
  25. //-----------------------------------------------------------------------------
  26. class ISteamGameCoordinator
  27. {
  28. public:
  29. // sends a message to the Game Coordinator
  30. virtual EGCResults SendMessage( uint32 unMsgType, const void *pubData, uint32 cubData ) = 0;
  31. // returns true if there is a message waiting from the game coordinator
  32. virtual bool IsMessageAvailable( uint32 *pcubMsgSize ) = 0;
  33. // fills the provided buffer with the first message in the queue and returns k_EGCResultOK or
  34. // returns k_EGCResultNoMessage if there is no message waiting. pcubMsgSize is filled with the message size.
  35. // If the provided buffer is not large enough to fit the entire message, k_EGCResultBufferTooSmall is returned
  36. // and the message remains at the head of the queue.
  37. virtual EGCResults RetrieveMessage( uint32 *punMsgType, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
  38. };
  39. #define STEAMGAMECOORDINATOR_INTERFACE_VERSION "SteamGameCoordinator001"
  40. // callbacks
  41. #if defined( VALVE_CALLBACK_PACK_SMALL )
  42. #pragma pack( push, 4 )
  43. #elif defined( VALVE_CALLBACK_PACK_LARGE )
  44. #pragma pack( push, 8 )
  45. #else
  46. #error isteamclient.h must be included
  47. #endif
  48. // callback notification - A new message is available for reading from the message queue
  49. struct GCMessageAvailable_t
  50. {
  51. enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 1 };
  52. uint32 m_nMessageSize;
  53. };
  54. // callback notification - A message failed to make it to the GC. It may be down temporarily
  55. struct GCMessageFailed_t
  56. {
  57. enum { k_iCallback = k_iSteamGameCoordinatorCallbacks + 2 };
  58. };
  59. #pragma pack( pop )
  60. #endif // ISTEAMGAMECOORDINATOR