AUD_Assert.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*****************************************************************************
  19. ** **
  20. ** Westwood Studios Pacific. **
  21. ** **
  22. ** Confidential Information **
  23. ** Copyright (C) 2000 - All Rights Reserved **
  24. ** **
  25. ******************************************************************************
  26. ** **
  27. ** Project: Dune Emperor **
  28. ** **
  29. ** Module: <module> (<prefix>_) **
  30. ** **
  31. ** Version: $ID$ **
  32. ** **
  33. ** File name: audassrt.cpp **
  34. ** **
  35. ** Created by: 12/??/00 TR **
  36. ** **
  37. ** Description: <description> **
  38. ** **
  39. *****************************************************************************/
  40. /*****************************************************************************
  41. ** Includes **
  42. *****************************************************************************/
  43. #include <string.h>
  44. #include <stdarg.h>
  45. #include <assert.h>
  46. //#include <windows.h>
  47. #include <stdio.h>
  48. #include <time.h>
  49. #include <stdarg.h>
  50. #include <wpaudio/altypes.h>
  51. /*****************************************************************************
  52. ** Externals **
  53. *****************************************************************************/
  54. extern void WindowsDebugPrint( const char * lpOutputString );
  55. /*****************************************************************************
  56. ** Defines **
  57. *****************************************************************************/
  58. /*****************************************************************************
  59. ** Private Types **
  60. *****************************************************************************/
  61. /*****************************************************************************
  62. ** Private Data **
  63. *****************************************************************************/
  64. char *DBG_type_struct_is_dead = "Invalid structure";
  65. char assert_msg_buf[10*1024];
  66. static FILE *err_file = NULL;
  67. static int total_errors;
  68. static char _msg_buf[sizeof(assert_msg_buf)*2];
  69. /*****************************************************************************
  70. ** Public Data **
  71. *****************************************************************************/
  72. /*****************************************************************************
  73. ** Private Prototypes **
  74. *****************************************************************************/
  75. /*****************************************************************************
  76. ** Private Functions **
  77. *****************************************************************************/
  78. #ifdef _DEBUG
  79. /******************************************************************/
  80. /* */
  81. /* */
  82. /******************************************************************/
  83. void __cdecl _assert_printf ( const char *format, ...)
  84. {
  85. va_list args;
  86. va_start( args, format ); /* Initialize variable arguments. */
  87. vsprintf ( assert_msg_buf, format, args );
  88. va_end( args );
  89. }
  90. /******************************************************************/
  91. /* */
  92. /* */
  93. /******************************************************************/
  94. void __cdecl _aud_debug_printf ( const char *format, ...)
  95. {
  96. va_list args;
  97. va_start( args, format ); /* Initialize variable arguments. */
  98. vsprintf ( _msg_buf, format, args );
  99. va_end( args );
  100. WindowsDebugPrint ( _msg_buf );
  101. }
  102. /******************************************************************/
  103. /* */
  104. /* */
  105. /******************************************************************/
  106. void _aud_assert ( const char *, const char *file, int line, const char *reason )
  107. {
  108. sprintf ( _msg_buf, "%s(%d) : Error : ASSERT - %s\n", file, line, reason );
  109. WindowsDebugPrint ( _msg_buf );
  110. _assert ( _msg_buf, (void *) file, line );
  111. }
  112. #endif
  113. /*****************************************************************************
  114. ** Public Functions **
  115. *****************************************************************************/