static int Main(string[] args) { #if !DEBUG try { #endif // select display device _DisplayDevice = DisplayDevice.Default; if (File.Exists(DumpFilePath)) { File.Delete(DumpFilePath); } quakeparms_t parms = new quakeparms_t(); parms.basedir = Application.StartupPath; string[] args2 = new string[args.Length + 1]; args2[0] = String.Empty; args.CopyTo(args2, 1); Common.InitArgv(args2); parms.argv = new string[Common.Argc]; Common.Args.CopyTo(parms.argv, 0); if (Common.HasParam("-dedicated")) { throw new QuakeException("Dedicated server mode not supported!"); } Size size = new Size(640, 480); GraphicsMode mode = new GraphicsMode(); bool fullScreen = false; using (MainForm form = MainForm.CreateInstance(size, mode, fullScreen)) { Con.DPrint("Host.Init\n"); Host.Init(parms); form.Run(); } Host.Shutdown(); #if !DEBUG } catch (QuakeSystemError se) { HandleException(se); } catch (Exception ex) { HandleException(ex); } #endif return(0); // all Ok }
static void SafeShutdown() { try { Host.Shutdown(); } catch (Exception ex) { DumpError(ex); if (Debugger.IsAttached) { throw new Exception("Exception in SafeShutdown()!", ex); } } }