MCPcopy Index your code
hub / github.com/NetHack/NetHack / MAIN

Function MAIN

sys/windows/windmain.c:149–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147#endif
148
149int
150MAIN(int argc, char *argv[])
151{
152 boolean resuming = FALSE; /* assume new game */
153 NHFILE *nhfp;
154 char *windowtype = NULL;
155 char fnamebuf[BUFSZ], encodedfnamebuf[BUFSZ];
156 char failbuf[BUFSZ];
157 int getlock_result = 0;
158 HWND hwnd;
159 HDC hdc;
160 int bpp;
161 char *dir = NULL;
162
163#ifdef _MSC_VER
164 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
165#endif
166
167 /* setting iflags.colorcount has to be after early_init()
168 * because it zeros out all of iflags */
169 hwnd = GetDesktopWindow();
170
171#ifdef _MSC_VER
172#ifdef DEBUG
173 /* set these appropriately for VS debugging */
174 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
175 _CrtSetReportMode(_CRT_ERROR,
176 _CRTDBG_MODE_DEBUG); /* | _CRTDBG_MODE_FILE);*/
177 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
178/*| _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW);*/
179/* use STDERR by default
180_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
181_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
182/* Heap Debugging
183 _CrtSetDbgFlag( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)
184 | _CRTDBG_ALLOC_MEM_DF
185 | _CRTDBG_CHECK_ALWAYS_DF
186 | _CRTDBG_CHECK_CRT_DF
187 | _CRTDBG_DELAY_FREE_MEM_DF
188 | _CRTDBG_LEAK_CHECK_DF);
189 _CrtSetBreakAlloc(1423);
190*/
191#endif
192#endif
193
194 set_emergency_io();
195#ifndef MSWIN_GRAPHICS
196 early_init(argc, argv); /* already in WinMain for MSWIN_GRAPHICS */
197#endif
198
199 /* this must be done after early_init() because early_init()
200 sets iflags to zero */
201 hdc = GetDC(hwnd);
202 if (hdc) {
203 bpp = GetDeviceCaps(hdc, BITSPIXEL);
204 iflags.colorcount = (bpp >= 16) ? 16777216 : (bpp >= 8) ? 256 : 16;
205 ReleaseDC(hwnd, hdc);
206 }

Callers

nothing calls this directly

Calls 15

set_emergency_ioFunction · 0.85
early_initFunction · 0.85
copy_sysconf_contentFunction · 0.85
copy_symbols_contentFunction · 0.85
copy_config_contentFunction · 0.85
consoletty_openFunction · 0.85
rcfile_interface_optionsFunction · 0.85
choose_windowsFunction · 0.85
getcwdFunction · 0.85
initoptions_initFunction · 0.85
initoptionsFunction · 0.85
check_recordfileFunction · 0.85

Tested by

no test coverage detected