Build config stuff, launcher stuff

This commit is contained in:
John Michael Gross
2016-09-26 22:19:48 -07:00
parent 7488384fb8
commit bca4efb09b
11 changed files with 108 additions and 163 deletions

View File

@@ -8,8 +8,8 @@
Title="Piston Launcher" ResizeMode="NoResize" Height="220" Width="400">
<StackPanel Orientation="Vertical">
<Label FontSize="50" Content="Piston Launcher" HorizontalAlignment="Center"/>
<Button x:Name="LaunchBtn" FontSize="20" Height="30" Content="Launch" Margin="5,5,5,5" Click="LaunchBtn_Click"/>
<Button x:Name="UpdateBtn" FontSize="20" Height="30" Content="Install/Update" Margin="5,5,5,5" Click="UpdateBtn_Click"/>
<Button x:Name="LaunchBtn" FontSize="15" Height="25" Content="Launch" Margin="5,5,5,5" Click="LaunchBtn_Click"/>
<Button x:Name="UpdateBtn" FontSize="15" Height="25" Content="Install/Update" Margin="5,5,5,5" Click="UpdateBtn_Click"/>
<Label x:Name="InfoLabel" Margin="5,5,5,5" HorizontalAlignment="Center"/>
</StackPanel>
</Window>

View File

@@ -14,6 +14,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.IO;
using System.Reflection;
using Microsoft.Win32;
namespace Piston.Launcher
@@ -25,6 +26,7 @@ namespace Piston.Launcher
{
private Config _config;
private PistonFileManager _fileManager;
public MainWindow()
{
InitializeComponent();
@@ -33,6 +35,7 @@ namespace Piston.Launcher
_fileManager = new PistonFileManager(_config.RemoteFilePath);
CheckSpaceDirectory();
CheckSEBranch();
UpdatePistonFiles();
}
@@ -59,6 +62,23 @@ namespace Piston.Launcher
return false;
}
private void CheckSEBranch()
{
try
{
var seAsm = Assembly.LoadFrom(Path.Combine(_config.SpaceDirectory, "VRage.Game.dll"));
MessageBox.Show("found SE assembly");
var gameType = seAsm.ExportedTypes.First(x => x.Name == "MyFinalBuildConstants");
MessageBox.Show("found build constant class");
var stable = (bool)gameType.GetField("IS_STABLE", BindingFlags.Public | BindingFlags.Static).GetValue(null);
this.Title += $"SE Branch: {(stable ? "Stable" : "Develop")}";
}
catch (Exception e)
{
MessageBox.Show("Unable to check SE branch.\n\n" + e.Message + "\n\n" + e.StackTrace);
}
}
private void UpdatePistonFiles()
{
var i = 0;

View File

@@ -16,25 +16,6 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>

View File

@@ -17,60 +17,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piston.Launcher", "Piston.L
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E01635C-3B67-472E-BCD6-C5539564F214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E01635C-3B67-472E-BCD6-C5539564F214}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E01635C-3B67-472E-BCD6-C5539564F214}.Debug|x64.ActiveCfg = Debug|x64
{7E01635C-3B67-472E-BCD6-C5539564F214}.Debug|x64.Build.0 = Debug|x64
{7E01635C-3B67-472E-BCD6-C5539564F214}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E01635C-3B67-472E-BCD6-C5539564F214}.Release|Any CPU.Build.0 = Release|Any CPU
{7E01635C-3B67-472E-BCD6-C5539564F214}.Release|x64.ActiveCfg = Release|x64
{7E01635C-3B67-472E-BCD6-C5539564F214}.Release|x64.Build.0 = Release|x64
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Debug|x64.ActiveCfg = Debug|x64
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Debug|x64.Build.0 = Debug|x64
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Release|Any CPU.Build.0 = Release|Any CPU
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Release|x64.ActiveCfg = Release|x64
{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}.Release|x64.Build.0 = Release|x64
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Debug|x64.ActiveCfg = Debug|x64
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Debug|x64.Build.0 = Debug|x64
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Release|Any CPU.Build.0 = Release|Any CPU
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Release|x64.ActiveCfg = Release|x64
{E36DF745-260B-4956-A2E8-09F08B2E7161}.Release|x64.Build.0 = Release|x64
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Debug|x64.ActiveCfg = Debug|x64
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Debug|x64.Build.0 = Debug|x64
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Release|Any CPU.Build.0 = Release|Any CPU
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Release|x64.ActiveCfg = Release|x64
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Release|x64.Build.0 = Release|x64
{BF0D9941-B488-4880-B378-A9BF942D140D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF0D9941-B488-4880-B378-A9BF942D140D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF0D9941-B488-4880-B378-A9BF942D140D}.Debug|x64.ActiveCfg = Debug|x64
{BF0D9941-B488-4880-B378-A9BF942D140D}.Debug|x64.Build.0 = Debug|x64
{BF0D9941-B488-4880-B378-A9BF942D140D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF0D9941-B488-4880-B378-A9BF942D140D}.Release|Any CPU.Build.0 = Release|Any CPU
{BF0D9941-B488-4880-B378-A9BF942D140D}.Release|x64.ActiveCfg = Release|x64
{BF0D9941-B488-4880-B378-A9BF942D140D}.Release|x64.Build.0 = Release|x64
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Debug|x64.ActiveCfg = Debug|x64
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Debug|x64.Build.0 = Debug|x64
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Release|Any CPU.Build.0 = Release|Any CPU
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Release|x64.ActiveCfg = Release|Any CPU
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Release|x64.Build.0 = Release|Any CPU
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Release|x64.ActiveCfg = Release|x64
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -13,23 +13,6 @@
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>

View File

@@ -13,23 +13,6 @@
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>

View File

@@ -16,25 +16,6 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
@@ -101,6 +82,7 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Include="PistonSettingsScreen.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sandbox.Graphics.GUI;
using VRage.Utils;
using VRageMath;
namespace Piston.Client
{
public class PistonSettingsScreen : MyGuiScreenBase
{
public override string GetFriendlyName() => "Piston Settings";
public PistonSettingsScreen() : base(new Vector2(0.5f), null, new Vector2(0.5f), true, null, 0f, 0f)
{
this.BackgroundColor = new Vector4(0);
RecreateControls(true);
}
/// <inheritdoc />
public override void RecreateControls(bool constructor)
{
base.RecreateControls(constructor);
AddCaption(MyStringId.GetOrCompute("Piston Settings"));
}
}
}

View File

@@ -1,19 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Windows;
using Sandbox;
using Sandbox.Engine.Platform;
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
{
@@ -29,6 +34,7 @@ namespace Piston.Client
private static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
if (!File.Exists("steam_appid.txt"))
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(typeof(VRage.FastResourceLock).Assembly.Location) + "\\..");
@@ -58,6 +64,7 @@ namespace Piston.Client
{
_renderer = null;
SpaceEngineersGame.SetupPerGameSettings();
SpaceEngineersGame.SetupRender();
try
{
@@ -85,13 +92,27 @@ namespace Piston.Client
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)
{
Logger.Write("Adding button to main menu");
menu.Controls.Add(new MyGuiControlImageButton("PistonButton", text: new StringBuilder("Piston"), size: new Vector2(20), position: new Vector2(0)));
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);
}
}
@@ -105,6 +126,8 @@ namespace Piston.Client
}
private static void InitializeRender()
{
try
{
if (Game.IsDedicated)
{
@@ -133,5 +156,11 @@ namespace Piston.Client
MyRenderProxy.GetRenderProfiler().SetAutocommit(false);
MyRenderProxy.GetRenderProfiler().InitMemoryHack("MainEntryPoint");
}
catch (TypeLoadException)
{
MessageBox.Show("This version of Piston does not run on the Stable branch.", "Initialization Error");
Environment.Exit(-1);
}
}
}
}

View File

@@ -16,25 +16,6 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>

View File

@@ -13,23 +13,6 @@
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>