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.

72 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #include <vgui_controls/Controls.h>
  8. #include <locale.h>
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. extern int g_nYou_Must_Add_Public_Vgui_Controls_Vgui_ControlsCpp_To_Your_Project;
  12. namespace vgui
  13. {
  14. static char g_szControlsModuleName[256];
  15. //-----------------------------------------------------------------------------
  16. // Purpose: Initializes the controls
  17. //-----------------------------------------------------------------------------
  18. extern "C" { extern int _heapmin(); }
  19. bool VGui_InitInterfacesList( const char *moduleName, CreateInterfaceFn *factoryList, int numFactories )
  20. {
  21. g_nYou_Must_Add_Public_Vgui_Controls_Vgui_ControlsCpp_To_Your_Project = 1;
  22. // If you hit this error, then you need to include memoverride.cpp in the project somewhere or else
  23. // you'll get crashes later when vgui_controls allocates KeyValues and vgui tries to delete them.
  24. #if !defined(NO_MALLOC_OVERRIDE) && defined( WIN32 )
  25. if ( _heapmin() != 1 )
  26. {
  27. Assert( false );
  28. Error( "Must include memoverride.cpp in your project." );
  29. }
  30. #endif
  31. // keep a record of this module name
  32. strncpy(g_szControlsModuleName, moduleName, sizeof(g_szControlsModuleName));
  33. g_szControlsModuleName[sizeof(g_szControlsModuleName) - 1] = 0;
  34. // initialize our locale (must be done for every vgui dll/exe)
  35. // "" makes it use the default locale, required to make iswprint() work correctly in different languages
  36. setlocale(LC_CTYPE, "");
  37. setlocale(LC_TIME, "");
  38. setlocale(LC_COLLATE, "");
  39. setlocale(LC_MONETARY, "");
  40. // NOTE: Vgui expects to use these interfaces which are defined in tier3.lib
  41. if ( !g_pVGui || !g_pVGuiInput || !g_pVGuiPanel ||
  42. !g_pVGuiSurface || !g_pVGuiSchemeManager || !g_pVGuiSystem )
  43. {
  44. Warning( "vgui_controls is missing a required interface!\n" );
  45. return false;
  46. }
  47. return true;
  48. }
  49. //-----------------------------------------------------------------------------
  50. // Purpose: returns the name of the module this has been compiled into
  51. //-----------------------------------------------------------------------------
  52. const char *GetControlsModuleName()
  53. {
  54. return g_szControlsModuleName;
  55. }
  56. } // namespace vgui