idk i wrote this 3 weeks ago
This commit is contained in:
@@ -123,14 +123,15 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ConnectionState.cs" />
|
<Compile Include="ConnectionState.cs" />
|
||||||
<Compile Include="Logger.cs" />
|
<Compile Include="Logger.cs" />
|
||||||
|
<Compile Include="PistonPlugin.cs" />
|
||||||
<Compile Include="PlayerInfo.cs" />
|
<Compile Include="PlayerInfo.cs" />
|
||||||
<Compile Include="PlayerInfoCache.cs" />
|
<Compile Include="Collections\PlayerInfoCache.cs" />
|
||||||
<Compile Include="SteamService.cs" />
|
<Compile Include="SteamService.cs" />
|
||||||
<Compile Include="ViewModels\ModViewModel.cs" />
|
<Compile Include="ViewModels\ModViewModel.cs" />
|
||||||
<Compile Include="MTObservableCollection.cs" />
|
<Compile Include="Collections\MTObservableCollection.cs" />
|
||||||
<Compile Include="MyPlayerCollectionExtensions.cs" />
|
<Compile Include="Extensions\MyPlayerCollectionExtensions.cs" />
|
||||||
<Compile Include="SteamHelper.cs" />
|
<Compile Include="SteamHelper.cs" />
|
||||||
<Compile Include="StringExtensions.cs" />
|
<Compile Include="Extensions\StringExtensions.cs" />
|
||||||
<Compile Include="ViewModels\ViewModel.cs" />
|
<Compile Include="ViewModels\ViewModel.cs" />
|
||||||
<Compile Include="PluginManager.cs" />
|
<Compile Include="PluginManager.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
@@ -142,6 +143,7 @@
|
|||||||
<Name>Piston.API</Name>
|
<Name>Piston.API</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
13
Piston/PistonPlugin.cs
Normal file
13
Piston/PistonPlugin.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Piston
|
||||||
|
{
|
||||||
|
public class PistonPlugin
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
158
PistonClient/GameInitializer.cs
Normal file
158
PistonClient/GameInitializer.cs
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using Sandbox;
|
||||||
|
using Sandbox.Game;
|
||||||
|
using Sandbox.Game.Gui;
|
||||||
|
using Sandbox.Graphics;
|
||||||
|
using Sandbox.Graphics.GUI;
|
||||||
|
using Sandbox.Gui;
|
||||||
|
using SpaceEngineers.Game;
|
||||||
|
using SpaceEngineers.Game.GUI;
|
||||||
|
using VRage.FileSystem;
|
||||||
|
using VRage.Game;
|
||||||
|
using VRage.Input;
|
||||||
|
using VRage.Utils;
|
||||||
|
using VRageRender;
|
||||||
|
using Game = Sandbox.Engine.Platform.Game;
|
||||||
|
|
||||||
|
namespace Piston.Client
|
||||||
|
{
|
||||||
|
public class GameInitializer
|
||||||
|
{
|
||||||
|
private MyCommonProgramStartup _startup;
|
||||||
|
private IMyRender _renderer;
|
||||||
|
private const uint APP_ID = 244850;
|
||||||
|
private PluginManager _pluginManager;
|
||||||
|
private readonly string[] _args;
|
||||||
|
private VRageGameServices _services;
|
||||||
|
|
||||||
|
public GameInitializer(string[] args)
|
||||||
|
{
|
||||||
|
_args = args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TryInit()
|
||||||
|
{
|
||||||
|
if (!File.Exists("steam_appid.txt"))
|
||||||
|
{
|
||||||
|
Directory.SetCurrentDirectory(Path.GetDirectoryName(typeof(VRage.FastResourceLock).Assembly.Location) + "\\..");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add myself to the credits because I'm awesome.
|
||||||
|
var credits = new MyCreditsDepartment("Piston Developed By") { Persons = new List<MyCreditsPerson> { new MyCreditsPerson("JIMMACLE") } };
|
||||||
|
MyPerGameSettings.Credits.Departments.Add(credits);
|
||||||
|
|
||||||
|
SpaceEngineersGame.SetupBasicGameInfo();
|
||||||
|
_startup = new MyCommonProgramStartup(_args);
|
||||||
|
if (_startup.PerformReporting())
|
||||||
|
return;
|
||||||
|
|
||||||
|
_startup.PerformAutoconnect();
|
||||||
|
if (!_startup.CheckSingleInstance())
|
||||||
|
return;
|
||||||
|
|
||||||
|
var appDataPath = _startup.GetAppDataPath();
|
||||||
|
MyInitializer.InvokeBeforeRun(APP_ID, MyPerGameSettings.BasicGameInfo.ApplicationName, appDataPath, false);
|
||||||
|
MyInitializer.InitCheckSum();
|
||||||
|
if (!_startup.Check64Bit())
|
||||||
|
return;
|
||||||
|
|
||||||
|
_startup.DetectSharpDxLeaksBeforeRun();
|
||||||
|
using (var mySteamService = new SteamService(Game.IsDedicated, APP_ID))
|
||||||
|
{
|
||||||
|
_renderer = null;
|
||||||
|
SpaceEngineersGame.SetupPerGameSettings();
|
||||||
|
|
||||||
|
InitializeRender();
|
||||||
|
|
||||||
|
_services = new VRageGameServices(mySteamService);
|
||||||
|
if (!Game.IsDedicated)
|
||||||
|
MyFileSystem.InitUserSpecific(mySteamService.UserId.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
_startup.DetectSharpDxLeaksAfterRun();
|
||||||
|
MyInitializer.InvokeAfterRun();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RunGame()
|
||||||
|
{
|
||||||
|
using (var spaceEngineersGame = new SpaceEngineersGame(_services, _args))
|
||||||
|
{
|
||||||
|
Logger.Write("Starting SE...");
|
||||||
|
spaceEngineersGame.OnGameLoaded += SpaceEngineersGame_OnGameLoaded;
|
||||||
|
MyGuiSandbox.GuiControlCreated += GuiControlCreated;
|
||||||
|
spaceEngineersGame.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GuiControlCreated(object o)
|
||||||
|
{
|
||||||
|
var menu = o as MyGuiScreenMainMenu;
|
||||||
|
if (menu != null)
|
||||||
|
{
|
||||||
|
var pistonBtn = new MyGuiControlImageButton
|
||||||
|
{
|
||||||
|
Name = "PistonButton",
|
||||||
|
Text = "Piston",
|
||||||
|
HighlightType = MyGuiControlHighlightType.WHEN_CURSOR_OVER,
|
||||||
|
Visible = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
menu.Controls.Add(pistonBtn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SpaceEngineersGame_OnGameLoaded(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_pluginManager = new PluginManager();
|
||||||
|
_pluginManager.LoadAllPlugins();
|
||||||
|
|
||||||
|
//Fix Marek's name.
|
||||||
|
MyPerGameSettings.Credits.Departments[1].Persons[0].Name.Clear().Append("MEARK ROAS");
|
||||||
|
MyScreenManager.AddScreen(new PistonConsoleScreen());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeRender()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Game.IsDedicated)
|
||||||
|
{
|
||||||
|
_renderer = new MyNullRender();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var graphicsRenderer = MySandboxGame.Config.GraphicsRenderer;
|
||||||
|
if (graphicsRenderer == MySandboxGame.DirectX11RendererKey)
|
||||||
|
{
|
||||||
|
_renderer = new MyDX11Render();
|
||||||
|
if (!_renderer.IsSupported)
|
||||||
|
{
|
||||||
|
MySandboxGame.Log.WriteLine("DirectX 11 renderer not supported. No renderer to revert back to.");
|
||||||
|
_renderer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_renderer == null)
|
||||||
|
throw new MyRenderException("The current version of the game requires a Dx11 card. \\n For more information please see : http://blog.marekrosa.org/2016/02/space-engineers-news-full-source-code_26.html", MyRenderExceptionEnum.GpuNotSupported);
|
||||||
|
|
||||||
|
MySandboxGame.Config.GraphicsRenderer = graphicsRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyRenderProxy.Initialize(_renderer);
|
||||||
|
MyRenderProxy.IS_OFFICIAL = true;
|
||||||
|
MyRenderProxy.GetRenderProfiler().SetAutocommit(false);
|
||||||
|
MyRenderProxy.GetRenderProfiler().InitMemoryHack("MainEntryPoint");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Render Initialization Failed");
|
||||||
|
Environment.Exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -64,6 +64,10 @@
|
|||||||
<Reference Include="VRage.Game">
|
<Reference Include="VRage.Game">
|
||||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Game.dll</HintPath>
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Game.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="VRage.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Input.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="VRage.Library">
|
<Reference Include="VRage.Library">
|
||||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Library.dll</HintPath>
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Library.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -82,6 +86,8 @@
|
|||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="GameInitializer.cs" />
|
||||||
|
<Compile Include="PistonConsoleScreen.cs" />
|
||||||
<Compile Include="PistonSettingsScreen.cs" />
|
<Compile Include="PistonSettingsScreen.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
63
PistonClient/PistonConsoleScreen.cs
Normal file
63
PistonClient/PistonConsoleScreen.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using Sandbox.Graphics;
|
||||||
|
using Sandbox.Graphics.GUI;
|
||||||
|
using Sandbox.Gui;
|
||||||
|
using VRage.Utils;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Piston.Client
|
||||||
|
{
|
||||||
|
public class PistonConsoleScreen : MyGuiScreenBase
|
||||||
|
{
|
||||||
|
private MyGuiControlTextbox _textBox;
|
||||||
|
|
||||||
|
public override string GetFriendlyName()
|
||||||
|
{
|
||||||
|
return "Piston Console";
|
||||||
|
}
|
||||||
|
|
||||||
|
public PistonConsoleScreen() : base(isTopMostScreen: true)
|
||||||
|
{
|
||||||
|
BackgroundColor = new Vector4(0, 0, 0, 0.5f);
|
||||||
|
Size = new Vector2(0.5f);
|
||||||
|
RecreateControls(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override void RecreateControls(bool constructor)
|
||||||
|
{
|
||||||
|
Elements.Clear();
|
||||||
|
Elements.Add(new MyGuiControlLabel
|
||||||
|
{
|
||||||
|
Text = "Piston Console",
|
||||||
|
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
|
||||||
|
Position = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
|
||||||
|
});
|
||||||
|
|
||||||
|
Controls.Clear();
|
||||||
|
_textBox = new MyGuiControlTextbox
|
||||||
|
{
|
||||||
|
BorderEnabled = false,
|
||||||
|
Enabled = true,
|
||||||
|
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
|
||||||
|
Position = new Vector2(-0.5f)
|
||||||
|
};
|
||||||
|
Controls.Add(_textBox);
|
||||||
|
|
||||||
|
var pistonBtn = new MyGuiControlImageButton
|
||||||
|
{
|
||||||
|
Name = "PistonButton",
|
||||||
|
Text = "Piston",
|
||||||
|
HighlightType = MyGuiControlHighlightType.WHEN_CURSOR_OVER,
|
||||||
|
Visible = true,
|
||||||
|
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
|
||||||
|
};
|
||||||
|
|
||||||
|
Controls.Add(pistonBtn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -19,8 +19,7 @@ namespace Piston.Client
|
|||||||
RecreateControls(true);
|
RecreateControls(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
public sealed override void RecreateControls(bool constructor)
|
||||||
public override void RecreateControls(bool constructor)
|
|
||||||
{
|
{
|
||||||
base.RecreateControls(constructor);
|
base.RecreateControls(constructor);
|
||||||
AddCaption(MyStringId.GetOrCompute("Piston Settings"));
|
AddCaption(MyStringId.GetOrCompute("Piston Settings"));
|
||||||
|
@@ -1,166 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Sandbox;
|
|
||||||
using Sandbox.Game;
|
|
||||||
using SpaceEngineers.Game;
|
|
||||||
using VRage.FileSystem;
|
|
||||||
using VRageRender;
|
|
||||||
using Piston;
|
|
||||||
using Sandbox.Game.Gui;
|
|
||||||
using Sandbox.Graphics;
|
|
||||||
using Sandbox.Graphics.GUI;
|
|
||||||
using Sandbox.Gui;
|
|
||||||
using VRage.Game;
|
|
||||||
using VRage.Utils;
|
|
||||||
using VRageMath;
|
|
||||||
using Game = Sandbox.Engine.Platform.Game;
|
|
||||||
using MessageBoxResult = System.Windows.MessageBoxResult;
|
|
||||||
|
|
||||||
namespace Piston.Client
|
namespace Piston.Client
|
||||||
{
|
{
|
||||||
/// <summary>
|
public static class Program
|
||||||
/// This is nearly all Keen's code.
|
|
||||||
/// </summary>
|
|
||||||
public static class MyProgram
|
|
||||||
{
|
{
|
||||||
private static MyCommonProgramStartup _startup;
|
public static void Main(string[] args)
|
||||||
private static IMyRender _renderer;
|
|
||||||
private static readonly uint AppId = 244850u;
|
|
||||||
private static PluginManager _pluginManager;
|
|
||||||
|
|
||||||
private static void Main(string[] args)
|
|
||||||
{
|
{
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
var game = new GameInitializer(args);
|
||||||
if (!File.Exists("steam_appid.txt"))
|
|
||||||
{
|
|
||||||
Directory.SetCurrentDirectory(Path.GetDirectoryName(typeof(VRage.FastResourceLock).Assembly.Location) + "\\..");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add myself to the credits because I'm awesome.
|
|
||||||
var credits = new MyCreditsDepartment("Piston Developed By") {Persons = new List<MyCreditsPerson> {new MyCreditsPerson("JIMMACLE")}};
|
|
||||||
MyPerGameSettings.Credits.Departments.Add(credits);
|
|
||||||
|
|
||||||
SpaceEngineersGame.SetupBasicGameInfo();
|
|
||||||
_startup = new MyCommonProgramStartup(args);
|
|
||||||
if (_startup.PerformReporting())
|
|
||||||
return;
|
|
||||||
|
|
||||||
_startup.PerformAutoconnect();
|
|
||||||
if (!_startup.CheckSingleInstance())
|
|
||||||
return;
|
|
||||||
|
|
||||||
var appDataPath = _startup.GetAppDataPath();
|
|
||||||
MyInitializer.InvokeBeforeRun(AppId, MyPerGameSettings.BasicGameInfo.ApplicationName, appDataPath, false);
|
|
||||||
MyInitializer.InitCheckSum();
|
|
||||||
if (!_startup.Check64Bit())
|
|
||||||
return;
|
|
||||||
|
|
||||||
_startup.DetectSharpDxLeaksBeforeRun();
|
|
||||||
using (var mySteamService = new SteamService(Game.IsDedicated, AppId))
|
|
||||||
{
|
|
||||||
_renderer = null;
|
|
||||||
SpaceEngineersGame.SetupPerGameSettings();
|
|
||||||
|
|
||||||
SpaceEngineersGame.SetupRender();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
InitializeRender();
|
|
||||||
}
|
|
||||||
catch (MyRenderException ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var services = new VRageGameServices(mySteamService);
|
|
||||||
if (!Game.IsDedicated)
|
|
||||||
MyFileSystem.InitUserSpecific(mySteamService.UserId.ToString());
|
|
||||||
using (var spaceEngineersGame = new SpaceEngineersGame(services, args))
|
|
||||||
{
|
|
||||||
Logger.Write("Starting SE...");
|
|
||||||
spaceEngineersGame.OnGameLoaded += SpaceEngineersGame_OnGameLoaded;
|
|
||||||
MyGuiSandbox.GuiControlCreated += GuiControlCreated;
|
|
||||||
spaceEngineersGame.Run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_startup.DetectSharpDxLeaksAfterRun();
|
|
||||||
MyInitializer.InvokeAfterRun();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
||||||
{
|
|
||||||
var ex = (Exception)e.ExceptionObject;
|
|
||||||
MessageBox.Show($"PistonClient crashed. Go bug Jimmacle and send him a screenshot of this box!\n\n{ex.Message}\n{ex.StackTrace}", "Unhandled Exception");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void GuiControlCreated(object o)
|
|
||||||
{
|
|
||||||
var menu = o as MyGuiScreenMainMenu;
|
|
||||||
if (menu != null)
|
|
||||||
{
|
|
||||||
var pistonBtn = new MyGuiControlButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER), MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, null, new StringBuilder("Piston"), 1f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, null, GuiSounds.MouseClick, 1f, null, false);
|
|
||||||
pistonBtn.Visible = true;
|
|
||||||
//menu.Controls.Add(pistonBtn);
|
|
||||||
|
|
||||||
var scr = new PistonSettingsScreen();
|
|
||||||
scr.Controls.Add(pistonBtn);
|
|
||||||
|
|
||||||
MyScreenManager.AddScreen(scr);
|
|
||||||
//menu.Controls.Add(new MyGuiControlLabel(new Vector2(0.5f), new Vector2(0.5f), "Piston Enabled"));
|
|
||||||
//menu.RecreateControls(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SpaceEngineersGame_OnGameLoaded(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
_pluginManager = new PluginManager();
|
|
||||||
_pluginManager.LoadAllPlugins();
|
|
||||||
|
|
||||||
//Fix Marek's name.
|
|
||||||
MyPerGameSettings.Credits.Departments[1].Persons[0].Name.Clear().Append("MEARK ROAS");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InitializeRender()
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Game.IsDedicated)
|
game.TryInit();
|
||||||
{
|
|
||||||
_renderer = new MyNullRender();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var graphicsRenderer = MySandboxGame.Config.GraphicsRenderer;
|
|
||||||
if (graphicsRenderer == MySandboxGame.DirectX11RendererKey)
|
|
||||||
{
|
|
||||||
_renderer = new MyDX11Render();
|
|
||||||
if (!_renderer.IsSupported)
|
|
||||||
{
|
|
||||||
MySandboxGame.Log.WriteLine("DirectX 11 renderer not supported. No renderer to revert back to.");
|
|
||||||
_renderer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_renderer == null)
|
|
||||||
throw new MyRenderException("The current version of the game requires a Dx11 card. \\n For more information please see : http://blog.marekrosa.org/2016/02/space-engineers-news-full-source-code_26.html", MyRenderExceptionEnum.GpuNotSupported);
|
|
||||||
|
|
||||||
MySandboxGame.Config.GraphicsRenderer = graphicsRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
MyRenderProxy.Initialize(_renderer);
|
|
||||||
MyRenderProxy.IS_OFFICIAL = true;
|
|
||||||
MyRenderProxy.GetRenderProfiler().SetAutocommit(false);
|
|
||||||
MyRenderProxy.GetRenderProfiler().InitMemoryHack("MainEntryPoint");
|
|
||||||
}
|
}
|
||||||
catch (TypeLoadException)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("This version of Piston does not run on the Stable branch.", "Initialization Error");
|
MessageBox.Show($"Piston encountered an error trying to initialize the game.\n{e.Message}");
|
||||||
Environment.Exit(-1);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
game.RunGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user