version.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "platform/platform.h"
  23. #include "app/version.h"
  24. #include "console/console.h"
  25. static const U32 csgVersionNumber = TORQUE_GAME_ENGINE;
  26. U32 getVersionNumber()
  27. {
  28. return csgVersionNumber;
  29. }
  30. const char* getVersionString()
  31. {
  32. return TORQUE_GAME_ENGINE_VERSION_STRING;
  33. }
  34. /// TGE 0001
  35. /// TGEA 0002
  36. /// TGB 0003
  37. /// TGEA 360 0004
  38. /// TGE WII 0005
  39. /// Torque 3D 0006
  40. const char* getEngineProductString()
  41. {
  42. #ifndef TORQUE_ENGINE_PRODUCT
  43. return "Torque Engine";
  44. #else
  45. switch (TORQUE_ENGINE_PRODUCT)
  46. {
  47. case 0001:
  48. return "Torque Game Engine";
  49. case 0002:
  50. return "Torque Game Engine Advanced";
  51. case 0003:
  52. return "Torque 2D";
  53. case 0004:
  54. return "Torque 360";
  55. case 0005:
  56. return "Torque for Wii";
  57. case 0006:
  58. return "Torque 3D";
  59. default:
  60. return "Torque Engine";
  61. };
  62. #endif
  63. }
  64. const char* getCompileTimeString()
  65. {
  66. return __DATE__ " at " __TIME__;
  67. }
  68. //----------------------------------------------------------------
  69. ConsoleFunctionGroupBegin( CompileInformation, "Functions to get version information about the current executable." );
  70. ConsoleFunction( getVersionNumber, S32, 1, 1, "Get the version of the build, as a string.\n\n"
  71. "@ingroup Debugging")
  72. {
  73. return getVersionNumber();
  74. }
  75. ConsoleFunction( getVersionString, const char*, 1, 1, "Get the version of the build, as a string.\n\n"
  76. "@ingroup Debugging")
  77. {
  78. return getVersionString();
  79. }
  80. ConsoleFunction( getEngineName, const char*, 1, 1, "Get the name of the engine product that this is running from, as a string.\n\n"
  81. "@ingroup Debugging")
  82. {
  83. return getEngineProductString();
  84. }
  85. ConsoleFunction( getCompileTimeString, const char*, 1, 1, "Get the time of compilation.\n\n"
  86. "@ingroup Debugging")
  87. {
  88. return getCompileTimeString();
  89. }
  90. ConsoleFunction( getBuildString, const char*, 1, 1, "Get the type of build, \"Debug\" or \"Release\".\n\n"
  91. "@ingroup Debugging")
  92. {
  93. #ifdef TORQUE_DEBUG
  94. return "Debug";
  95. #else
  96. return "Release";
  97. #endif
  98. }
  99. ConsoleFunctionGroupEnd( CompileInformation );
  100. ConsoleFunction(isDemo, bool, 1, 1, "")
  101. {
  102. #ifdef TORQUE_DEMO
  103. return true;
  104. #else
  105. return false;
  106. #endif
  107. }
  108. ConsoleFunction(isWebDemo, bool, 1, 1, "")
  109. {
  110. #ifdef TORQUE_DEMO
  111. return Platform::getWebDeployment();
  112. #else
  113. return false;
  114. #endif
  115. }