FS2_Open
Open source remastering of the Freespace 2 engine
stubs.cpp
Go to the documentation of this file.
1 
2 
3 
4 #ifdef SCP_UNIX
5 
6 #include <ctype.h>
7 #include <errno.h>
8 #include <fcntl.h>
9 #include <stdarg.h>
10 #include <sys/stat.h>
11 #include <sys/time.h>
12 #include <unistd.h>
13 
14 #include "SDL.h"
15 
16 #if defined(APPLE_APP)
17 #include <CoreFoundation/CoreFoundation.h>
18 #endif
19 
20 #if defined(HAVE_MALLOC_H)
21 #include <malloc.h>
22 #endif
23 
24 #include "cmdline/cmdline.h"
25 #include "debugconsole/console.h"
26 #include "globalincs/pstypes.h"
27 #include "parse/lua.h"
28 
29 bool env_enabled = false;
30 bool cell_enabled = false;
31 
32 int Global_warning_count = 0;
33 int Global_error_count = 0;
34 
35 #define MAX_BUF_SIZE 1024
36 static char buffer[MAX_BUF_SIZE], buffer_tmp[MAX_BUF_SIZE];
37 
38 #ifndef NDEBUG
39 #ifdef __APPLE__
40 #include <malloc/malloc.h>
41 #define MALLOC_USABLE(pointer) malloc_size(pointer)
42 #elif defined(SCP_SOLARIS)
43 #define MALLOC_USABLE(pointer) (*((size_t*)(pointer)-1))
44 #else
45 #ifdef SCP_BSD
46 #include <stdlib.h>
47 #include <malloc_np.h>
48 #endif
49 #define MALLOC_USABLE(pointer) malloc_usable_size(pointer)
50 #endif // __APPLE__
51 #endif // NDEBUG
52 
53 char *strnset( char* string, int fill, size_t count)
54 {
55  char *p = string;
56 
57  for(; *p; p++ ) {
58  if( count == 0 )
59  break;
60 
61  *p = (char)fill;
62  count--;
63  }
64 
65  return string;
66 }
67 
68 // find the size of a file
69 int filelength(int fd)
70 {
71  struct stat buf;
72 
73  if (fstat (fd, &buf) == -1)
74  return -1;
75 
76  return buf.st_size;
77 }
78 
79 // non-blocking process pause
80 void Sleep(int mili)
81 {
82 #ifdef __APPLE__
83  // ewwww, I hate this!! SDL_Delay() is causing issues for us though and this
84  // basically matches Apple examples of the same thing. Same as SDL_Delay() but
85  // we aren't hitting up the system for anything during the process
86  uint then = SDL_GetTicks() + mili;
87 
88  while (then > SDL_GetTicks());
89 #else
90  SDL_Delay(mili);
91 #endif
92 }
93 
94 extern void os_deinit();
95 // fatal assertion error
96 void WinAssert(char * text, char *filename, int line)
97 {
98  fprintf(stderr, "ASSERTION FAILED: \"%s\" at %s:%d\n", text, filename, line);
99 
100  // this stuff migt be really useful for solving bug reports and user errors. We should output it!
101  mprintf(("ASSERTION: \"%s\" at %s:%d\n", text, strrchr(filename, '/')+1, line ));
102 
103 #ifdef Allow_NoWarn
104  if (Cmdline_nowarn) {
105  return;
106  }
107 #endif
108 
109  // we have to call os_deinit() before abort() so we make sure that SDL gets
110  // closed out and we don't lose video/input control
111  os_deinit();
112 
113  abort();
114 }
115 
116 // fatal assertion error
117 void WinAssert(char * text, char *filename, int line, const char * format, ... )
118 {
119  // Karajorma - Nicked the code from the Warning function below
120  va_list args;
121  int i;
122  int slen = 0;
123 
124  memset( buffer, 0, sizeof(buffer) );
125  memset( buffer_tmp, 0, sizeof(buffer_tmp) );
126 
127  va_start(args, format);
128  vsnprintf(buffer_tmp, sizeof(buffer_tmp) - 1, format, args);
129  va_end(args);
130 
131  slen = strlen(buffer_tmp);
132 
133  // strip out the newline char so the output looks better
134  for (i = 0; i < slen; i++){
135  if (buffer_tmp[i] == (char)0x0a) {
136  buffer[i] = ' ';
137  } else {
138  buffer[i] = buffer_tmp[i];
139  }
140  }
141 
142  // kill off extra white space at end
143  if (buffer[slen-1] == (char)0x20) {
144  buffer[slen-1] = '\0';
145  } else {
146  // just being careful
147  buffer[slen] = '\0';
148  }
149 
150  fprintf(stderr, "ASSERTION FAILED: \"%s\" at %s:%d %s\n", text, filename, line, buffer);
151 
152  // this stuff migt be really useful for solving bug reports and user errors. We should output it!
153  mprintf(("ASSERTION: \"%s\" at %s:%d %s\n", text, strrchr(filename, '/')+1, line, buffer ));
154 
155 #ifdef Allow_NoWarn
156  if (Cmdline_nowarn) {
157  return;
158  }
159 #endif
160 
161  // we have to call os_deinit() before abort() so we make sure that SDL gets
162  // closed out and we don't lose video/input control
163  os_deinit();
164 
165  abort();
166 }
167 
168 void WarningEx( char *filename, int line, const char *format, ... )
169 {
170 #ifndef NDEBUG
171  if (Cmdline_extra_warn) {
172  char msg[2 * MAX_BUF_SIZE];
173  va_list args;
174  va_start(args, format);
175  vsprintf(msg, format, args);
176  va_end(args);
177  Warning(filename, line, "%s", msg);
178  }
179 #endif
180 }
181 
182 // standard warning message
183 void Warning( char * filename, int line, const char * format, ... )
184 {
186 
187 #ifndef NDEBUG
188  va_list args;
189  int i;
190  int slen = 0;
191 
192  memset( buffer, 0, sizeof(buffer) );
193  memset( buffer_tmp, 0, sizeof(buffer_tmp) );
194 
195  va_start(args, format);
196  vsnprintf(buffer_tmp, sizeof(buffer_tmp) - 1, format, args);
197  va_end(args);
198 
199  slen = strlen(buffer_tmp);
200 
201  // strip out the newline char so the output looks better
202  for (i = 0; i < slen; i++){
203  if (buffer_tmp[i] == (char)0x0a) {
204  buffer[i] = ' ';
205  } else {
206  buffer[i] = buffer_tmp[i];
207  }
208  }
209 
210  // kill off extra white space at end
211  if (buffer[slen-1] == (char)0x20) {
212  buffer[slen-1] = '\0';
213  } else {
214  // just being careful
215  buffer[slen] = '\0';
216  }
217 
218  mprintf(("WARNING: \"%s\" at %s:%d\n", buffer, strrchr(filename, '/')+1, line));
219 
220  // Order UP!!
221  fprintf(stderr, "WARNING: \"%s\" at %s:%d\n", buffer, filename, line);
222 #endif
223 }
224 
225 //Display warning even in non-devug builds
226 void ReleaseWarning( char * filename, int line, const char * format, ... )
227 {
229 
230  va_list args;
231  int i;
232  int slen = 0;
233 
234  memset( buffer, 0, sizeof(buffer) );
235  memset( buffer_tmp, 0, sizeof(buffer_tmp) );
236 
237  va_start(args, format);
238  vsnprintf(buffer_tmp, sizeof(buffer_tmp) - 1, format, args);
239  va_end(args);
240 
241  slen = strlen(buffer_tmp);
242 
243  // strip out the newline char so the output looks better
244  for (i = 0; i < slen; i++){
245  if (buffer_tmp[i] == (char)0x0a) {
246  buffer[i] = ' ';
247  } else {
248  buffer[i] = buffer_tmp[i];
249  }
250  }
251 
252  // kill off extra white space at end
253  if (buffer[slen-1] == (char)0x20) {
254  buffer[slen-1] = '\0';
255  } else {
256  // just being careful
257  buffer[slen] = '\0';
258  }
259 
260  mprintf(("WARNING: \"%s\" at %s:%d\n", buffer, strrchr(filename, '/')+1, line));
261 
262  // Order UP!!
263  fprintf(stderr, "WARNING: \"%s\" at %s:%d\n", buffer, filename, line);
264 }
265 
266 // fatal error message
267 void Error( const char * filename, int line, const char * format, ... )
268 {
270 
271  va_list args;
272 #ifndef APPLE_APP
273  int i;
274  int slen = 0;
275 #endif
276 
277  memset( buffer, 0, sizeof(buffer) );
278  memset( buffer_tmp, 0, sizeof(buffer_tmp) );
279 
280  va_start(args, format);
281  vsnprintf(buffer_tmp, sizeof(buffer_tmp) - 1, format, args);
282  va_end(args);
283 
284  mprintf(("ERROR: %s\nFile: %s\nLine: %d\n", buffer_tmp, filename, line));
285 
286 #if defined(APPLE_APP)
287  CFStringRef AsMessage;
288  char AsText[1024];
289  CFOptionFlags result;
290 
291  snprintf(AsText, 1024, "Error: %s\n\nFile: %s\nLine %d\n", buffer_tmp, filename, line);
292  AsMessage = CFStringCreateWithCString(NULL, AsText, kCFStringEncodingASCII);
293 
294  CFUserNotificationDisplayAlert(0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL, CFSTR("Error!"), AsMessage, CFSTR("Exit"), NULL, NULL, &result);
295 #else
296  slen = strlen(buffer_tmp);
297 
298  // strip out the newline char so the output looks better
299  for (i = 0; i < slen; i++){
300  if (buffer_tmp[i] == (char)0x0a) {
301  buffer[i] = ' ';
302  } else {
303  buffer[i] = buffer_tmp[i];
304  }
305  }
306 
307  // kill off extra white space at end
308  if (buffer[slen-1] == (char)0x20) {
309  buffer[slen-1] = '\0';
310  } else {
311  // just being careful
312  buffer[slen] = '\0';
313  }
314 
315  // Order UP!!
316  fprintf(stderr, "ERROR: \"%s\" at %s:%d\n", buffer, filename, line);
317 #endif
318 
319  exit(EXIT_FAILURE);
320 }
321 
322 extern lua_Debug Ade_debug_info;
323 void LuaError(struct lua_State *L, const char *format, ...)
324 {
325  va_list args;
326  memset( &buffer, 0, sizeof(buffer) );
327 
328  if (format == NULL) {
329  // make sure to cap to a sane string size
330  snprintf( buffer, sizeof(buffer) - 1, "%s", lua_tostring(L, -1) );
331  lua_pop(L, -1);
332  } else {
333  va_start(args, format);
334  vsnprintf(buffer, sizeof(buffer) - 1, format, args);
335  va_end(args);
336  }
337 
338  // Order UP!!
339  fprintf(stderr, "LUA ERROR: \"%s\"\n", buffer);
340  fprintf(stderr, "\n");
341 
342  fprintf(stderr, "------------------------------------------------------------------\n");
343  fprintf(stderr, "ADE Debug:\n");
344  fprintf(stderr, "\n");
345  fprintf(stderr, "Name: %s\n", Ade_debug_info.name);
346  fprintf(stderr, "Name of: %s\n", Ade_debug_info.namewhat);
347  fprintf(stderr, "Function type: %s\n", Ade_debug_info.what);
348  fprintf(stderr, "Defined on: %d\n", Ade_debug_info.linedefined);
349  fprintf(stderr, "Upvalues: %d\n", Ade_debug_info.nups);
350  fprintf(stderr, "\n" );
351  fprintf(stderr, "Source: %s\n", Ade_debug_info.source);
352  fprintf(stderr, "Short source: %s\n", Ade_debug_info.short_src);
353  fprintf(stderr, "Current line: %d\n", Ade_debug_info.currentline);
354 
355  fprintf(stderr, "------------------------------------------------------------------\n");
356  fprintf(stderr, "LUA Stack:\n");
357  fprintf(stderr, "\n");
358  ade_stackdump(L, buffer);
359  fprintf(stderr, "%s\n", buffer);
360  fprintf(stderr, "\n");
361 
362  exit(EXIT_FAILURE);
363 }
364 
365 
366 HMMIO mmioOpen(LPSTR szFilename, LPMMIOINFO lpmmioinfo, DWORD dwOpenFlags)
367 {
368  SDL_RWops *handle = NULL;
369 
370  char *mode = "rb";
371 
372  if (dwOpenFlags & MMIO_READ)
373  mode = "rb";
374  else if (dwOpenFlags & MMIO_READWRITE)
375  mode = "r+b";
376  else if (dwOpenFlags & MMIO_WRITE)
377  mode = "wb";
378 
379  if ( szFilename != NULL ) {
380  Assert( lpmmioinfo == NULL );
381 
382  handle = SDL_RWFromFile( szFilename, mode );
383  } else if ( lpmmioinfo != NULL ) {
384  Assert( szFilename == NULL );
385 
386  handle = SDL_RWFromMem( lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer );
387  }
388 
389  return handle;
390 }
391 
392 long mmioSeek(HMMIO hmmio, long lOffset, int iOrigin)
393 {
394  return (long) SDL_RWseek( hmmio, lOffset, iOrigin );
395 }
396 
397 long mmioRead(HMMIO hmmio, HPSTR pch, long cch)
398 {
399  return (long) SDL_RWread( hmmio, pch, 1, cch );
400 }
401 
402 MMRESULT mmioClose(HMMIO hmmio, uint wFlags)
403 {
404  if (wFlags != 0)
406 
407  int rc = 0;
408 
409  rc = SDL_RWclose( hmmio );
410 
411  if (rc)
412  return MMIOERR_CANNOTWRITE;
413 
414  return 0;
415 }
416 
417 // get a filename minus any leading path
418 char *clean_filename(char *name)
419 {
420  char *p = name + strlen(name)-1;
421 
422  // Move p to point to first letter of EXE filename
423  while( (p > name) && (*p != '\\') && (*p != '/') && (*p != ':') )
424  p--;
425 
426  p++;
427 
428  return p;
429 }
430 
431 // high precision timer
433 {
434  struct timeval timer_now;
435 
436  gettimeofday(&timer_now, NULL);
437 
438  pcount->QuadPart = (longlong)timer_now.tv_usec;
439 
440  return 1;
441 }
442 
443 #ifndef NDEBUG
444 int TotalRam = 0;
445 #endif
446 
447 int Watch_malloc = 0;
448 DCF_BOOL(watch_malloc, Watch_malloc )
449 
450 
451 #ifndef NDEBUG
453 {
454  //_CrtSetAllocHook(MyAllocHook);
455  TotalRam = 0;
456 }
457 #endif
458 
459 // retrieve the current working directory
460 int _getcwd(char *out_buf, unsigned int len)
461 {
462  if (getcwd(out_buf, len) == NULL) {
463  Error(__FILE__, __LINE__, "buffer overflow in getcwd (buf size = %u)", len);
464  }
465 
466  return 1;
467 }
468 
469 // change directory to specified path
470 int _chdir(const char *path)
471 {
472  int status = chdir(path);
473 
474 #ifndef NDEBUG
475  int m_error = errno;
476 
477  if (status) {
478  Warning(__FILE__, __LINE__, "Cannot chdir to %s: %s", path, strerror(m_error));
479  }
480 #endif
481 
482  return status;
483 }
484 
485 // make specified directory
486 int _mkdir(const char *path)
487 {
488  int status = 1; // if we don't ever call mkdir() to update this then assume we are in error
489  char *c, tmp_path[MAX_PATH];
490 
491  memset(tmp_path, 0, MAX_PATH);
492  strncpy(tmp_path, path, MAX_PATH-1);
493 
494  c = &tmp_path[1];
495 
496  while (c++) {
497  c = strchr(c, '/');
498 
499  if (c) {
500  *c = '\0';
501 
502  status = mkdir(tmp_path, 0755);
503 
504 #ifndef NDEBUG
505  int m_error = errno;
506 
507  if (status && (m_error != EEXIST) ) {
508  Warning(__FILE__, __LINE__, "Cannot mkdir %s: %s", tmp_path, strerror(m_error));
509  }
510 #endif
511  *c = '/';
512  }
513  }
514 
515  return status;
516 }
517 
518 void _splitpath (char *path, char *drive, char *dir, char *fname, char *ext)
519 {
520  if ( (path == NULL) || (fname == NULL) )
521  return;
522 
523  // stop at these in case they ever get used, we need to support them at that point
524  Assert( (dir == NULL) && (ext == NULL) );
525 
526  /* fs2 only uses fname */
527  if (fname != NULL) {
528  const char *ls = strrchr(path, '/');
529 
530  if (ls != NULL) {
531  ls++; // move past '/'
532  } else {
533  ls = path;
534  }
535 
536  const char *lp = strrchr(path, '.');
537 
538  if (lp == NULL) {
539  lp = ls + strlen(ls); // move to the end
540  }
541 
542  int dist = lp-ls;
543 
544  if (dist > (_MAX_FNAME-1))
545  dist = _MAX_FNAME-1;
546 
547  strncpy(fname, ls, dist);
548  fname[dist] = 0; // add null, just in case
549  }
550 }
551 
552 // some type of info message
553 int MessageBox(HWND h, const char *s1, const char *s2, int i)
554 {
555  if ( (h != NULL) && (i > -1) ) {
556  // placeholder for some future time
557  }
558 
559  fprintf(stderr, "%s: \"%s\"\n", s2, s1);
560 
561  return 0;
562 }
563 
564 
565 int MulDiv(int number, int numerator, int denominator)
566 {
567  int result;
568 
569  if (denominator == 0)
570  return 0;
571 
572  longlong tmp;
573  tmp = ((longlong) number) * ((longlong) numerator);
574  tmp /= (longlong) denominator;
575  result = (int) tmp;
576 
577  return result;
578 }
579 
580 // lowercase a string
581 void strlwr(char *s)
582 {
583  if (s == NULL)
584  return;
585 
586  while (*s) {
587  *s = tolower(*s);
588  s++;
589  }
590 }
591 
592 
593 /* *************************************
594  *
595  * memory handling functions
596  *
597  * *************************************/
598 
599 // RamTable stuff replaced due to slow performance when freeing large amounts of memory
600 
601 int vm_init(int min_heap_size)
602 {
603 #ifndef NDEBUG
604  TotalRam = 0;
605 #endif
606 
607  return 1;
608 }
609 
610 #ifndef NDEBUG
611 void *_vm_malloc( int size, char *filename, int line, int quiet )
612 #else
613 void *_vm_malloc( int size, int quiet )
614 #endif
615 {
616  void *ptr = malloc( size );
617 
618  if (!ptr) {
619  if (quiet) {
620  return NULL;
621  }
622 
623  Error(LOCATION, "Out of memory.");
624  }
625 
626 #ifndef NDEBUG
627  size_t used_size = MALLOC_USABLE(ptr);
628  if ( Watch_malloc ) {
629  // mprintf now uses SCP_strings = recursion! Whee!!
630  fprintf( stdout, "Malloc %zu bytes [%s(%d)]\n", used_size, clean_filename(filename), line );
631  }
632 
633  TotalRam += used_size;
634 #endif
635 
636  return ptr;
637 }
638 
639 #ifndef NDEBUG
640 void *_vm_realloc( void *ptr, int size, char *filename, int line, int quiet )
641 #else
642 void *_vm_realloc( void *ptr, int size, int quiet )
643 #endif
644 {
645  if (ptr == NULL)
646  return vm_malloc(size);
647 
648 #ifndef NDEBUG
649  size_t old_size = MALLOC_USABLE(ptr);
650 #endif
651 
652  void *ret_ptr = realloc( ptr, size );
653 
654  if (!ret_ptr) {
655  if (quiet && (size > 0) && (ptr != NULL)) {
656  // realloc doesn't touch the original ptr in the case of failure so we could still use it
657  return NULL;
658  }
659 
660  Error(LOCATION, "Out of memory.");
661  }
662 
663 #ifndef NDEBUG
664  size_t used_size = MALLOC_USABLE(ret_ptr);
665  if ( Watch_malloc ) {
666  // mprintf now uses SCP_strings = recursion! Whee!!
667  fprintf( stdout, "Realloc %zu bytes [%s(%d)]\n", used_size, clean_filename(filename), line );
668  }
669 
670  TotalRam += (used_size - old_size);
671 #endif
672 
673  return ret_ptr;
674 }
675 
676 #ifndef NDEBUG
677 char *_vm_strdup( const char *ptr, char *filename, int line )
678 #else
679 char *_vm_strdup( const char *ptr )
680 #endif
681 {
682  char *dst;
683  int len = strlen(ptr);
684 
685  dst = (char *)vm_malloc( len+1 );
686 
687  if (!dst)
688  return NULL;
689 
690  strcpy( dst, ptr );
691 
692  return dst;
693 }
694 
695 #ifndef NDEBUG
696 char *_vm_strndup( const char *ptr, int size, char *filename, int line )
697 #else
698 char *_vm_strndup( const char *ptr, int size )
699 #endif
700 {
701  char *dst;
702 
703  dst = (char *)vm_malloc( size+1 );
704 
705  if (!dst)
706  return NULL;
707 
708  strncpy( dst, ptr, size );
709  // make sure it has a NULL terminiator
710  dst[size] = '\0';
711 
712  return dst;
713 }
714 
715 #ifndef NDEBUG
716 void _vm_free( void *ptr, char *filename, int line )
717 #else
718 void _vm_free( void *ptr )
719 #endif
720 {
721  if ( !ptr ) {
722 #ifndef NDEBUG
723  mprintf(("Why are you trying to free a NULL pointer? [%s(%d)]\n", clean_filename(filename), line));
724 #else
725  mprintf(("Why are you trying to free a NULL pointer?\n"));
726 #endif
727  return;
728  }
729 
730 #ifndef NDEBUG
731  TotalRam -= MALLOC_USABLE(ptr);
732 #endif // !NDEBUG
733 
734  free(ptr);
735 }
736 
737 void vm_free_all()
738 {
739 }
740 
741 #endif // SCP_UNIX
GLenum GLsizei GLenum format
Definition: Gl.h:1509
int filelength(int fd)
GLuint64EXT * result
Definition: Glext.h:10775
const char * clean_filename(const char *name)
Definition: windebug.cpp:60
void * HWND
Definition: config.h:104
int i
Definition: multi_pxo.cpp:466
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
int TotalRam
Definition: windebug.cpp:1580
#define MAX_PATH
bool QueryPerformanceCounter(LARGE_INTEGER *pcount)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
Assert(pm!=NULL)
void _cdecl void void _cdecl void _cdecl void _cdecl WarningEx(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
#define mprintf(args)
Definition: pstypes.h:238
SDL_RWops * HMMIO
Definition: config.h:93
GLenum mode
Definition: Glext.h:5794
GLsizeiptr size
Definition: Glext.h:5496
void os_deinit()
Definition: osapi.cpp:340
MMRESULT mmioClose(HMMIO hmmio, uint wFlags)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
void _vm_free(void *ptr, char *filename=NULL, int line=-1)
Definition: windebug.cpp:1973
__int64 QuadPart
Definition: config.h:118
LONG cchBuffer
Definition: config.h:234
int _getcwd(char *buffer, unsigned int len)
char * LPSTR
Definition: config.h:107
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
unsigned int uint
Definition: pstypes.h:64
void vsprintf(SCP_string &dest, const char *format, va_list ap)
Definition: parselo.cpp:3800
GLenum GLenum dst
Definition: Glext.h:5917
#define MMIO_READ
Definition: config.h:251
int _mkdir(const char *path)
int vm_init(int min_heap_size)
Definition: windebug.cpp:1657
char * filename
int _chdir(const char *path)
long mmioSeek(HMMIO hmmio, long lOffset, int iOrigin)
INT32 * numerator
Definition: wglext.h:659
char * _vm_strndup(const char *ptr, int size, char *filename, int line)
Definition: windebug.cpp:1953
GLuint buffer
Definition: Glext.h:5492
GLdouble s
Definition: Glext.h:5321
GLsizei const GLchar ** string
Definition: Glext.h:5636
char * strnset(char *string, int fill, size_t count)
unsigned long DWORD
Definition: config.h:90
void vm_free_all()
Definition: windebug.cpp:1996
void * _vm_realloc(void *ptr, int size, char *filename=NULL, int line=-1, int quiet=0)
Definition: windebug.cpp:2001
#define MMIO_READWRITE
Definition: config.h:252
int Global_error_count
Definition: windebug.cpp:47
void _splitpath(char *path, char *drive, char *dir, char *fname, char *ext)
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
#define vm_malloc(size)
Definition: pstypes.h:547
GLuint const GLchar * name
Definition: Glext.h:5608
INT32 INT32 * denominator
Definition: wglext.h:659
void ade_stackdump(lua_State *L, char *stackdump)
Definition: lua.cpp:15953
int MulDiv(int number, int numerator, int denominator)
char * _vm_strdup(const char *ptr, char *filename, int line)
Definition: windebug.cpp:1935
#define DCF_BOOL(function_name, bool_variable)
Definition: console.h:71
char * HPSTR
Definition: config.h:108
#define MMIOERR_CANNOTWRITE
Definition: config.h:256
void * _vm_malloc(int size, char *filename=NULL, int line=-1, int quiet=0)
Definition: windebug.cpp:1906
#define MMIO_WRITE
Definition: config.h:253
__int64 longlong
Definition: pstypes.h:60
UINT MMRESULT
Definition: msacm.h:153
GLsizei const GLchar ** path
Definition: Glext.h:6795
GLfloat GLfloat p
Definition: Glext.h:8373
void Sleep(int mili)
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
#define LOCATION
Definition: pstypes.h:245
int MessageBox(HWND h, const char *s1, const char *s2, int i)
int Watch_malloc
Definition: windebug.cpp:1653
long mmioRead(HMMIO hmmio, HPSTR pch, long cch)
#define STUB_FUNCTION
Definition: config.h:67
GLint GLsizei count
Definition: Gl.h:1491
GLenum GLsizei len
Definition: Glext.h:6283
void _cdecl void void _cdecl void _cdecl void _cdecl void _cdecl ReleaseWarning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void _cdecl WinAssert(char *text, char *filename, int line)
Definition: windebug.cpp:911
void windebug_memwatch_init()
Definition: windebug.cpp:1645
void _cdecl void void _cdecl void _cdecl void _cdecl void _cdecl int Global_warning_count
Definition: windebug.cpp:46
void strlwr(char *s)
void _cdecl void LuaError(struct lua_State *L, SCP_FORMAT_STRING const char *format=NULL,...) SCP_FORMAT_STRING_ARGS(2
int Cmdline_extra_warn
Definition: cmdline.cpp:496
const GLubyte * c
Definition: Glext.h:8376
lua_Debug Ade_debug_info
Definition: lua.cpp:15807
HPSTR pchBuffer
Definition: config.h:235
#define _MAX_FNAME
Definition: config.h:220
HMMIO mmioOpen(LPSTR szFilename, LPMMIOINFO lpmmioinfo, DWORD dwOpenFlags)