public override void Init() { Log.Info("Initializing Torch Client"); base.Init(); if (!File.Exists("steam_appid.txt")) { Directory.SetCurrentDirectory(Path.GetDirectoryName(typeof(VRage.FastResourceLock).Assembly.Location) + "\\.."); } SpaceEngineersGame.SetupBasicGameInfo(); _startup = new MyCommonProgramStartup(RunArgs); if (_startup.PerformReporting()) { return; } _startup.PerformAutoconnect(); if (!_startup.CheckSingleInstance()) { return; } var appDataPath = _startup.GetAppDataPath(); MyInitializer.InvokeBeforeRun(APP_ID, MyPerGameSettings.BasicGameInfo.ApplicationName, appDataPath); MyInitializer.InitCheckSum(); if (!_startup.Check64Bit()) { return; } _startup.DetectSharpDxLeaksBeforeRun(); using (var mySteamService = new SteamService(Game.IsDedicated, APP_ID)) { _renderer = null; SpaceEngineersGame.SetupPerGameSettings(); OverrideMenus(); InitializeRender(); _services = new VRageGameServices(mySteamService); if (!Game.IsDedicated) { MyFileSystem.InitUserSpecific(mySteamService.UserId.ToString()); } } _startup.DetectSharpDxLeaksAfterRun(); MyInitializer.InvokeAfterRun(); }
public override void Dispose() { MyGameService.ShutDown(); _startup.DetectSharpDxLeaksAfterRun(); MyInitializer.InvokeAfterRun(); }
// Main method static void Main(string[] args) { #if XB1 XB1Interface.XB1Interface.Init(); MyAssembly.Init(); #endif SpaceEngineersGame.SetupBasicGameInfo(); m_startup = new MyCommonProgramStartup(args); if (m_startup.PerformReporting()) { return; } m_startup.PerformAutoconnect(); #if !XB1 if (!m_startup.CheckSingleInstance()) { return; } #endif // !XB1 var appDataPath = m_startup.GetAppDataPath(); MyInitializer.InvokeBeforeRun(AppId, MyPerGameSettings.BasicGameInfo.ApplicationName, appDataPath); MyInitializer.InitCheckSum(); m_startup.InitSplashScreen(); if (!m_startup.Check64Bit()) { return; } m_startup.DetectSharpDxLeaksBeforeRun(); using (MySteamService steamService = new MySteamService(MySandboxGame.IsDedicated, AppId)) { m_renderer = null; SpaceEngineersGame.SetupPerGameSettings(); SpaceEngineersGame.SetupRender(); try { InitializeRender(); } catch (MyRenderException ex) { #if !XB1 MessageBox.Show(ex.Message); #else // XB1 System.Diagnostics.Debug.Assert(false, "InitializeRender failed"); #endif // XB1 return; } VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyProgram.Init"); VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MySteam.Init()"); if (!m_startup.CheckSteamRunning(steamService)) { return; } VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("new MySandboxGame()"); VRageGameServices services = new VRageGameServices(steamService); if (!MySandboxGame.IsDedicated) { MyFileSystem.InitUserSpecific(steamService.UserId.ToString()); } using (SpaceEngineersGame game = new SpaceEngineersGame(services, args)) { VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); game.Run(disposeSplashScreen: m_startup.DisposeSplashScreen); } } m_startup.DetectSharpDxLeaksAfterRun(); #if PROFILING MyPerformanceTimer.WriteToLog(); #endif MyInitializer.InvokeAfterRun(); }