Team Fortress 2 Source Code as on 22/4/2020
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.

85 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, 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. };
  44. //-----------------------------------------------------------------------------
  45. // The application object for apps that use tier2 and datamodel
  46. //-----------------------------------------------------------------------------
  47. class CTier2DmSteamApp : public CTier2SteamApp
  48. {
  49. typedef CTier2SteamApp BaseClass;
  50. public:
  51. // Methods of IApplication
  52. virtual bool PreInit()
  53. {
  54. if ( !BaseClass::PreInit() )
  55. return false;
  56. CreateInterfaceFn factory = GetFactory();
  57. if ( !ConnectDataModel( factory ) )
  58. return false;
  59. InitReturnVal_t nRetVal = InitDataModel();
  60. return ( nRetVal == INIT_OK );
  61. }
  62. virtual void PostShutdown()
  63. {
  64. ShutdownDataModel();
  65. DisconnectDataModel();
  66. BaseClass::PostShutdown();
  67. }
  68. };
  69. #endif // TIER2APP_H