예제 #1
0
        protected override bool SetupBasicGameInfo()
        {
            SpaceEngineersGame.SetupBasicGameInfo();
            m_startup = new MyCommonProgramStartup(m_args);

            var appDataPath = m_startup.GetAppDataPath();

            VRage.Platform.Windows.MyVRageWindows.Init(MyPerGameSettings.BasicGameInfo.ApplicationName, MySandboxGame.Log, appDataPath, false);
            MyInitializer.InvokeBeforeRun(AppId, MyPerGameSettings.BasicGameInfo.ApplicationName + "ModTool", MyVRage.Platform.System.GetAppDataPath());
            MyRenderProxy.Initialize((IMyRender) new MyNullRender());
            MyInitializer.InitCheckSum();

            if (m_startup.PerformColdStart())
            {
                return(false);
            }
            if (!m_startup.Check64Bit())
            {
                return(false);
            }

            m_steamService = VRage.Steam.MySteamGameService.Create(MySandboxGame.IsDedicated, AppId);
            MyServiceManager.Instance.AddService(m_steamService);
            MyServiceManager.Instance.AddService(VRage.Steam.MySteamUgcService.Create(AppId, m_steamService));

            if (m_useModIO)
            {
                MyLog.Default.WriteLineAndConsole("Using mod.io service, instead of Steam.");
                MyServiceManager.Instance.AddService(VRage.Mod.Io.MyModIoService.Create(MySandboxGame.IsDedicated, MyServiceManager.Instance.GetService <IMyGameService>(), ModIO_GameName, ModIO_GameID, ModIO_Key, ModIO_TestGameID, ModIO_TestKey, false));
            }

            SpaceEngineersGame.SetupPerGameSettings();
            ManuallyAddDLCs();
            return(true);
        }
예제 #2
0
        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();
        }
예제 #3
0
        public override void Init()
        {
            Directory.SetCurrentDirectory(Program.SpaceEngineersInstallAlias);
            MyFileSystem.ExePath = Path.Combine(Program.SpaceEngineersInstallAlias, Program.SpaceEngineersBinaries);
            Log.Info("Initializing Torch Client");
            base.Init();

            SpaceEngineersGame.SetupBasicGameInfo();
            _startup = new MyCommonProgramStartup(RunArgs);
            if (_startup.PerformReporting())
            {
                throw new InvalidOperationException("Torch client won't launch when started in error reporting mode");
            }

            _startup.PerformAutoconnect();
            if (!_startup.CheckSingleInstance())
            {
                throw new InvalidOperationException("Only one instance of Space Engineers can be running at a time.");
            }

            var appDataPath = _startup.GetAppDataPath();

            MyInitializer.InvokeBeforeRun(APP_ID, MyPerGameSettings.BasicGameInfo.ApplicationName, appDataPath);
            MyInitializer.InitCheckSum();
            _startup.InitSplashScreen();
            if (!_startup.Check64Bit())
            {
                throw new InvalidOperationException("Torch requires a 64bit operating system");
            }

            _startup.DetectSharpDxLeaksBeforeRun();
            var steamService = new SteamService(Game.IsDedicated, APP_ID);

            MyServiceManager.Instance.AddService <IMyGameService>(steamService);
            _renderer = null;
            SpaceEngineersGame.SetupPerGameSettings();
            // I'm sorry, but it's what Keen does in SpaceEngineers.MyProgram
#pragma warning disable 612
            SpaceEngineersGame.SetupRender();
#pragma warning restore 612
            InitializeRender();
            if (!_startup.CheckSteamRunning())
            {
                throw new InvalidOperationException("Space Engineers requires steam to be running");
            }

            if (!Game.IsDedicated)
            {
                MyFileSystem.InitUserSpecific(MyGameService.UserId.ToString());
            }
        }
예제 #4
0
        protected override bool SetupBasicGameInfo()
        {
            SpaceEngineersGame.SetupBasicGameInfo();
            m_startup = new MyCommonProgramStartup(m_args);

            var appDataPath = m_startup.GetAppDataPath();

            VRage.Platform.Windows.MyVRageWindows.Init(MyPerGameSettings.BasicGameInfo.ApplicationName, MySandboxGame.Log, appDataPath, false);
            MyInitializer.InvokeBeforeRun(AppId, MyPerGameSettings.BasicGameInfo.ApplicationName + "ModTool", MyVRage.Platform.System.GetAppDataPath());
            MyRenderProxy.Initialize((IMyRender) new MyNullRender());
            MyInitializer.InitCheckSum();

            if (m_startup.PerformColdStart())
            {
                return(false);
            }
            if (!m_startup.Check64Bit())
            {
                return(false);
            }

            m_steamService = MySteamGameService.Create(MySandboxGame.IsDedicated, AppId);
            MyServiceManager.Instance.AddService(m_steamService);
            MyServerDiscoveryAggregator serverDiscoveryAggregator = new MyServerDiscoveryAggregator();

            MySteamGameService.InitNetworking(false, m_steamService, MyPerGameSettings.BasicGameInfo.GameName, serverDiscoveryAggregator, true, true);

            // If user specified --modio, set that as the "default" (added first)
            var modioService = MyModIoService.Create(MyServiceManager.Instance.GetService <IMyGameService>(), ModIO_GameName, ModIO_GameID, ModIO_Key, ModIO_TestGameID, ModIO_TestKey, MyPlatformGameSettings.UGC_TEST_ENVIRONMENT, m_useModIO ? true : false);

            if (m_useModIO)
            {
                MyGameService.WorkshopService.AddAggregate(modioService);
            }
            MyGameService.WorkshopService.AddAggregate(MySteamUgcService.Create(AppId, m_steamService));

            if (!m_useModIO)
            {
                MyGameService.WorkshopService.AddAggregate(modioService);
            }

            SpaceEngineersGame.SetupPerGameSettings();
            ManuallyAddDLCs();
            return(true);
        }
예제 #5
0
        protected override bool SetupBasicGameInfo()
        {
            MyMedievalGame.SetupBasicGameInfo();
            m_startup = new MyCommonProgramStartup(new string[] { });

            var appDataPath = m_startup.GetAppDataPath();

            MyInitializer.InvokeBeforeRun(AppId, MyPerGameSettings.BasicGameInfo.ApplicationName + "ModTool", appDataPath);

            if (!m_startup.Check64Bit())
            {
                return(false);
            }

            m_steamService = new WorkshopTool.MySteamService(MySandboxGame.IsDedicated, AppId);
            MyServiceManager.Instance.AddService <IMyGameService>(m_steamService);
            MyMedievalGame.SetupPerGameSettings();

            return(true);
        }
예제 #6
0
        //  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();
        }
예제 #7
0
        // This is mostly copied from MyProgram.Main(), with UI stripped out.
        private static void InitSandbox(string instancepath)
        {
            MyFakes.ENABLE_INFINARIO = false;

            if (m_spacegame != null)
            {
                m_spacegame.Exit();
            }

            SpaceEngineersGame.SetupBasicGameInfo();
            m_startup = new MyCommonProgramStartup(new string[] { });

            var appDataPath = m_startup.GetAppDataPath();

            MyInitializer.InvokeBeforeRun(AppId_SE, MyPerGameSettings.BasicGameInfo.ApplicationName + "ModTool", appDataPath);
            MyInitializer.InitCheckSum();

            if (!m_startup.Check64Bit())
            {
                return;
            }

            m_steamService = new MySteamService(MySandboxGame.IsDedicated, AppId_SE);
            SpaceEngineersGame.SetupPerGameSettings();


            if (System.Diagnostics.Debugger.IsAttached)
            {
                m_startup.CheckSteamRunning(m_steamService);        // Just give the warning message box when debugging, ignore for release
            }
            VRageGameServices services = new VRageGameServices(m_steamService);

            if (!MySandboxGame.IsDedicated)
            {
                MyFileSystem.InitUserSpecific(m_steamService.UserId.ToString());
            }

            try
            {
                // NOTE: an assert may be thrown in debug, about missing Tutorials.sbx. Ignore it.
                m_spacegame = new SpaceEngineersGame(services, null);

                // Initializing the workshop means the categories are available
                var initWorkshopMethod = typeof(SpaceEngineersGame).GetMethod("InitSteamWorkshop", BindingFlags.NonPublic | BindingFlags.Instance);
                MyDebug.AssertDebug(initWorkshopMethod != null);

                if (initWorkshopMethod != null)
                {
                    var parameters = initWorkshopMethod.GetParameters();
                    MyDebug.AssertDebug(parameters.Count() == 0);
                }

                if (initWorkshopMethod != null)
                {
                    initWorkshopMethod.Invoke(m_spacegame, null);
                }
                else
                {
                    MySandboxGame.Log.WriteLineAndConsole(string.Format(Constants.ERROR_Reflection, "InitSteamWorkshop"));
                }
            }
            catch (Exception ex)
            {
                // This shouldn't fail, but don't stop even if it does
                MySandboxGame.Log.WriteLineAndConsole("An exception occured, ignoring: " + ex.Message);
            }
        }