コード例 #1
0
        public bool CheckSingleInstance()
        {
            MySingleProgramInstance spi = new MySingleProgramInstance(MyFileSystem.MainAssemblyName);
            if (spi.IsSingleInstance == false)
            {
                MyErrorReporter.ReportAppAlreadyRunning(GameInfo.GameName);
                return false;
            }

            return true;
        }
コード例 #2
0
ファイル: MyProgram.cs プロジェクト: caomw/SpaceEngineers
        //  Main method
        static void Main(string[] args)
        {
            if (args.Contains("-report"))
            {
                MyErrorReporter.Report(args[1], args[2], "SE", MyErrorReporter.APP_ERROR_MESSAGE);
                return;
            }

            if (MyFakes.ENABLE_CONNECT_COMMAND_LINE && args.Contains("+connect"))
            {
                int index = args.ToList().IndexOf("+connect");
                if ((index + 1) < args.Length)
                {
                    if (IPAddressExtensions.TryParseEndpoint(args[index + 1], out MySandboxGame.ConnectToServer))
                    {
                        Console.WriteLine("Space engineers " + MyFinalBuildConstants.APP_VERSION_STRING);
                        Console.WriteLine("Obfuscated: " + MyObfuscation.Enabled + ", Platform: " + (Environment.Is64BitProcess ? " 64-bit" : " 32-bit"));
                        Console.WriteLine("Connecting to: " + args[index + 1]);
                    }
                }
            }

            MySingleProgramInstance spi = new MySingleProgramInstance(MyFileSystem.MainAssemblyName);
            if (spi.IsSingleInstance == false)
            {
                MyErrorReporter.ReportAppAlreadyRunning("Space Engineers");
                return;
            }

            MyInitializer.InvokeBeforeRun(
                AppId,
                "SpaceEngineers",
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SpaceEngineers"));

            MyInitializer.InitCheckSum();

            if (!args.Contains("-nosplash"))
            {
                InitSplashScreen();
            }

            // This won't crash with BadFormatExpection when 64-bit game started as 32-bit process, it will show message
            // Will uncomment when it's possible to test it
            if (!Environment.Is64BitProcess && AssemblyExtensions.TryGetArchitecture("SteamSDK.dll") == ProcessorArchitecture.Amd64)
            {
                string text = "Space Engineers cannot be started in 64-bit mode, ";
                text += "because 64-bit version of .NET framework is not available or is broken." + Environment.NewLine + Environment.NewLine;
                text += "Do you want to open website with more information about this particular issue?" + Environment.NewLine + Environment.NewLine;
                text += "Press Yes to open website with info" + Environment.NewLine;
                text += "Press No to run in 32-bit mode (smaller potential of Space Engineers!)" + Environment.NewLine;
                text += "Press Cancel to close this dialog";

                var result = Sandbox.MyMessageBox.Show(IntPtr.Zero, text, ".NET Framework 64-bit error", Sandbox.MessageBoxOptions.YesNoCancel);
                if (result == MessageBoxResult.Yes)
                {
                    MyBrowserHelper.OpenInternetBrowser("http://www.spaceengineersgame.com/64-bit-start-up-issue.html");
                }
                else if (result == MessageBoxResult.No)
                {
                    var entry = Assembly.GetEntryAssembly().Location;
                    string x86Exe = Path.Combine(new FileInfo(entry).Directory.Parent.FullName, "Bin", Path.GetFileName(entry));

                    ProcessStartInfo pi = new ProcessStartInfo();
                    pi.FileName = x86Exe;
                    pi.WorkingDirectory = Path.GetDirectoryName(x86Exe);
                    pi.Arguments = "-fallback";
                    pi.UseShellExecute = false;
                    pi.WindowStyle = ProcessWindowStyle.Normal;
                    var p = Process.Start(pi);
                }
                return;
            }

            MyFakes.ENABLE_DX11_RENDERER = false;

            if (MyFakes.ENABLE_DX11_RENDERER)
            {
                Sandbox.Graphics.Render.MyPostProcessVolumetricSSAO2.MinRadius = 0.095f;
                Sandbox.Graphics.Render.MyPostProcessVolumetricSSAO2.MaxRadius = 4.16f;
                Sandbox.Graphics.Render.MyPostProcessVolumetricSSAO2.RadiusGrowZScale = 1.007f;
                Sandbox.Graphics.Render.MyPostProcessVolumetricSSAO2.Falloff = 3.08f;
                Sandbox.Graphics.Render.MyPostProcessVolumetricSSAO2.Bias = 0.25f;
                Sandbox.Graphics.Render.MyPostProcessVolumetricSSAO2.Contrast = 2.617f;
                Sandbox.Graphics.Render.MyPostProcessVolumetricSSAO2.NormValue = 0.075f;

                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Brightness = 0;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Contrast = 0;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.LuminanceExposure = 0;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.BloomExposure = 0;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.BloomMult = 0.1f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.EyeAdaptationTau = 6;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.MiddleGreyAt0 = 0.068f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.MiddleGreyCurveSharpness = 4.36f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.LogLumThreshold = -6.0f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.BlueShiftRapidness = 0;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.BlueShiftScale = 0;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Tonemapping_A = 0.748f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Tonemapping_B = 0.324f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Tonemapping_C = 0.143f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Tonemapping_D = 0.196f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Tonemapping_E = 0.009f;
                Sandbox.Graphics.Render.MyPostprocessSettingsWrapper.Settings.Tonemapping_F = 0.130f;

                
            }

            if (MyFakes.DETECT_LEAKS)
            {
                //Slow down
                SharpDX.Configuration.EnableObjectTracking = true;
                //SharpDX.Diagnostics.ObjectTracker.OnObjectCreated += new SharpDX.Diagnostics.ObjectTracker.ComObjectDelegate(OnResourceCreated);
                //SharpDX.Diagnostics.ObjectTracker.OnObjectReleased += new SharpDX.Diagnostics.ObjectTracker.ComObjectDelegate(OnResourceDestroyed);
                //SharpDX.Diagnostics.ObjectTracker.OnObjectTrack += new SharpDX.Diagnostics.ObjectTracker.ComObjectDelegate(OnObjectTrack);
                //SharpDX.Diagnostics.ObjectTracker.OnObjectUnTrack += new SharpDX.Diagnostics.ObjectTracker.ComObjectDelegate(OnObjectUnTrack);
            }

            RunInternal(args);

            if (MyFakes.DETECT_LEAKS)
            {
                var o = SharpDX.Diagnostics.ObjectTracker.FindActiveObjects();
                System.Diagnostics.Debug.Assert(o.Count == 0, "Unreleased DX objects!");
                Console.WriteLine(SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects());
            }

#if PROFILING
            MyPerformanceTimer.WriteToLog();
#endif
            MyInitializer.InvokeAfterRun();
        }
コード例 #3
0
ファイル: Agent.cs プロジェクト: Redmancometh/ILHook
 public void seHook(Type caller)
 {
     Console.WriteLine("Type init to initialize space engineers...");
     bool breakCondition = false;
     while(!breakCondition)
     {
         switch(readInput())
         {
             case InputResponse.START:
                 breakCondition = true;
                 break;
             case InputResponse.NOTHING:
                 break;
             case InputResponse.EXIT:
                 return;
         }
     }
     MySingleProgramInstance mySingleProgramInstance = new MySingleProgramInstance(MyFileSystem.MainAssemblyName);
     MyInitializer.InvokeBeforeRun(244850u, "SpaceEngineers", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SpaceEngineers"), false);
     MethodInfo initSplashScreen = caller.GetMethod("RunInternal", BindingFlags.NonPublic |BindingFlags.Static);
     if(initSplashScreen!=null)
     {
         try
         {
             String[] innerArgs = null;
             initSplashScreen.Invoke(null, new object[] { innerArgs });
         }
         catch(Exception e)
         {
             Console.WriteLine(e);
         }
     }
     while (true)
     {
         Console.WriteLine("Done with stuff");
         Thread.Sleep(30000);
         break;
     }
 }