Example #1
0
        private void CheckDx11AndStart()
        {
            bool needsDx11 = (m_scenarioTypesGroup.SelectedButton as MyGuiControlScenarioButton).Scenario.HasPlanets;

            if (!needsDx11)
            {
                StartNewSandbox();
            }
            else if (MySandboxGame.IsDirectX11)
            {
                StartNewSandbox();
            }
            else if (MyDirectXHelper.IsDx11Supported())
            {
                // Has DX11, ask for switch or selecting different scenario
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           callback: OnSwitchAnswer,
                                           messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                           messageText: MyTexts.Get(MySpaceTexts.QuickstartDX11SwitchQuestion),
                                           buttonType: MyMessageBoxButtonsType.YES_NO));
            }
            else
            {
                // No DX11, ask for selecting another scenario
                var text = MyTexts.Get(MySpaceTexts.QuickstartNoDx9SelectDifferent);
                MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(mb);
            }
        }
Example #2
0
        private static MyProcessStartAnalytics GetProcessStartAnalyticsData()
        {
            MyProcessStartAnalytics data = new MyProcessStartAnalytics();

            try
            {
                var cpus = new ManagementObjectSearcher("root\\CIMV2", "SELECT Name FROM Win32_Processor").Get();
                // We're just reporting the first
                var cpuName = cpus.Cast <ManagementObject>().First()["Name"].ToString();

                var memoryInfo = new WinApi.MEMORYSTATUSEX();
                WinApi.GlobalMemoryStatusEx(memoryInfo);

                MyAdapterInfo gpu        = MyVideoSettingsManager.Adapters[MyVideoSettingsManager.CurrentDeviceSettings.AdapterOrdinal];
                var           deviceName = gpu.Name;

                data.ProcessorCount               = (byte)Environment.ProcessorCount;
                data.OsVersion                    = Environment.OSVersion.VersionString;
                data.CpuInfo                      = cpuName;
                data.OsPlatform                   = Environment.Is64BitOperatingSystem ? "64bit" : "32bit";
                data.HasDX11                      = MyDirectXHelper.IsDx11Supported();
                data.GameVersion                  = MyFinalBuildConstants.APP_VERSION_STRING.ToString();
                data.TotalPhysMemBytes            = memoryInfo.ullTotalPhys;
                data.GpuInfo                      = new MyGraphicsInfo();
                data.GpuInfo.AnisotropicFiltering = MyVideoSettingsManager.CurrentGraphicsSettings.Render.AnisotropicFiltering.ToString();
                data.GpuInfo.AntialiasingMode     = MyVideoSettingsManager.CurrentGraphicsSettings.Render.AntialiasingMode.ToString();
                data.GpuInfo.FoliageDetails       = MyVideoSettingsManager.CurrentGraphicsSettings.Render.FoliageDetails.ToString();
                data.GpuInfo.ShadowQuality        = MyVideoSettingsManager.CurrentGraphicsSettings.Render.ShadowQuality.ToString();
                data.GpuInfo.TextureQuality       = MyVideoSettingsManager.CurrentGraphicsSettings.Render.TextureQuality.ToString();
                data.GpuInfo.VoxelQuality         = MyVideoSettingsManager.CurrentGraphicsSettings.Render.VoxelQuality.ToString();
                data.GpuInfo.GrassDensityFactor   = MyVideoSettingsManager.CurrentGraphicsSettings.Render.GrassDensityFactor;
                data.GpuInfo.GPUModelName         = gpu.DeviceName;
                data.GpuInfo.GPUMemory            = gpu.VRAM;
                data.AudioInfo.MusicVolume        = MySandboxGame.Config.MusicVolume;
                data.AudioInfo.SoundVolume        = MySandboxGame.Config.GameVolume;
                data.AudioInfo.HudWarnings        = MySandboxGame.Config.HudWarnings;
                data.AudioInfo.MuteWhenNotInFocus = MySandboxGame.Config.EnableMuteWhenNotInFocus;
                data.Fullscreen                   = MyVideoSettingsManager.CurrentDeviceSettings.WindowMode.ToString();
                data.Resolution                   = MySandboxGame.Config.ScreenWidth.ToString() + " x " + MySandboxGame.Config.ScreenHeight.ToString();
            }
            catch (Exception exception)
            {
                MyLog.Default.WriteLine(exception);
            }

            return(data);
        }
Example #3
0
 public static void HandleDx11Needed()
 {
     MySessionLoader.UnloadAndExitToMenu();
     if (MyDirectXHelper.IsDx11Supported())
     {
         // Has DX11, ask for switch or selecting different scenario
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                    callback: OnDX11SwitchRequestAnswer,
                                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                    messageText: MyTexts.Get(MySpaceTexts.QuickstartDX11SwitchQuestion),
                                    buttonType: MyMessageBoxButtonsType.YES_NO));
     }
     else
     {
         // No DX11, ask for selecting another scenario
         var text = MyTexts.Get(MySpaceTexts.QuickstartNoDx9SelectDifferent);
         MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
         MyGuiSandbox.AddScreen(mb);
     }
 }
Example #4
0
 protected virtual void StartQuickstart()
 {
     // TODO: Move to derived screen in SpaceEngineers.Game
     if (MySandboxGame.IsDirectX11) // Running DirectX11, start planet quickstart
     {
         QuickstartSandbox(GetQuickstartSettings(), CreatePlanetQuickstartArgs());
     }
     else if (MyDirectXHelper.IsDx11Supported()) // DirectX11 not enabled, messagebox
     {
         MyScreenManager.RemoveAllScreensExcept(null);
         var text = MyTexts.Get(MySpaceTexts.QuickstartDX11SwitchQuestion);
         MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), buttonType: MyMessageBoxButtonsType.YES_NO, callback: MessageBoxSwitchCallback);
         MyGuiSandbox.AddScreen(mb);
     }
     else // DirectX11 not supported, show message, start easy start 1
     {
         MyScreenManager.RemoveAllScreensExcept(null);
         var text = MyTexts.Get(MySpaceTexts.QuickstartDX11NotAvailable);
         MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), callback: StartNoPlanetsOK);
         MyGuiSandbox.AddScreen(mb);
     }
 }
Example #5
0
        protected virtual Dictionary <string, object> GetSessionData()
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            try
            {
                dictionary["game_version"] = MyPerGameSettings.BasicGameInfo.GameVersion.ToString();
                dictionary["game_branch"]  = MyGameService.BranchNameFriendly;
                string str = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Name FROM Win32_Processor").Get().Cast <ManagementObject>().First <ManagementObject>()["Name"].ToString();
                dictionary["cpu_info"]            = str;
                dictionary["cpu_number_of_cores"] = Environment.ProcessorCount;
                WinApi.MEMORYSTATUSEX lpBuffer = new WinApi.MEMORYSTATUSEX();
                WinApi.GlobalMemoryStatusEx(lpBuffer);
                dictionary["ram_size"] = (lpBuffer.ullTotalPhys / ((ulong)0x400L)) / ((ulong)0x400L);
                if (!Sandbox.Engine.Platform.Game.IsDedicated)
                {
                    MyAdapterInfo info = MyVideoSettingsManager.Adapters[MyVideoSettingsManager.CurrentDeviceSettings.AdapterOrdinal];
                    dictionary["gpu_name"]           = info.Name;
                    dictionary["gpu_memory"]         = (info.VRAM / ((ulong)0x400L)) / ((ulong)0x400L);
                    dictionary["gpu_driver_version"] = info.DriverVersion;
                }
                dictionary["os_info"]      = Environment.OSVersion.VersionString;
                dictionary["os_platform"]  = Environment.Is64BitOperatingSystem ? "64bit" : "32bit";
                dictionary["dx11_support"] = Sandbox.Engine.Platform.Game.IsDedicated ? ((object)1) : ((object)MyDirectXHelper.IsDx11Supported());
                dictionary["is_first_run"] = this.m_firstRun;
                dictionary["is_dedicated"] = Sandbox.Engine.Platform.Game.IsDedicated;
                if (!Sandbox.Engine.Platform.Game.IsDedicated)
                {
                    dictionary["display_resolution"]                  = MySandboxGame.Config.ScreenWidth.ToString() + " x " + MySandboxGame.Config.ScreenHeight.ToString();
                    dictionary["display_window_mode"]                 = MyVideoSettingsManager.CurrentDeviceSettings.WindowMode.ToString();
                    dictionary["graphics_anisotropic_filtering"]      = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.AnisotropicFiltering.ToString();
                    dictionary["graphics_antialiasing_mode"]          = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.AntialiasingMode.ToString();
                    dictionary["graphics_shadow_quality"]             = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.ShadowQuality.ToString();
                    dictionary["graphics_texture_quality"]            = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.TextureQuality.ToString();
                    dictionary["graphics_voxel_quality"]              = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.VoxelQuality.ToString();
                    dictionary["graphics_grass_density_factor"]       = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.GrassDensityFactor;
                    dictionary["graphics_grass_draw_distance"]        = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.GrassDrawDistance;
                    dictionary["graphics_flares_intensity"]           = MyVideoSettingsManager.CurrentGraphicsSettings.FlaresIntensity;
                    dictionary["graphics_voxel_shader_quality"]       = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.VoxelShaderQuality;
                    dictionary["graphics_alphamasked_shader_quality"] = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.AlphaMaskedShaderQuality;
                    dictionary["graphics_atmosphere_shader_quality"]  = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.AtmosphereShaderQuality;
                    dictionary["graphics_distance_fade"]              = MyVideoSettingsManager.CurrentGraphicsSettings.PerformanceSettings.RenderSettings.DistanceFade;
                    dictionary["audio_music_volume"]                  = MySandboxGame.Config.MusicVolume;
                    dictionary["audio_sound_volume"]                  = MySandboxGame.Config.GameVolume;
                    dictionary["audio_mute_when_not_in_focus"]        = MySandboxGame.Config.EnableMuteWhenNotInFocus;
                }
            }
            catch (Exception exception)
            {
                dictionary["failed_to_get_data"] = exception.Message + "\n" + exception.StackTrace;
            }
            return(dictionary);
        }