x86UNIXMain.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 "platform/platformInput.h"
  24. #include "console/console.h"
  25. #include "platformX86UNIX/platformX86UNIX.h"
  26. #include "platformX86UNIX/x86UNIXStdConsole.h"
  27. #include "platformX86UNIX/x86UNIXState.h"
  28. extern void InitWindowingSystem();
  29. //------------------------------------------------------------------------------
  30. void Platform::init()
  31. {
  32. StdConsole::create();
  33. stdConsole->enable(true);
  34. // init process control stuff
  35. ProcessControlInit();
  36. Con::printf("Initializing platform...");
  37. // Set the platform variable for the scripts
  38. Con::setVariable( "$platform", "x86UNIX" );
  39. #if defined(__linux__)
  40. Con::setVariable( "$platformUnixType", "Linux" );
  41. #elif defined(__OpenBSD__)
  42. Con::setVariable( "$platformUnixType", "OpenBSD" );
  43. #else
  44. Con::setVariable( "$platformUnixType", "Unknown" );
  45. #endif
  46. Input::init();
  47. //installRedBookDevices();
  48. #ifndef TORQUE_DEDICATED
  49. // if we're not dedicated do more initialization
  50. InitWindowingSystem();
  51. #endif
  52. }
  53. //------------------------------------------------------------------------------
  54. void Platform::shutdown()
  55. {
  56. Cleanup();
  57. }
  58. //------------------------------------------------------------------------------
  59. extern "C"
  60. {
  61. bool torque_engineinit(int argc, const char **argv);
  62. int torque_enginetick();
  63. S32 torque_getreturnstatus();
  64. bool torque_engineshutdown();
  65. int torque_unixmain(int argc, const char **argv)
  66. {
  67. if (!torque_engineinit(argc, argv))
  68. return 1;
  69. while(torque_enginetick())
  70. {
  71. }
  72. torque_engineshutdown();
  73. return torque_getreturnstatus();
  74. }
  75. }
  76. extern S32 TorqueMain(S32 argc, const char **argv);
  77. #if !defined(TORQUE_SHARED)
  78. int main(int argc, const char **argv)
  79. {
  80. return TorqueMain(argc, argv);
  81. }
  82. #endif