vkQuake2 doxygen  1.0 dev
conproc.h File Reference

Go to the source code of this file.

Functions

void InitConProc (int argc, char **argv)
 
void DeinitConProc (void)
 

Function Documentation

◆ DeinitConProc()

void DeinitConProc ( void  )

Definition at line 153 of file conproc.c.

154 {
155  if (heventDone)
156  SetEvent (heventDone);
157 }

Referenced by Sys_Error(), and Sys_Quit().

◆ InitConProc()

void InitConProc ( int  argc,
char **  argv 
)

Definition at line 84 of file conproc.c.

85 {
86  unsigned threadAddr;
87  HANDLE hFile;
88  HANDLE heventParent;
89  HANDLE heventChild;
90  int t;
91 
92  ccom_argc = argc;
93  ccom_argv = argv;
94 
95 // give QHOST a chance to hook into the console
96  if ((t = CCheckParm ("-HFILE")) > 0)
97  {
98  if (t < argc)
99  hFile = (HANDLE)atoi (ccom_argv[t+1]);
100  }
101 
102  if ((t = CCheckParm ("-HPARENT")) > 0)
103  {
104  if (t < argc)
105  heventParent = (HANDLE)atoi (ccom_argv[t+1]);
106  }
107 
108  if ((t = CCheckParm ("-HCHILD")) > 0)
109  {
110  if (t < argc)
111  heventChild = (HANDLE)atoi (ccom_argv[t+1]);
112  }
113 
114 
115 // ignore if we don't have all the events.
116  if (!hFile || !heventParent || !heventChild)
117  {
118  printf ("Qhost not present.\n");
119  return;
120  }
121 
122  printf ("Initializing for qhost.\n");
123 
124  hfileBuffer = hFile;
125  heventParentSend = heventParent;
126  heventChildSend = heventChild;
127 
128 // so we'll know when to go away.
129  heventDone = CreateEvent (NULL, FALSE, FALSE, NULL);
130 
131  if (!heventDone)
132  {
133  printf ("Couldn't create heventDone\n");
134  return;
135  }
136 
137  if (!_beginthreadex (NULL, 0, RequestProc, NULL, 0, &threadAddr))
138  {
139  CloseHandle (heventDone);
140  printf ("Couldn't create QHOST thread\n");
141  return;
142  }
143 
144 // save off the input/output handles.
145  hStdout = GetStdHandle (STD_OUTPUT_HANDLE);
146  hStdin = GetStdHandle (STD_INPUT_HANDLE);
147 
148 // force 80 character width, at least 25 character height
149  SetConsoleCXCY (hStdout, 80, 25);
150 }

Referenced by Sys_Init().

hStdin
HANDLE hStdin
Definition: conproc.c:45
CCheckParm
int CCheckParm(char *parm)
Definition: conproc.c:68
heventParentSend
HANDLE heventParentSend
Definition: conproc.c:43
argv
char * argv[MAX_NUM_ARGVS]
Definition: sys_win.c:56
argc
int argc
Definition: sys_win.c:55
ccom_argv
char ** ccom_argv
Definition: conproc.c:58
SetConsoleCXCY
BOOL SetConsoleCXCY(HANDLE hStdout, int cx, int cy)
Definition: conproc.c:356
RequestProc
unsigned _stdcall RequestProc(void *arg)
Definition: conproc.c:160
ccom_argc
int ccom_argc
Definition: conproc.c:57
t
GLdouble t
Definition: qgl_win.c:328
NULL
#define NULL
Definition: q_shared.h:67
heventDone
HANDLE heventDone
Definition: conproc.c:40
heventChildSend
HANDLE heventChildSend
Definition: conproc.c:42
hStdout
HANDLE hStdout
Definition: conproc.c:44
FALSE
#define FALSE
Definition: stb_vorbis.c:618
hfileBuffer
HANDLE hfileBuffer
Definition: conproc.c:41