Introduce new OpenRA.exe entrypoint and change OpenRA.Game to a library.

This commit is contained in:
Paul Chote
2020-11-22 11:52:00 +00:00
committed by teinarss
parent 20fe59e844
commit 07a10069db
17 changed files with 130 additions and 63 deletions

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<TargetFramework>net472</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
@@ -31,34 +31,13 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatform)' == 'win-x86'">
<Prefer32bit>true</Prefer32bit>
</PropertyGroup>
<PropertyGroup Condition="'$(RunConfiguration)' == 'Red Alert'">
<StartAction>Project</StartAction>
<StartArguments>Engine.EngineDir=".." Game.Mod=ra</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(RunConfiguration)' == 'Dune 2000'">
<StartAction>Project</StartAction>
<StartArguments>Engine.EngineDir=".." Game.Mod=d2k</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(RunConfiguration)' == 'Tiberian Dawn'">
<StartAction>Project</StartAction>
<StartArguments>Engine.EngineDir=".." Game.Mod=cnc</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(RunConfiguration)' == 'Tiberian Sun'">
<StartAction>Project</StartAction>
<StartArguments>Engine.EngineDir=".." Game.Mod=ts</StartArguments>
</PropertyGroup>
<ItemGroup>
<None Include="App.config" />
<PackageReference Include="OpenRA-Eluant" Version="1.0.17" />
<PackageReference Include="OpenRA-Open.NAT" Version="1.0.0" />
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<AdditionalFiles Include="../stylecop.json" />
<AdditionalFiles Include="Properties/launchSettings.json" />
</ItemGroup>
<Target Name="DisableAnalyzers" BeforeTargets="CoreCompile" Condition="'$(Configuration)'=='Release'">
<!-- Disable code style analysis on Release builds to improve compile-time performance -->

View File

@@ -1,20 +0,0 @@
{
"profiles": {
"Tiberian Dawn": {
"commandName": "Project",
"commandLineArgs": "Engine.EngineDir=\"..\" Game.Mod=cnc"
},
"Red Alert": {
"commandName": "Project",
"commandLineArgs": "Engine.EngineDir=\"..\" Game.Mod=ra"
},
"Dune 2000": {
"commandName": "Project",
"commandLineArgs": "Engine.EngineDir=\"..\" Game.Mod=d2k"
},
"Tiberian Sun": {
"commandName": "Project",
"commandLineArgs": "Engine.EngineDir=\"..\" Game.Mod=ts"
}
}
}

View File

@@ -21,26 +21,4 @@ namespace OpenRA
Success = 0,
Running = int.MaxValue
}
static class Program
{
[STAThread]
static int Main(string[] args)
{
if (Debugger.IsAttached || args.Contains("--just-die"))
return (int)Game.InitializeAndRun(args);
AppDomain.CurrentDomain.UnhandledException += (_, e) => ExceptionHandler.HandleFatalError((Exception)e.ExceptionObject);
try
{
return (int)Game.InitializeAndRun(args);
}
catch (Exception e)
{
ExceptionHandler.HandleFatalError(e);
return (int)RunStatus.Error;
}
}
}
}