diff --git a/Makefile b/Makefile index d7ede7c953..a00c4caedd 100644 --- a/Makefile +++ b/Makefile @@ -35,8 +35,7 @@ ############################## TOOLCHAIN ############################### # # List of .NET assemblies that we can guarantee exist -# OpenRA.Game.dll is a harmless false positive that we can ignore -WHITELISTED_OPENRA_ASSEMBLIES = OpenRA.Game.exe OpenRA.Utility.exe OpenRA.Platforms.Default.dll OpenRA.Mods.Common.dll OpenRA.Mods.Cnc.dll OpenRA.Mods.D2k.dll OpenRA.Game.dll +WHITELISTED_OPENRA_ASSEMBLIES = OpenRA.exe OpenRA.Utility.exe OpenRA.Server.exe OpenRA.Platforms.Default.dll OpenRA.Game.dll OpenRA.Mods.Common.dll OpenRA.Mods.Cnc.dll OpenRA.Mods.D2k.dll # These are explicitly shipped alongside our core files by the packaging script WHITELISTED_THIRDPARTY_ASSEMBLIES = ICSharpCode.SharpZipLib.dll FuzzyLogicLibrary.dll Eluant.dll BeaconLib.dll Open.Nat.dll SDL2-CS.dll OpenAL-CS.Core.dll DiscordRPC.dll Newtonsoft.Json.dll @@ -192,9 +191,10 @@ endif install-engine: @-echo "Installing OpenRA engine to $(DATA_INSTALL_DIR)" @$(INSTALL_DIR) "$(DATA_INSTALL_DIR)" - @$(INSTALL_PROGRAM) bin/OpenRA.Game.exe "$(DATA_INSTALL_DIR)" + @$(INSTALL_PROGRAM) bin/OpenRA.exe "$(DATA_INSTALL_DIR)" @$(INSTALL_PROGRAM) bin/OpenRA.Server.exe "$(DATA_INSTALL_DIR)" @$(INSTALL_PROGRAM) bin/OpenRA.Utility.exe "$(DATA_INSTALL_DIR)" + @$(INSTALL_PROGRAM) bin/OpenRA.Game.dll "$(DATA_INSTALL_DIR)" @$(INSTALL_PROGRAM) bin/OpenRA.Platforms.Default.dll "$(DATA_INSTALL_DIR)" ifneq ($(TARGETPLATFORM), $(filter $(TARGETPLATFORM),win-x86 win-x64)) diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index c8e12ddab4..c68f32ec5f 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -1,6 +1,6 @@  - Exe + Library net472 true true @@ -31,34 +31,13 @@ DEBUG;TRACE false - - true - - - Project - Engine.EngineDir=".." Game.Mod=ra - - - Project - Engine.EngineDir=".." Game.Mod=d2k - - - Project - Engine.EngineDir=".." Game.Mod=cnc - - - Project - Engine.EngineDir=".." Game.Mod=ts - - - diff --git a/OpenRA.Game/Support/Program.cs b/OpenRA.Game/Support/Program.cs index ed4a81ffa4..d18eb45ca3 100644 --- a/OpenRA.Game/Support/Program.cs +++ b/OpenRA.Game/Support/Program.cs @@ -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; - } - } - } } diff --git a/OpenRA.Game/App.config b/OpenRA.Launcher/App.config similarity index 88% rename from OpenRA.Game/App.config rename to OpenRA.Launcher/App.config index cab8f010ca..adf1bdf716 100644 --- a/OpenRA.Game/App.config +++ b/OpenRA.Launcher/App.config @@ -3,4 +3,4 @@ - \ No newline at end of file + diff --git a/OpenRA.Launcher/OpenRA.Launcher.csproj b/OpenRA.Launcher/OpenRA.Launcher.csproj new file mode 100644 index 0000000000..c9dae8d8dd --- /dev/null +++ b/OpenRA.Launcher/OpenRA.Launcher.csproj @@ -0,0 +1,65 @@ + + + Exe + net472 + true + true + false + 7.3 + true + true + false + ../bin + false + AnyCPU + false + false + ..\OpenRA.ruleset + Release;Debug + OpenRA + + + win-x64 + linux-x64 + osx-x64 + + + + + + + DEBUG;TRACE + false + + + true + + + Project + Engine.EngineDir=".." Game.Mod=ra + + + Project + Engine.EngineDir=".." Game.Mod=d2k + + + Project + Engine.EngineDir=".." Game.Mod=cnc + + + Project + Engine.EngineDir=".." Game.Mod=ts + + + + + + + + + + + + + + diff --git a/OpenRA.Launcher/Program.cs b/OpenRA.Launcher/Program.cs new file mode 100644 index 0000000000..7bc7ee509a --- /dev/null +++ b/OpenRA.Launcher/Program.cs @@ -0,0 +1,39 @@ +#region Copyright & License Information +/* + * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System; +using System.Diagnostics; +using System.Linq; + +namespace OpenRA.Launcher +{ + 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; + } + } + } +} diff --git a/OpenRA.Game/Properties/launchSettings.json b/OpenRA.Launcher/Properties/launchSettings.json similarity index 100% rename from OpenRA.Game/Properties/launchSettings.json rename to OpenRA.Launcher/Properties/launchSettings.json diff --git a/OpenRA.sln b/OpenRA.sln index 64d6017c24..1be8c442e7 100644 --- a/OpenRA.sln +++ b/OpenRA.sln @@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenRA.Mods.Common", "OpenR EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenRA.Test", "OpenRA.Test\OpenRA.Test.csproj", "{6CB8E1B7-6B36-4D93-8633-7C573E194AC4}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenRA.Launcher", "OpenRA.Launcher\OpenRA.Launcher.csproj", "{54DAE0E0-3125-49D3-992E-A0E931EB5FC8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -57,6 +59,10 @@ Global {6CB8E1B7-6B36-4D93-8633-7C573E194AC4}.Debug|Any CPU.Build.0 = Debug|Any CPU {6CB8E1B7-6B36-4D93-8633-7C573E194AC4}.Release|Any CPU.ActiveCfg = Release|Any CPU {6CB8E1B7-6B36-4D93-8633-7C573E194AC4}.Release|Any CPU.Build.0 = Release|Any CPU + {54DAE0E0-3125-49D3-992E-A0E931EB5FC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54DAE0E0-3125-49D3-992E-A0E931EB5FC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54DAE0E0-3125-49D3-992E-A0E931EB5FC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54DAE0E0-3125-49D3-992E-A0E931EB5FC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/appveyor.yml b/appveyor.yml index bee3363184..324d22cb68 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,11 +17,11 @@ after_test: - python -c "from PIL import Image; i = Image.open('packaging/artwork/d2k_256x256.png'); i.save('d2k.ico')" - move /Y %APPVEYOR_BUILD_FOLDER%\bin\* %APPVEYOR_BUILD_FOLDER% - ps: (Get-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs.in").replace('DISPLAY_NAME', 'Red Alert').replace('MOD_ID', 'ra').replace('FAQ_URL', 'http://wiki.openra.net/FAQ') | Set-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs" - - ps: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /platform:x64 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.exe" /out:"${env:APPVEYOR_BUILD_FOLDER}\RedAlert.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\ra.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs + - ps: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /platform:x64 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.dll" /out:"${env:APPVEYOR_BUILD_FOLDER}\RedAlert.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\ra.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs - ps: (Get-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs.in").replace('DISPLAY_NAME', 'Tiberian Dawn').replace('MOD_ID', 'cnc').replace('FAQ_URL', 'http://wiki.openra.net/FAQ') | Set-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs" - - ps: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /platform:x64 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.exe" /out:"${env:APPVEYOR_BUILD_FOLDER}\TiberianDawn.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\cnc.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs + - ps: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /platform:x64 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.dll" /out:"${env:APPVEYOR_BUILD_FOLDER}\TiberianDawn.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\cnc.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs - ps: (Get-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs.in").replace('DISPLAY_NAME', 'Dune 2000').replace('MOD_ID', 'd2k').replace('FAQ_URL', 'http://wiki.openra.net/FAQ') | Set-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs" - - ps: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /platform:x64 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.exe" /out:"${env:APPVEYOR_BUILD_FOLDER}\Dune2000.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\d2k.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs + - ps: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /platform:x64 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.dll" /out:"${env:APPVEYOR_BUILD_FOLDER}\Dune2000.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\d2k.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs - if defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_TAG_NAME% - if not defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_COMMIT:~0,7% - '"C:\Program Files (x86)\NSIS\makensis.exe" /DSRCDIR="%APPVEYOR_BUILD_FOLDER%" /DTAG="git-%VERSION%" /DSUFFIX=" (dev)" /V3 packaging/windows/OpenRA.nsi' diff --git a/launch-game.cmd b/launch-game.cmd index 8ee26bc933..d869dff216 100644 --- a/launch-game.cmd +++ b/launch-game.cmd @@ -17,10 +17,10 @@ echo. goto choosemod :launchmod -bin\OpenRA.Game.exe Engine.EngineDir=".." Game.Mod=%mod% %* +bin\OpenRA.exe Engine.EngineDir=".." Game.Mod=%mod% %* goto end :launch -bin\OpenRA.Game.exe Engine.EngineDir=".." %* +bin\OpenRA.exe Engine.EngineDir=".." %* :end if %errorlevel% neq 0 goto crashdialog diff --git a/launch-game.sh b/launch-game.sh index 625fc48e35..5b267f9c52 100755 --- a/launch-game.sh +++ b/launch-game.sh @@ -25,7 +25,7 @@ then fi # Launch the engine with the appropriate arguments -mono bin/OpenRA.Game.exe Engine.EngineDir=".." Engine.LaunchPath="$MODLAUNCHER" $MODARG "$@" +mono bin/OpenRA.exe Engine.EngineDir=".." Engine.LaunchPath="$MODLAUNCHER" $MODARG "$@" # Show a crash dialog if something went wrong if [ $? != 0 ] && [ $? != 1 ]; then diff --git a/packaging/freebsd/openra b/packaging/freebsd/openra index 07181ef247..7c20685fe8 100755 --- a/packaging/freebsd/openra +++ b/packaging/freebsd/openra @@ -10,8 +10,8 @@ # openra_user="" (default: openra) # openra_chdir="" # (default: /usr/home/${openra_user}) -# openra_path="" -# (default: ${openra_chdir}/OpenRA/OpenRA.Game.exe) +# openra_path="" +# (default: ${openra_chdir}/OpenRA/OpenRA.exe) # openra_ServerName="" (default: "Dedicated Server") # openra_Mod="" (default: ra) # openra_ListenPort="" (default: 1234) diff --git a/packaging/linux/openra.appimage.in b/packaging/linux/openra.appimage.in index 318e2870d1..7a85988005 100755 --- a/packaging/linux/openra.appimage.in +++ b/packaging/linux/openra.appimage.in @@ -35,7 +35,7 @@ fi # Run the game export SDL_VIDEO_X11_WMCLASS="openra-{MODID}-{TAG}" -mono --debug OpenRA.Game.exe Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" Engine.LaunchWrapper="${HERE}/restore-environment.sh" "${JOIN_SERVER}" "$@" +mono --debug OpenRA.exe Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" Engine.LaunchWrapper="${HERE}/restore-environment.sh" "${JOIN_SERVER}" "$@" # Show a crash dialog if something went wrong if [ $? != 0 ] && [ $? != 1 ]; then diff --git a/packaging/linux/openra.in b/packaging/linux/openra.in index e426e6346c..63c27bc047 100755 --- a/packaging/linux/openra.in +++ b/packaging/linux/openra.in @@ -9,7 +9,7 @@ if [ "${1#${PROTOCOL_PREFIX}}" != "${1}" ]; then fi # Run the game -mono {DEBUG} OpenRA.Game.exe Game.Mod={MODID} Engine.LaunchPath="{BIN_DIR}/openra-{MODID}" "${JOIN_SERVER}" "$@" +mono {DEBUG} OpenRA.exe Game.Mod={MODID} Engine.LaunchPath="{BIN_DIR}/openra-{MODID}" "${JOIN_SERVER}" "$@" # Show a crash dialog if something went wrong if [ $? != 0 ] && [ $? != 1 ]; then diff --git a/packaging/macos/launcher-mono.m b/packaging/macos/launcher-mono.m index de3d7ab421..e2d803d3a8 100644 --- a/packaging/macos/launcher-mono.m +++ b/packaging/macos/launcher-mono.m @@ -238,7 +238,7 @@ static int check_mono_version(const char *version, const char *req_version) [self exitWithMonoPrompt]; // Default values - can be overriden by setting certain keys Info.plist - NSString *gameName = @"OpenRA.Game.exe"; + NSString *gameName = @"OpenRA.exe"; NSString *modId = nil; NSDictionary *plist = [[NSBundle mainBundle] infoDictionary]; diff --git a/packaging/macos/launcher.m b/packaging/macos/launcher.m index 47f89e9416..ef9a9a403c 100644 --- a/packaging/macos/launcher.m +++ b/packaging/macos/launcher.m @@ -131,7 +131,7 @@ NSTask *gameTask; launched = YES; // Default values - can be overriden by setting certain keys Info.plist - NSString *gameName = @"OpenRA.Game.exe"; + NSString *gameName = @"OpenRA.exe"; NSString *modId = nil; NSDictionary *plist = [[NSBundle mainBundle] infoDictionary]; diff --git a/packaging/windows/buildpackage.sh b/packaging/windows/buildpackage.sh index b1841a6ee6..92c7309b55 100755 --- a/packaging/windows/buildpackage.sh +++ b/packaging/windows/buildpackage.sh @@ -18,7 +18,7 @@ SRCDIR="$(pwd)/../.." BUILTDIR="$(pwd)/build" ARTWORK_DIR="$(pwd)/../artwork/" -LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe" +LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.dll" FAQ_URL="http://wiki.openra.net/FAQ" SUFFIX=" (dev)" @@ -44,7 +44,7 @@ function makelauncher() # We need to set the loadFromRemoteSources flag for the launcher, but only for the "portable" zip package. # Windows automatically un-trusts executables that are extracted from a downloaded zip file - cp "${BUILTDIR}/OpenRA.Game.exe.config" "${BUILTDIR}/${LAUNCHER_NAME}.config" + cp "${BUILTDIR}/OpenRA.exe.config" "${BUILTDIR}/${LAUNCHER_NAME}.config" if [ "${PLATFORM}" = "x86" ]; then # Enable the full 4GB address space for the 32 bit game executable @@ -80,7 +80,7 @@ function build_platform() make install-dependencies "${TARGETPLATFORM}" gameinstalldir="" DESTDIR="${BUILTDIR}" popd > /dev/null || exit 1 - cp "${SRCDIR}/bin/OpenRA.Game.exe.config" "${BUILTDIR}" + cp "${SRCDIR}/bin/OpenRA.exe.config" "${BUILTDIR}" echo "Compiling Windows launchers (${PLATFORM})" makelauncher "RedAlert.exe" "Red Alert" "ra" ${PLATFORM}