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.

114 lines
2.8 KiB

  1. //=========== Copyright Valve Corporation, All rights reserved. =============//
  2. //
  3. // Purpose: Common location for hard-coded knowledge about module
  4. // bundles, such as tier2_bundle and tier3_bundle.
  5. //
  6. //===========================================================================//
  7. #include "bundled_module_info.h"
  8. #include "tier0/icommandline.h"
  9. #include "tier1/strtools.h"
  10. static const char * const s_pTier2BundleModules[] =
  11. {
  12. "filesystem_stdio",
  13. "imemanager",
  14. "inputsystem",
  15. "localize",
  16. "materialsystem2",
  17. "networksystem",
  18. "resourcesystem",
  19. "schemasystem",
  20. "soundsystem",
  21. };
  22. static const char * const s_pTier3BundleModules[] =
  23. {
  24. "animationsystem",
  25. "meshsystem",
  26. "particles",
  27. "renderingpipelines",
  28. "scenesystem",
  29. "worldrenderer",
  30. };
  31. static bool FindBundledModuleName( const char *pCheck, const char * const *pTable, int nTable )
  32. {
  33. for ( int i = 0; i < nTable; i++ )
  34. {
  35. if ( V_stricmp_fast( pCheck, pTable[i] ) == 0 )
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. const char *RemapBundledModuleName( const char *pModuleName )
  43. {
  44. static bool s_bCheckedCmd;
  45. // Default to using bundles.
  46. static bool s_bNoTier2Bundle = true;
  47. static bool s_bNoTier3Bundle = true;
  48. static const char *s_pNoBundleModule;
  49. if ( !s_bCheckedCmd )
  50. {
  51. if ( Plat_GetEnv( "SOURCE2_USE_BUNDLES" ) != NULL )
  52. {
  53. s_bNoTier2Bundle = false;
  54. s_bNoTier3Bundle = false;
  55. }
  56. if ( Plat_GetEnv( "SOURCE2_NO_BUNDLES" ) != NULL )
  57. {
  58. s_bNoTier2Bundle = true;
  59. s_bNoTier3Bundle = true;
  60. }
  61. if ( CommandLine()->HasParm( "-use_tier2_bundle" ) )
  62. {
  63. s_bNoTier2Bundle = false;
  64. }
  65. if ( CommandLine()->HasParm( "-use_tier3_bundle" ) )
  66. {
  67. s_bNoTier3Bundle = false;
  68. }
  69. if ( CommandLine()->HasParm( "-no_tier2_bundle" ) )
  70. {
  71. s_bNoTier2Bundle = true;
  72. }
  73. if ( CommandLine()->HasParm( "-no_tier3_bundle" ) )
  74. {
  75. s_bNoTier3Bundle = true;
  76. }
  77. s_pNoBundleModule = CommandLine()->ParmValue( "-no_bundle_module", "" );
  78. s_bCheckedCmd = true;
  79. }
  80. if ( s_pNoBundleModule &&
  81. s_pNoBundleModule[0] &&
  82. V_stricmp_fast( pModuleName, s_pNoBundleModule ) == 0 )
  83. {
  84. return pModuleName;
  85. }
  86. if ( !s_bNoTier2Bundle &&
  87. FindBundledModuleName( pModuleName, s_pTier2BundleModules, ARRAYSIZE( s_pTier2BundleModules ) ) )
  88. {
  89. return "tier2_bundle";
  90. }
  91. if ( !s_bNoTier3Bundle &&
  92. FindBundledModuleName( pModuleName, s_pTier3BundleModules, ARRAYSIZE( s_pTier3BundleModules ) ) )
  93. {
  94. return "tier3_bundle";
  95. }
  96. return pModuleName;
  97. }