Wing Commander
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
ixlog.cpp
Go to the documentation of this file.
1
/**
2
* @file
3
* @ingroup ixlib
4
* @brief The diagnostic printer, ix_log_printf.
5
*
6
* Address range 4426a0-44274f, immediately before streamer.cpp. Unlike the
7
* rest of ix it was linked as an object, not from a library: its CRT
8
* references (_CrtDbgReport, strncmp) are resolved before the entry point,
9
* and those of every ix library member after it. Its short branches,
10
* scheduled loads and POP EBP epilogue match the core optimizer profile,
11
* unlike the unoptimized ix library members.
12
*
13
* Every ix diagnostic goes through here, 107 call sites, always in pairs:
14
*
15
* ix_log_printf("Fatal [%s - %d]:\n", __FILE__, __LINE__);
16
* ix_log_printf("human readable message");
17
*/
18
#include "
ix.h
"
19
#include <stdarg.h>
20
#include <stdio.h>
21
#include <string.h>
22
#include <crtdbg.h>
23
24
25
/* Formatting scratch buffer. */
26
char
szLogBuf
[1024];
/* 0x005977D0 */
27
28
/* Mono-monitor debug printer in the game core (C linkage). */
29
extern
"C"
void
SoundDebugPrintf
(
const
char
*fmt, ...);
/* 0x00403DB0 */
30
31
/* Function start: 0x4426A0 */
32
void
ix_log_printf
(
const
char
*fmt, ...)
33
{
34
if
(fmt != 0) {
35
va_list arguments;
36
37
va_start(arguments, fmt);
38
vsprintf(
szLogBuf
, fmt, arguments);
39
va_end(arguments);
40
}
else
{
41
strcpy(
szLogBuf
,
"(null)"
);
42
}
43
44
if
(strncmp(
szLogBuf
,
"sleep_for"
, 9) != 0) {
45
SoundDebugPrintf
(
"%s"
,
szLogBuf
);
46
if
(_CrtDbgReport(0, 0, 0, 0,
"%s"
,
szLogBuf
) == 1)
47
_CrtDbgBreak();
48
}
49
}
50
51
/* Function start: 0x442740 */
52
/* Returns 1. Nothing in WC1 calls it; the log module's initializer
53
* reporting success, by analogy with the other ix modules' init entries. */
54
int
ix_log_init_hook
(
void
)
55
{
56
return
1;
57
}
ix.h
The library's classes and shared declarations.
ix_log_printf
void ix_log_printf(const char *fmt,...)
Definition
ixlog.cpp:32
szLogBuf
char szLogBuf[1024]
Definition
ixlog.cpp:26
ix_log_init_hook
int ix_log_init_hook(void)
Definition
ixlog.cpp:54
SoundDebugPrintf
void SoundDebugPrintf(const char *fmt,...)
Definition
mono.c:382
src
ix
ixlog.cpp
Generated by
1.18.0