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.

89 lines
2.1 KiB

  1. //=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
  2. //
  3. // The copyright to the contents herein is the property of Valve, L.L.C.
  4. // The contents may be used and/or copied only with the written permission of
  5. // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
  6. // the agreement/contract under which the contents have been supplied.
  7. //
  8. // $Header: $
  9. // $NoKeywords: $
  10. //
  11. // The application object for apps that use tier2
  12. //=============================================================================
  13. #ifndef TIER2APP_H
  14. #define TIER2APP_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. #include "appframework/AppFramework.h"
  19. #include "tier2/tier2dm.h"
  20. #include "tier1/convar.h"
  21. //-----------------------------------------------------------------------------
  22. // The application object for apps that use tier2
  23. //-----------------------------------------------------------------------------
  24. class CTier2SteamApp : public CSteamAppSystemGroup
  25. {
  26. typedef CSteamAppSystemGroup BaseClass;
  27. public:
  28. // Methods of IApplication
  29. virtual bool PreInit()
  30. {
  31. CreateInterfaceFn factory = GetFactory();
  32. ConnectTier1Libraries( &factory, 1 );
  33. ConVar_Register( 0 );
  34. ConnectTier2Libraries( &factory, 1 );
  35. return true;
  36. }
  37. virtual void PostShutdown()
  38. {
  39. DisconnectTier2Libraries();
  40. ConVar_Unregister();
  41. DisconnectTier1Libraries();
  42. }
  43. virtual void Destroy()
  44. {
  45. }
  46. };
  47. //-----------------------------------------------------------------------------
  48. // The application object for apps that use tier2 and datamodel
  49. //-----------------------------------------------------------------------------
  50. class CTier2DmSteamApp : public CTier2SteamApp
  51. {
  52. typedef CTier2SteamApp BaseClass;
  53. public:
  54. // Methods of IApplication
  55. virtual bool PreInit()
  56. {
  57. if ( !BaseClass::PreInit() )
  58. return false;
  59. CreateInterfaceFn factory = GetFactory();
  60. if ( !ConnectDataModel( factory ) )
  61. return false;
  62. InitReturnVal_t nRetVal = InitDataModel();
  63. return ( nRetVal == INIT_OK );
  64. }
  65. virtual void PostShutdown()
  66. {
  67. ShutdownDataModel();
  68. DisconnectDataModel();
  69. BaseClass::PostShutdown();
  70. }
  71. };
  72. #endif // TIER2APP_H