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.

67 lines
1.4 KiB

  1. //========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Steam API context hooks
  4. //
  5. #include "mm_framework.h"
  6. #include "memdbgon.h"
  7. #if !defined( _X360 ) && !defined( NO_STEAM ) && !defined( SWDS )
  8. // Context for the Game Coordinator
  9. #ifndef NO_STEAM_GAMECOORDINATOR
  10. static GCSDK::CGCClient g_GCClient;
  11. GCSDK::CGCClient *GGCClient()
  12. {
  13. return &g_GCClient;
  14. }
  15. #endif
  16. static CSteamAPIContext g_SteamAPIContext;
  17. CSteamAPIContext *steamapicontext = &g_SteamAPIContext;
  18. // Init the steam APIs
  19. void SteamApiContext_Init()
  20. {
  21. #ifndef _PS3
  22. if ( !SteamAPI_InitSafe() )
  23. return;
  24. #endif
  25. if ( !steamapicontext->Init() )
  26. return;
  27. #if !defined( _DEMO ) && !defined( NO_STEAM_GAMECOORDINATOR )
  28. if ( SteamClient() )
  29. {
  30. ISteamGameCoordinator *pGCInterface =
  31. (ISteamGameCoordinator*)SteamClient()->GetISteamGenericInterface( SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), STEAMGAMECOORDINATOR_INTERFACE_VERSION );
  32. GGCClient()->BInit( pGCInterface );
  33. }
  34. #endif
  35. }
  36. // Shut down the steam APIs
  37. void SteamApiContext_Shutdown()
  38. {
  39. steamapicontext->Clear();
  40. // SteamAPI_Shutdown(); << Steam shutdown is controlled by engine
  41. #ifndef NO_STEAM_GAMECOORDINATOR
  42. GGCClient()->Uninit();
  43. GCSDK::UninitTempTextBuffers();
  44. #endif
  45. }
  46. #else
  47. class CSteamAPIContext *steamapicontext = NULL;
  48. void SteamApiContext_Init()
  49. {
  50. }
  51. void SteamApiContext_Shutdown()
  52. {
  53. }
  54. #endif