Wing Commander II
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
mono.c
Go to the documentation of this file.
1
/*
2
* MONODEBG developer channel.
3
*
4
* Retail object 0x4377F0-0x4379EF (link order; see docs/ORDER.md).
5
*/
6
/* This unit owns the mono storage declared in globals.h (as statics). */
7
#define MONO_C
8
#include "
game.h
"
9
10
extern
char
g_12_szSoundTraceScratch
[0x200];
/* 0x005d1f00 */
11
12
/* Function start: 0x4377F0 */
13
void
MonoDebug_install
(
void
)
14
{
15
unsigned
int
version;
16
17
g_hMonoDebugDevice
=
18
CreateFileA(
"\\\\.\\MONODEBG.VXD"
, 0, 0, 0, CREATE_ALWAYS,
19
FILE_FLAG_DELETE_ON_CLOSE, 0);
20
if
(
g_hMonoDebugDevice
== INVALID_HANDLE_VALUE)
21
return
;
22
23
if
(!DeviceIoControl(
g_hMonoDebugDevice
, 1, 0, 0,
24
&version,
sizeof
(version), 0, 0)) {
25
CloseHandle(
g_hMonoDebugDevice
);
26
return
;
27
}
28
if
(version != 0x20004) {
29
CloseHandle(
g_hMonoDebugDevice
);
30
exit_squadron
(
"MonoDebug__install expecting version"
);
31
return
;
32
}
33
if
(!DeviceIoControl(
g_hMonoDebugDevice
, 2, 0, 0,
34
0, 0, 0, 0)) {
35
CloseHandle(
g_hMonoDebugDevice
);
36
exit_squadron
(
"MonoDebug__install init failed"
);
37
return
;
38
}
39
g_bMonoDebugInstalled
= 1;
40
}
41
42
/* Function start: 0x4378D9 */
43
void
MonoDebug_remove
(
void
)
44
{
45
if
(
g_bMonoDebugInstalled
!= 0) {
46
CloseHandle(
g_hMonoDebugDevice
);
47
g_bMonoDebugInstalled
= 0;
48
}
49
}
50
51
/* Function start: 0x437907 */
52
/* Nothing in the shipped executable calls this. It sends control code 3 to
53
* MONODEBG.VXD (install uses 1 and 2, print uses 9) and removes the channel
54
* when the driver rejects it; what code 3 asks the driver to do is unknown. */
55
void
SendMonoDebugCommand3
(
void
)
56
{
57
if
(
g_bMonoDebugInstalled
!= 0) {
58
if
(!DeviceIoControl(
g_hMonoDebugDevice
, 3, 0, 0, 0, 0, 0, 0))
59
MonoDebug_remove
();
60
}
61
}
62
63
/* Function start: 0x437946 */
64
void
SoundDebugPrintf
(
const
char
*fmt, ...)
65
{
66
va_list arguments;
67
68
va_start(arguments, fmt);
69
vsprintf(
g_12_szSoundTraceScratch
, fmt, arguments);
70
va_end(arguments);
71
MonoDebug_print
(
g_12_szSoundTraceScratch
);
72
}
73
74
/* Function start: 0x437983 */
75
void
MonoDebug_print
(
const
char
*text)
76
{
77
if
(
g_bMonoDebugInstalled
!= 0) {
78
if
(!DeviceIoControl(
g_hMonoDebugDevice
, 9,
79
(
void
*)text, 0xfa0, 0, 0, 0, 0)) {
80
exit_squadron
(
"MonoDebug::print failed (buffer possibly on stack?!)"
);
81
MonoDebug_remove
();
82
}
83
}
84
}
85
86
/* Function start: 0x4379D4 */
87
void
ReadPerformanceCounter
(LARGE_INTEGER *p)
88
{
89
QueryPerformanceCounter(p);
90
}
g_12_szSoundTraceScratch
char g_12_szSoundTraceScratch[0x200]
Definition
cockpt.c:3820
MonoDebug_print
void MonoDebug_print(const char *text)
Definition
mono.c:75
SoundDebugPrintf
void SoundDebugPrintf(const char *fmt,...)
Definition
mono.c:64
MonoDebug_remove
void MonoDebug_remove(void)
Definition
mono.c:43
ReadPerformanceCounter
void ReadPerformanceCounter(LARGE_INTEGER *p)
Definition
mono.c:87
MonoDebug_install
void MonoDebug_install(void)
Definition
mono.c:13
SendMonoDebugCommand3
void SendMonoDebugCommand3(void)
Definition
mono.c:55
exit_squadron
void exit_squadron(const char *msg,...)
Definition
message.c:44
game.h
Shared Win32 declarations, types and library interfaces.
g_hMonoDebugDevice
MONO_STATIC HANDLE g_hMonoDebugDevice
Definition
globals.h:931
g_bMonoDebugInstalled
MONO_STATIC int g_bMonoDebugInstalled
Definition
globals.h:930
src
mono.c
Generated by
1.18.0