Wing Commander II
Reconstructed Win32 source (1996)
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
10extern char g_12_szSoundTraceScratch[0x200]; /* 0x005d1f00 */
11
12/* Function start: 0x4377F0 */
14{
15 unsigned int version;
16
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 }
40}
41
42/* Function start: 0x4378D9 */
44{
45 if (g_bMonoDebugInstalled != 0) {
46 CloseHandle(g_hMonoDebugDevice);
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. */
56{
57 if (g_bMonoDebugInstalled != 0) {
58 if (!DeviceIoControl(g_hMonoDebugDevice, 3, 0, 0, 0, 0, 0, 0))
60 }
61}
62
63/* Function start: 0x437946 */
64void 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);
72}
73
74/* Function start: 0x437983 */
75void 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?!)");
82 }
83 }
84}
85
86/* Function start: 0x4379D4 */
87void ReadPerformanceCounter(LARGE_INTEGER *p)
88{
89 QueryPerformanceCounter(p);
90}
char g_12_szSoundTraceScratch[0x200]
Definition cockpt.c:3820
void MonoDebug_print(const char *text)
Definition mono.c:75
void SoundDebugPrintf(const char *fmt,...)
Definition mono.c:64
void MonoDebug_remove(void)
Definition mono.c:43
void ReadPerformanceCounter(LARGE_INTEGER *p)
Definition mono.c:87
void MonoDebug_install(void)
Definition mono.c:13
void SendMonoDebugCommand3(void)
Definition mono.c:55
void exit_squadron(const char *msg,...)
Definition message.c:44
Shared Win32 declarations, types and library interfaces.
MONO_STATIC HANDLE g_hMonoDebugDevice
Definition globals.h:931
MONO_STATIC int g_bMonoDebugInstalled
Definition globals.h:930