diff --git a/OpenRA.Mods.RA2.sln b/OpenRA.Mods.RA2.sln index 347a8c4a5..81bcf47ff 100644 --- a/OpenRA.Mods.RA2.sln +++ b/OpenRA.Mods.RA2.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29613.14 diff --git a/OpenRA.Mods.RA2/Activities/EnterCarrierParent.cs b/OpenRA.Mods.RA2/Activities/EnterCarrierParent.cs index 04b4905a5..4f4106aec 100644 --- a/OpenRA.Mods.RA2/Activities/EnterCarrierParent.cs +++ b/OpenRA.Mods.RA2/Activities/EnterCarrierParent.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Graphics/ElectricBoltRenderable.cs b/OpenRA.Mods.RA2/Graphics/ElectricBoltRenderable.cs index 4623f711e..071d683c0 100644 --- a/OpenRA.Mods.RA2/Graphics/ElectricBoltRenderable.cs +++ b/OpenRA.Mods.RA2/Graphics/ElectricBoltRenderable.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Graphics/RadBeamRenderable.cs b/OpenRA.Mods.RA2/Graphics/RadBeamRenderable.cs index aff4c1683..0141df3d1 100644 --- a/OpenRA.Mods.RA2/Graphics/RadBeamRenderable.cs +++ b/OpenRA.Mods.RA2/Graphics/RadBeamRenderable.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Graphics/TintedCell.cs b/OpenRA.Mods.RA2/Graphics/TintedCell.cs index 1ecec0ea8..cdfedf25b 100644 --- a/OpenRA.Mods.RA2/Graphics/TintedCell.cs +++ b/OpenRA.Mods.RA2/Graphics/TintedCell.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/OpenRA.Mods.RA2.csproj b/OpenRA.Mods.RA2/OpenRA.Mods.RA2.csproj index 947023208..d6dafee7a 100644 --- a/OpenRA.Mods.RA2/OpenRA.Mods.RA2.csproj +++ b/OpenRA.Mods.RA2/OpenRA.Mods.RA2.csproj @@ -1,45 +1,45 @@ - - - - net461 - true - 5 - true - ../mods/ra2 - false - AnyCPU - false - ..\engine\OpenRA.ruleset - - - - - - - - - DEBUG;TRACE - false - - - - - ../engine/thirdparty/download/Eluant.dll - False - - - - - - - - - - - - - - - - - + + + + net461 + true + 5 + true + ../mods/ra2 + false + AnyCPU + false + ..\engine\OpenRA.ruleset + + + + + + + + + DEBUG;TRACE + false + + + + + ../engine/thirdparty/download/Eluant.dll + False + + + + + + + + + + + + + + + + + diff --git a/OpenRA.Mods.RA2/Projectiles/ArcLaserZap.cs b/OpenRA.Mods.RA2/Projectiles/ArcLaserZap.cs index f7a4f1fd0..62a9f2df6 100644 --- a/OpenRA.Mods.RA2/Projectiles/ArcLaserZap.cs +++ b/OpenRA.Mods.RA2/Projectiles/ArcLaserZap.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Projectiles/ElectricBolt.cs b/OpenRA.Mods.RA2/Projectiles/ElectricBolt.cs index 8b31522ca..edbaf90aa 100644 --- a/OpenRA.Mods.RA2/Projectiles/ElectricBolt.cs +++ b/OpenRA.Mods.RA2/Projectiles/ElectricBolt.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Projectiles/RadBeam.cs b/OpenRA.Mods.RA2/Projectiles/RadBeam.cs index 605ba2e6d..5c7242b2c 100644 --- a/OpenRA.Mods.RA2/Projectiles/RadBeam.cs +++ b/OpenRA.Mods.RA2/Projectiles/RadBeam.cs @@ -94,8 +94,8 @@ public void Tick(World world) if (hitanim != null) hitanim.PlayThen(info.HitAnimSequence, () => animationComplete = true); else - animationComplete = true; - + animationComplete = true; + args.Weapon.Impact(Target.FromPos(target), new WarheadArgs(args)); doneDamage = true; } diff --git a/OpenRA.Mods.RA2/Traits/BaseSpawnerChild.cs b/OpenRA.Mods.RA2/Traits/BaseSpawnerChild.cs index b9c3498ea..10683eadb 100644 --- a/OpenRA.Mods.RA2/Traits/BaseSpawnerChild.cs +++ b/OpenRA.Mods.RA2/Traits/BaseSpawnerChild.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Traits/BaseSpawnerParent.cs b/OpenRA.Mods.RA2/Traits/BaseSpawnerParent.cs index 2539d209e..d07da7ada 100644 --- a/OpenRA.Mods.RA2/Traits/BaseSpawnerParent.cs +++ b/OpenRA.Mods.RA2/Traits/BaseSpawnerParent.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Traits/CarrierChild.cs b/OpenRA.Mods.RA2/Traits/CarrierChild.cs index accde5325..d9cd50290 100644 --- a/OpenRA.Mods.RA2/Traits/CarrierChild.cs +++ b/OpenRA.Mods.RA2/Traits/CarrierChild.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Traits/CarrierParent.cs b/OpenRA.Mods.RA2/Traits/CarrierParent.cs index c8badd203..9f0efdb1e 100644 --- a/OpenRA.Mods.RA2/Traits/CarrierParent.cs +++ b/OpenRA.Mods.RA2/Traits/CarrierParent.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Traits/ChronoResourceDelivery.cs b/OpenRA.Mods.RA2/Traits/ChronoResourceDelivery.cs index a17dec0fb..f489243c6 100644 --- a/OpenRA.Mods.RA2/Traits/ChronoResourceDelivery.cs +++ b/OpenRA.Mods.RA2/Traits/ChronoResourceDelivery.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007-2019 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made diff --git a/OpenRA.Mods.RA2/Traits/DamagedByTintedCells.cs b/OpenRA.Mods.RA2/Traits/DamagedByTintedCells.cs index 4765e7d89..243aeb786 100644 --- a/OpenRA.Mods.RA2/Traits/DamagedByTintedCells.cs +++ b/OpenRA.Mods.RA2/Traits/DamagedByTintedCells.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Traits/PeriodicExplosion.cs b/OpenRA.Mods.RA2/Traits/PeriodicExplosion.cs index c6ee572db..d01f2a308 100644 --- a/OpenRA.Mods.RA2/Traits/PeriodicExplosion.cs +++ b/OpenRA.Mods.RA2/Traits/PeriodicExplosion.cs @@ -103,17 +103,17 @@ void ITick.Tick(Actor self) var localoffset = body != null ? body.LocalToWorld(info.LocalOffset.Rotate(body.QuantizeOrientation(self, self.Orientation))) : info.LocalOffset; - - var args = new WarheadArgs - { - Weapon = weapon, - DamageModifiers = self.TraitsImplementing().Select(a => a.GetFirepowerModifier()).ToArray(), - Source = self.CenterPosition, - SourceActor = self, - WeaponTarget = Target.FromPos(self.CenterPosition + localoffset) - }; - - weapon.Impact(args.WeaponTarget, args); + + var args = new WarheadArgs + { + Weapon = weapon, + DamageModifiers = self.TraitsImplementing().Select(a => a.GetFirepowerModifier()).ToArray(), + Source = self.CenterPosition, + SourceActor = self, + WeaponTarget = Target.FromPos(self.CenterPosition + localoffset) + }; + + weapon.Impact(args.WeaponTarget, args); if (weapon.Report != null && weapon.Report.Any()) Game.Sound.Play(SoundType.World, weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); diff --git a/OpenRA.Mods.RA2/Traits/Render/WithExitOverlay.cs b/OpenRA.Mods.RA2/Traits/Render/WithExitOverlay.cs index 58cd6a7c7..496fad0b0 100644 --- a/OpenRA.Mods.RA2/Traits/Render/WithExitOverlay.cs +++ b/OpenRA.Mods.RA2/Traits/Render/WithExitOverlay.cs @@ -79,9 +79,9 @@ void ITick.Tick(Actor self) enable = self.World.ActorMap.GetActorsAt(exit).Any(a => a != self); } - protected override void TraitDisabled(Actor self) - { - enable = false; - } + protected override void TraitDisabled(Actor self) + { + enable = false; + } } } diff --git a/OpenRA.Mods.RA2/Traits/Render/WithTurretDeployAnimation.cs b/OpenRA.Mods.RA2/Traits/Render/WithTurretDeployAnimation.cs index d8867acc2..a41961cbd 100644 --- a/OpenRA.Mods.RA2/Traits/Render/WithTurretDeployAnimation.cs +++ b/OpenRA.Mods.RA2/Traits/Render/WithTurretDeployAnimation.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007-2019 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made diff --git a/OpenRA.Mods.RA2/Traits/Render/WithVoxelHelicopterBody.cs b/OpenRA.Mods.RA2/Traits/Render/WithVoxelHelicopterBody.cs index 0263dd6cb..14fb1c4ee 100644 --- a/OpenRA.Mods.RA2/Traits/Render/WithVoxelHelicopterBody.cs +++ b/OpenRA.Mods.RA2/Traits/Render/WithVoxelHelicopterBody.cs @@ -6,9 +6,9 @@ * 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.Collections.Generic; using OpenRA.Graphics; diff --git a/OpenRA.Mods.RA2/Traits/SpawnSurvivors.cs b/OpenRA.Mods.RA2/Traits/SpawnSurvivors.cs index eba188a19..58804adf1 100644 --- a/OpenRA.Mods.RA2/Traits/SpawnSurvivors.cs +++ b/OpenRA.Mods.RA2/Traits/SpawnSurvivors.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 @@ -65,7 +65,7 @@ void Spawn(Actor self) var unit = w.CreateActor(true, actorType.ToLowerInvariant(), td); var mobile = unit.TraitOrDefault(); - if (mobile != null) + if (mobile != null) mobile.Nudge(unit); } }); diff --git a/OpenRA.Mods.RA2/Traits/WeatherControlSupportPower.cs b/OpenRA.Mods.RA2/Traits/WeatherControlSupportPower.cs index 91d25316a..4ef61bc8b 100644 --- a/OpenRA.Mods.RA2/Traits/WeatherControlSupportPower.cs +++ b/OpenRA.Mods.RA2/Traits/WeatherControlSupportPower.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 @@ -121,11 +121,11 @@ void ITick.Tick(Actor self) if (--hitDelay < 0) { - hitDelay = info.HitDelay; - - var warheadArgs = new WarheadArgs() - { - SourceActor = self + hitDelay = info.HitDelay; + + var warheadArgs = new WarheadArgs() + { + SourceActor = self }; info.WeaponInfo.Impact(Target.FromPos(targetPos), warheadArgs); @@ -139,11 +139,11 @@ void ITick.Tick(Actor self) { var offset = RandomOffset(self.World); var newPos = targetPos + offset; - var scatterTarget = Target.FromPos(newPos); - - var warheadArgs = new WarheadArgs() - { - SourceActor = self + var scatterTarget = Target.FromPos(newPos); + + var warheadArgs = new WarheadArgs() + { + SourceActor = self }; info.WeaponInfo.Impact(scatterTarget, warheadArgs); diff --git a/OpenRA.Mods.RA2/Traits/World/TintedCellsLayer.cs b/OpenRA.Mods.RA2/Traits/World/TintedCellsLayer.cs index 7da8cb71f..41763063a 100644 --- a/OpenRA.Mods.RA2/Traits/World/TintedCellsLayer.cs +++ b/OpenRA.Mods.RA2/Traits/World/TintedCellsLayer.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/OpenRA.Mods.RA2/Warheads/CreateTintedCellsWarhead.cs b/OpenRA.Mods.RA2/Warheads/CreateTintedCellsWarhead.cs index 1e406ffb4..e719a3a8b 100644 --- a/OpenRA.Mods.RA2/Warheads/CreateTintedCellsWarhead.cs +++ b/OpenRA.Mods.RA2/Warheads/CreateTintedCellsWarhead.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#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 diff --git a/launch-dedicated.cmd b/launch-dedicated.cmd index cb3d7a8f4..b6d2aee8d 100644 --- a/launch-dedicated.cmd +++ b/launch-dedicated.cmd @@ -1,42 +1,50 @@ -:: example launch script, see https://github.com/OpenRA/OpenRA/wiki/Dedicated for details - -@echo on - -set Name="Dedicated Server" -set ListenPort=1234 -set AdvertiseOnline=True -set EnableSingleplayer=False -set Password="" - -@echo off -setlocal EnableDelayedExpansion - -title %Name% -FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) -if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) -set MOD_SEARCH_PATHS=%~dp0mods,./mods - -if "!MOD_ID!" == "" goto badconfig -if "!ENGINE_VERSION!" == "" goto badconfig -if "!ENGINE_DIRECTORY!" == "" goto badconfig - -if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine ->nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine -cd %ENGINE_DIRECTORY% - -:loop -OpenRA.Server.exe Game.Mod=%MOD_ID% Server.Name=%Name% Server.ListenPort=%ListenPort% Server.AdvertiseOnline=%AdvertiseOnline% Server.EnableSingleplayer=%EnableSingleplayer% Server.Password=%Password% -goto loop - -:noengine -echo Required engine files not found. -echo Run `make all` in the mod directory to fetch and build the required files, then try again. -pause -exit /b - -:badconfig -echo Required mod.config variables are missing. -echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are -echo defined in your mod.config (or user.config) and try again. -pause -exit /b \ No newline at end of file +:: example launch script, see https://github.com/OpenRA/OpenRA/wiki/Dedicated for details + +@echo on + +set Name="Dedicated Server" +set ListenPort=1234 +set AdvertiseOnline=True +set Password="" + +set RequireAuthentication=False +set ProfileIDBlacklist="" +set ProfileIDWhitelist="" + +set EnableSingleplayer=False +set EnableSyncReports=False +set EnableGeoIP=True +set ShareAnonymizedIPs=True + +@echo off +setlocal EnableDelayedExpansion + +title %Name% +FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) +if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) +set MOD_SEARCH_PATHS=%~dp0mods,./mods + +if "!MOD_ID!" == "" goto badconfig +if "!ENGINE_VERSION!" == "" goto badconfig +if "!ENGINE_DIRECTORY!" == "" goto badconfig + +if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine +>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine +cd %ENGINE_DIRECTORY% + +:loop +OpenRA.Server.exe Game.Mod=%MOD_ID% Server.Name=%Name% Server.ListenPort=%ListenPort% Server.AdvertiseOnline=%AdvertiseOnline% Server.EnableSingleplayer=%EnableSingleplayer% Server.Password=%Password% Server.RequireAuthentication=%RequireAuthentication% Server.ProfileIDBlacklist=%ProfileIDBlacklist% Server.ProfileIDWhitelist=%ProfileIDWhitelist% Server.EnableSyncReports=%EnableSyncReports% Server.EnableGeoIP=%EnableGeoIP% Server.ShareAnonymizedIPs=%ShareAnonymizedIPs% Engine.SupportDir=%SupportDir% +goto loop + +:noengine +echo Required engine files not found. +echo Run `make all` in the mod directory to fetch and build the required files, then try again. +pause +exit /b + +:badconfig +echo Required mod.config variables are missing. +echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are +echo defined in your mod.config (or user.config) and try again. +pause +exit /b diff --git a/launch-dedicated.sh b/launch-dedicated.sh index 215869603..5eff0088e 100755 --- a/launch-dedicated.sh +++ b/launch-dedicated.sh @@ -38,9 +38,19 @@ NAME="${Name:-"Dedicated Server"}" LAUNCH_MOD="${Mod:-"${MOD_ID}"}" LISTEN_PORT="${ListenPort:-"1234"}" ADVERTISE_ONLINE="${AdvertiseOnline:-"True"}" -ENABLE_SINGLE_PLAYER="${EnableSingleplayer:-"False"}" PASSWORD="${Password:-""}" +REQUIRE_AUTHENTICATION="${RequireAuthentication:-"False"}" +PROFILE_ID_BLACKLIST="${ProfileIDBlacklist:-""}" +PROFILE_ID_WHITELIST="${ProfileIDWhitelist:-""}" + +ENABLE_SINGLE_PLAYER="${EnableSingleplayer:-"False"}" +ENABLE_SYNC_REPORTS="${EnableSyncReports:-"False"}" +ENABLE_GEOIP="${EnableGeoIP:-"True"}" +SHARE_ANONYMISED_IPS="${ShareAnonymizedIPs:-"True"}" + +SUPPORT_DIR="${SupportDir:-""}" + cd "${TEMPLATE_ROOT}" if [ ! -f "${ENGINE_DIRECTORY}/OpenRA.Game.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then echo "Required engine files not found." @@ -54,5 +64,13 @@ while true; do MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" mono --debug OpenRA.Server.exe Game.Mod="${LAUNCH_MOD}" \ Server.Name="${NAME}" Server.ListenPort="${LISTEN_PORT}" \ Server.AdvertiseOnline="${ADVERTISE_ONLINE}" \ - Server.EnableSingleplayer="${ENABLE_SINGLE_PLAYER}" Server.Password="${PASSWORD}" + Server.Password="${PASSWORD}" \ + Server.RequireAuthentication="${REQUIRE_AUTHENTICATION}" \ + Server.ProfileIDBlacklist="${PROFILE_ID_BLACKLIST}" \ + Server.ProfileIDWhitelist="${PROFILE_ID_WHITELIST}" \ + Server.EnableSingleplayer="${ENABLE_SINGLE_PLAYER}" \ + Server.EnableSyncReports="${ENABLE_SYNC_REPORTS}" \ + Server.EnableGeoIP="${ENABLE_GEOIP}" \ + Server.ShareAnonymizedIPs="${SHARE_ANONYMISED_IPS}" \ + Engine.SupportDir="${SUPPORT_DIR}" done diff --git a/launch-game.cmd b/launch-game.cmd index 41013364c..2c98fda32 100644 --- a/launch-game.cmd +++ b/launch-game.cmd @@ -1,45 +1,45 @@ -@echo off -setlocal EnableDelayedExpansion -title OpenRA - -FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) -if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) -set TEMPLATE_LAUNCHER=%0 -set MOD_SEARCH_PATHS=%~dp0mods,./mods - -if "!MOD_ID!" == "" goto badconfig -if "!ENGINE_VERSION!" == "" goto badconfig -if "!ENGINE_DIRECTORY!" == "" goto badconfig - -set TEMPLATE_DIR=%CD% -if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine ->nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine -cd %ENGINE_DIRECTORY% - -OpenRA.Game.exe Game.Mod=%MOD_ID% Engine.LaunchPath="%TEMPLATE_LAUNCHER%" "Engine.ModSearchPaths=%MOD_SEARCH_PATHS%" "%*" -set ERROR=%errorlevel% -cd %TEMPLATE_DIR% - -if %ERROR% neq 0 goto crashdialog -exit /b - -:noengine -echo Required engine files not found. -echo Run `make all` in the mod directory to fetch and build the required files, then try again. -pause -exit /b - -:badconfig -echo Required mod.config variables are missing. -echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are -echo defined in your mod.config (or user.config) and try again. -pause -exit /b - -:crashdialog -echo ---------------------------------------- -echo OpenRA has encountered a fatal error. -echo * Log Files are available in Documents\OpenRA\Logs -echo * FAQ is available at https://github.com/OpenRA/OpenRA/wiki/FAQ -echo ---------------------------------------- -pause +@echo off +setlocal EnableDelayedExpansion +title OpenRA + +FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) +if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) +set TEMPLATE_LAUNCHER=%0 +set MOD_SEARCH_PATHS=%~dp0mods,./mods + +if "!MOD_ID!" == "" goto badconfig +if "!ENGINE_VERSION!" == "" goto badconfig +if "!ENGINE_DIRECTORY!" == "" goto badconfig + +set TEMPLATE_DIR=%CD% +if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine +>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine +cd %ENGINE_DIRECTORY% + +OpenRA.Game.exe Game.Mod=%MOD_ID% Engine.LaunchPath="%TEMPLATE_LAUNCHER%" "Engine.ModSearchPaths=%MOD_SEARCH_PATHS%" "%*" +set ERROR=%errorlevel% +cd %TEMPLATE_DIR% + +if %ERROR% neq 0 goto crashdialog +exit /b + +:noengine +echo Required engine files not found. +echo Run `make all` in the mod directory to fetch and build the required files, then try again. +pause +exit /b + +:badconfig +echo Required mod.config variables are missing. +echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are +echo defined in your mod.config (or user.config) and try again. +pause +exit /b + +:crashdialog +echo ---------------------------------------- +echo OpenRA has encountered a fatal error. +echo * Log Files are available in Documents\OpenRA\Logs +echo * FAQ is available at https://github.com/OpenRA/OpenRA/wiki/FAQ +echo ---------------------------------------- +pause diff --git a/make.cmd b/make.cmd index c88f86626..92b05b706 100644 --- a/make.cmd +++ b/make.cmd @@ -1 +1 @@ -@powershell -NoProfile -ExecutionPolicy Bypass -File make.ps1 %* +@powershell -NoProfile -ExecutionPolicy Bypass -File make.ps1 %* diff --git a/make.ps1 b/make.ps1 index 543335898..ca92ab3c3 100644 --- a/make.ps1 +++ b/make.ps1 @@ -1,412 +1,412 @@ -####### The starting point for the script is the bottom ####### - -############################################################### -########################## FUNCTIONS ########################## -############################################################### -function All-Command -{ - If (!(Test-Path "*.sln")) - { - return - } - - if ((CheckForDotnet) -eq 1) - { - return - } - - dotnet build /p:Configuration=Release /nologo - if ($lastexitcode -ne 0) - { - Write-Host "Build failed. If just the development tools failed to build, try installing Visual Studio. You may also still be able to run the game." -ForegroundColor Red - } - else - { - Write-Host "Build succeeded." -ForegroundColor Green - } -} - -function Clean-Command -{ - If (!(Test-Path "*.sln")) - { - return - } - - if ((CheckForDotnet) -eq 1) - { - return - } - - dotnet clean /nologo - rm *.dll - rm mods/*/*.dll - rm *.dll.config - rm *.pdb - rm mods/*/*.pdb - rm *.exe - rm ./*/bin -r - rm ./*/obj -r - - rm $env:ENGINE_DIRECTORY/*.dll - rm $env:ENGINE_DIRECTORY/mods/*/*.dll - rm env:ENGINE_DIRECTORY/*.config - rm env:ENGINE_DIRECTORY/*.pdb - rm mods/*/*.pdb - rm env:ENGINE_DIRECTORY/*.exe - rm env:ENGINE_DIRECTORY/*/bin -r - rm env:ENGINE_DIRECTORY/*/obj -r - if (Test-Path env:ENGINE_DIRECTORY/thirdparty/download/) - { - rmdir env:ENGINE_DIRECTORY/thirdparty/download -Recurse -Force - } - - Write-Host "Clean complete." -ForegroundColor Green -} - -function Version-Command -{ - if ($command.Length -gt 1) - { - $version = $command[1] - } - elseif (Get-Command 'git' -ErrorAction SilentlyContinue) - { - $gitRepo = git rev-parse --is-inside-work-tree - if ($gitRepo) - { - $version = git name-rev --name-only --tags --no-undefined HEAD 2>$null - if ($version -eq $null) - { - $version = "git-" + (git rev-parse --short HEAD) - } - } - else - { - Write-Host "Not a git repository. The version will remain unchanged." -ForegroundColor Red - } - } - else - { - Write-Host "Unable to locate Git. The version will remain unchanged." -ForegroundColor Red - } - - if ($version -ne $null) - { - $mod = "mods/" + $modID + "/mod.yaml" - $replacement = (gc $mod) -Replace "Version:.*", ("Version: {0}" -f $version) - sc $mod $replacement - - $prefix = $(gc $mod) | Where { $_.ToString().EndsWith(": User") } - if ($prefix -and $prefix.LastIndexOf("/") -ne -1) - { - $prefix = $prefix.Substring(0, $prefix.LastIndexOf("/")) - } - $replacement = (gc $mod) -Replace ".*: User", ("{0}/{1}: User" -f $prefix, $version) - sc $mod $replacement - - Write-Host ("Version strings set to '{0}'." -f $version) - } -} - -function Test-Command -{ - if ((CheckForUtility) -eq 1) - { - return - } - - Write-Host "Testing $modID mod MiniYAML..." -ForegroundColor Cyan - Invoke-Expression "$utilityPath $modID --check-yaml" -} - -function Check-Command -{ - If (!(Test-Path "*.sln")) - { - Write-Host "No custom solution file found. Skipping static code checks." -ForegroundColor Cyan - return - } - - Write-Host "Compiling in debug configuration..." -ForegroundColor Cyan - dotnet build /p:Configuration=Debug /nologo - if ($lastexitcode -ne 0) - { - Write-Host "Build failed." -ForegroundColor Red - } - - if ((CheckForUtility) -eq 0) - { - Write-Host "Checking for explicit interface violations..." -ForegroundColor Cyan - Invoke-Expression "$utilityPath $modID --check-explicit-interfaces" - - Write-Host "Checking for incorrect conditional trait interface overrides..." -ForegroundColor Cyan - Invoke-Expression "$utilityPath $modID --check-conditional-trait-interface-overrides" - } -} - -function Check-Scripts-Command -{ - if ((Get-Command "luac.exe" -ErrorAction SilentlyContinue) -ne $null) - { - Write-Host "Testing Lua scripts..." -ForegroundColor Cyan - foreach ($script in ls "mods/*/maps/*/*.lua") - { - luac -p $script - } - Write-Host "Check completed!" -ForegroundColor Green - } - else - { - Write-Host "luac.exe could not be found. Please install Lua." -ForegroundColor Red - } -} - -function Docs-Command -{ - if ((CheckForUtility) -eq 1) - { - return - } - - ./make.ps1 version - Invoke-Expression "$utilityPath $modID --docs | Out-File -Encoding 'UTF8' DOCUMENTATION.md" - Invoke-Expression "$utilityPath $modID --weapon-docs | Out-File -Encoding "UTF8" WEAPONS.md" - Invoke-Expression "$utilityPath $modID --lua-docs | Out-File -Encoding 'UTF8' Lua-API.md" - Write-Host "Docs generated." -ForegroundColor Green -} - -function CheckForUtility -{ - if (Test-Path $utilityPath) - { - return 0 - } - - Write-Host "OpenRA.Utility.exe could not be found. Build the project first using the `"all`" command." -ForegroundColor Red - return 1 -} - -function CheckForDotnet -{ - if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -eq $null) - { - Write-Host "The 'dotnet' tool is required to compile OpenRA. Please install the .NET Core SDK or Visual Studio and try again. https://dotnet.microsoft.com/download" -ForegroundColor Red - return 1 - } - - return 0 -} - -function WaitForInput -{ - echo "Press enter to continue." - while ($true) - { - if ([System.Console]::KeyAvailable) - { - exit - } - Start-Sleep -Milliseconds 50 - } -} - -function ReadConfigLine($line, $name) -{ - $prefix = $name + '=' - if ($line.StartsWith($prefix)) - { - [Environment]::SetEnvironmentVariable($name, $line.Replace($prefix, '').Replace('"', '')) - } -} - -function ParseConfigFile($fileName) -{ - $names = @("MOD_ID", "ENGINE_VERSION", "AUTOMATIC_ENGINE_MANAGEMENT", "AUTOMATIC_ENGINE_SOURCE", - "AUTOMATIC_ENGINE_EXTRACT_DIRECTORY", "AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME", "ENGINE_DIRECTORY") - - $reader = [System.IO.File]::OpenText($fileName) - while($null -ne ($line = $reader.ReadLine())) - { - foreach ($name in $names) - { - ReadConfigLine $line $name - } - } - $reader.Close() - - $missing = @() - foreach ($name in $names) - { - if (!([System.Environment]::GetEnvironmentVariable($name))) - { - $missing += $name - } - } - - if ($missing) - { - echo "Required mod.config variables are missing:" - foreach ($m in $missing) - { - echo " $m" - } - echo "Repair your mod.config (or user.config) and try again." - WaitForInput - exit - } -} - -############################################################### -############################ Main ############################# -############################################################### -if ($PSVersionTable.PSVersion.Major -clt 3) -{ - echo "The makefile requires PowerShell version 3 or higher." - echo "Please download and install the latest Windows Management Framework version from Microsoft." - WaitForInput -} - -if ($args.Length -eq 0) -{ - echo "Command list:" - echo "" - echo " all Builds the game, its development tools and the mod dlls." - echo " version Sets the version strings for all mods to the latest" - echo " version for the current Git branch." - echo " clean Removes all built and copied files." - echo " from the mods and the engine directories." - echo " test Tests the mod's MiniYAML for errors." - echo " check Checks .cs files for StyleCop violations." - echo " check-scripts Checks .lua files for syntax errors." - echo " docs Generates the trait and Lua API documentation." - echo "" - $command = (Read-Host "Enter command").Split(' ', 2) -} -else -{ - $command = $args -} - -# Set the working directory for our IO methods -$templateDir = $pwd.Path -[System.IO.Directory]::SetCurrentDirectory($templateDir) - -# Load the environment variables from the config file -# and get the mod ID from the local environment variable -ParseConfigFile "mod.config" - -if (Test-Path "user.config") -{ - ParseConfigFile "user.config" -} - -$modID = $env:MOD_ID - -$env:MOD_SEARCH_PATHS = (Get-Item -Path ".\" -Verbose).FullName + "\mods,./mods" - -# Run the same command on the engine's make file -if ($command -eq "all" -or $command -eq "clean") -{ - $versionFile = $env:ENGINE_DIRECTORY + "/VERSION" - $currentEngine = "" - if (Test-Path $versionFile) - { - $reader = [System.IO.File]::OpenText($versionFile) - $currentEngine = $reader.ReadLine() - $reader.Close() - } - - if ($currentEngine -ne "" -and $currentEngine -eq $env:ENGINE_VERSION) - { - cd $env:ENGINE_DIRECTORY - Invoke-Expression ".\make.cmd $command" - echo "" - cd $templateDir - } - elseif ($env:AUTOMATIC_ENGINE_MANAGEMENT -ne "True") - { - echo "Automatic engine management is disabled." - echo "Please manually update the engine to version $env:ENGINE_VERSION." - WaitForInput - } - else - { - echo "OpenRA engine version $env:ENGINE_VERSION is required." - - if (Test-Path $env:ENGINE_DIRECTORY) - { - if ($currentEngine -ne "") - { - echo "Deleting engine version $currentEngine." - } - else - { - echo "Deleting existing engine (unknown version)." - } - - rm $env:ENGINE_DIRECTORY -r - } - - echo "Downloading engine..." - - if (Test-Path $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) - { - rm $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -r - } - - $url = $env:AUTOMATIC_ENGINE_SOURCE - $url = $url.Replace("$", "").Replace("{ENGINE_VERSION}", $env:ENGINE_VERSION) - - mkdir $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY > $null - $dlPath = Join-Path $pwd (Split-Path -leaf $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) - $dlPath = Join-Path $dlPath (Split-Path -leaf $env:AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME) - - $client = new-object System.Net.WebClient - [Net.ServicePointManager]::SecurityProtocol = 'Tls12' - $client.DownloadFile($url, $dlPath) - - Add-Type -assembly "system.io.compression.filesystem" - [io.compression.zipfile]::ExtractToDirectory($dlPath, $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) - rm $dlPath - - $extractedDir = Get-ChildItem $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -Recurse | ?{ $_.PSIsContainer } | Select-Object -First 1 - Move-Item $extractedDir.FullName -Destination $templateDir - Rename-Item $extractedDir.Name (Split-Path -leaf $env:ENGINE_DIRECTORY) - - rm $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -r - - cd $env:ENGINE_DIRECTORY - Invoke-Expression ".\make.cmd version $env:ENGINE_VERSION" - Invoke-Expression ".\make.cmd $command" - echo "" - cd $templateDir - } -} - -$utilityPath = $env:ENGINE_DIRECTORY + "/OpenRA.Utility.exe" -$styleCheckPath = $env:ENGINE_DIRECTORY + "/OpenRA.StyleCheck.exe" - -$execute = $command -if ($command.Length -gt 1) -{ - $execute = $command[0] -} - -switch ($execute) -{ - "all" { All-Command } - "version" { Version-Command } - "clean" { Clean-Command } - "test" { Test-Command } - "check" { Check-Command } - "check-scripts" { Check-Scripts-Command } - "docs" { Docs-Command } - Default { echo ("Invalid command '{0}'" -f $command) } -} - -# In case the script was called without any parameters we keep the window open -if ($args.Length -eq 0) -{ - WaitForInput -} +####### The starting point for the script is the bottom ####### + +############################################################### +########################## FUNCTIONS ########################## +############################################################### +function All-Command +{ + If (!(Test-Path "*.sln")) + { + return + } + + if ((CheckForDotnet) -eq 1) + { + return + } + + dotnet build /p:Configuration=Release /nologo + if ($lastexitcode -ne 0) + { + Write-Host "Build failed. If just the development tools failed to build, try installing Visual Studio. You may also still be able to run the game." -ForegroundColor Red + } + else + { + Write-Host "Build succeeded." -ForegroundColor Green + } +} + +function Clean-Command +{ + If (!(Test-Path "*.sln")) + { + return + } + + if ((CheckForDotnet) -eq 1) + { + return + } + + dotnet clean /nologo + rm *.dll + rm mods/*/*.dll + rm *.dll.config + rm *.pdb + rm mods/*/*.pdb + rm *.exe + rm ./*/bin -r + rm ./*/obj -r + + rm $env:ENGINE_DIRECTORY/*.dll + rm $env:ENGINE_DIRECTORY/mods/*/*.dll + rm env:ENGINE_DIRECTORY/*.config + rm env:ENGINE_DIRECTORY/*.pdb + rm mods/*/*.pdb + rm env:ENGINE_DIRECTORY/*.exe + rm env:ENGINE_DIRECTORY/*/bin -r + rm env:ENGINE_DIRECTORY/*/obj -r + if (Test-Path env:ENGINE_DIRECTORY/thirdparty/download/) + { + rmdir env:ENGINE_DIRECTORY/thirdparty/download -Recurse -Force + } + + Write-Host "Clean complete." -ForegroundColor Green +} + +function Version-Command +{ + if ($command.Length -gt 1) + { + $version = $command[1] + } + elseif (Get-Command 'git' -ErrorAction SilentlyContinue) + { + $gitRepo = git rev-parse --is-inside-work-tree + if ($gitRepo) + { + $version = git name-rev --name-only --tags --no-undefined HEAD 2>$null + if ($version -eq $null) + { + $version = "git-" + (git rev-parse --short HEAD) + } + } + else + { + Write-Host "Not a git repository. The version will remain unchanged." -ForegroundColor Red + } + } + else + { + Write-Host "Unable to locate Git. The version will remain unchanged." -ForegroundColor Red + } + + if ($version -ne $null) + { + $mod = "mods/" + $modID + "/mod.yaml" + $replacement = (gc $mod) -Replace "Version:.*", ("Version: {0}" -f $version) + sc $mod $replacement + + $prefix = $(gc $mod) | Where { $_.ToString().EndsWith(": User") } + if ($prefix -and $prefix.LastIndexOf("/") -ne -1) + { + $prefix = $prefix.Substring(0, $prefix.LastIndexOf("/")) + } + $replacement = (gc $mod) -Replace ".*: User", ("{0}/{1}: User" -f $prefix, $version) + sc $mod $replacement + + Write-Host ("Version strings set to '{0}'." -f $version) + } +} + +function Test-Command +{ + if ((CheckForUtility) -eq 1) + { + return + } + + Write-Host "Testing $modID mod MiniYAML..." -ForegroundColor Cyan + Invoke-Expression "$utilityPath $modID --check-yaml" +} + +function Check-Command +{ + If (!(Test-Path "*.sln")) + { + Write-Host "No custom solution file found. Skipping static code checks." -ForegroundColor Cyan + return + } + + Write-Host "Compiling in debug configuration..." -ForegroundColor Cyan + dotnet build /p:Configuration=Debug /nologo + if ($lastexitcode -ne 0) + { + Write-Host "Build failed." -ForegroundColor Red + } + + if ((CheckForUtility) -eq 0) + { + Write-Host "Checking for explicit interface violations..." -ForegroundColor Cyan + Invoke-Expression "$utilityPath $modID --check-explicit-interfaces" + + Write-Host "Checking for incorrect conditional trait interface overrides..." -ForegroundColor Cyan + Invoke-Expression "$utilityPath $modID --check-conditional-trait-interface-overrides" + } +} + +function Check-Scripts-Command +{ + if ((Get-Command "luac.exe" -ErrorAction SilentlyContinue) -ne $null) + { + Write-Host "Testing Lua scripts..." -ForegroundColor Cyan + foreach ($script in ls "mods/*/maps/*/*.lua") + { + luac -p $script + } + Write-Host "Check completed!" -ForegroundColor Green + } + else + { + Write-Host "luac.exe could not be found. Please install Lua." -ForegroundColor Red + } +} + +function Docs-Command +{ + if ((CheckForUtility) -eq 1) + { + return + } + + ./make.ps1 version + Invoke-Expression "$utilityPath $modID --docs | Out-File -Encoding 'UTF8' DOCUMENTATION.md" + Invoke-Expression "$utilityPath $modID --weapon-docs | Out-File -Encoding "UTF8" WEAPONS.md" + Invoke-Expression "$utilityPath $modID --lua-docs | Out-File -Encoding 'UTF8' Lua-API.md" + Write-Host "Docs generated." -ForegroundColor Green +} + +function CheckForUtility +{ + if (Test-Path $utilityPath) + { + return 0 + } + + Write-Host "OpenRA.Utility.exe could not be found. Build the project first using the `"all`" command." -ForegroundColor Red + return 1 +} + +function CheckForDotnet +{ + if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -eq $null) + { + Write-Host "The 'dotnet' tool is required to compile OpenRA. Please install the .NET Core SDK or Visual Studio and try again. https://dotnet.microsoft.com/download" -ForegroundColor Red + return 1 + } + + return 0 +} + +function WaitForInput +{ + echo "Press enter to continue." + while ($true) + { + if ([System.Console]::KeyAvailable) + { + exit + } + Start-Sleep -Milliseconds 50 + } +} + +function ReadConfigLine($line, $name) +{ + $prefix = $name + '=' + if ($line.StartsWith($prefix)) + { + [Environment]::SetEnvironmentVariable($name, $line.Replace($prefix, '').Replace('"', '')) + } +} + +function ParseConfigFile($fileName) +{ + $names = @("MOD_ID", "ENGINE_VERSION", "AUTOMATIC_ENGINE_MANAGEMENT", "AUTOMATIC_ENGINE_SOURCE", + "AUTOMATIC_ENGINE_EXTRACT_DIRECTORY", "AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME", "ENGINE_DIRECTORY") + + $reader = [System.IO.File]::OpenText($fileName) + while($null -ne ($line = $reader.ReadLine())) + { + foreach ($name in $names) + { + ReadConfigLine $line $name + } + } + $reader.Close() + + $missing = @() + foreach ($name in $names) + { + if (!([System.Environment]::GetEnvironmentVariable($name))) + { + $missing += $name + } + } + + if ($missing) + { + echo "Required mod.config variables are missing:" + foreach ($m in $missing) + { + echo " $m" + } + echo "Repair your mod.config (or user.config) and try again." + WaitForInput + exit + } +} + +############################################################### +############################ Main ############################# +############################################################### +if ($PSVersionTable.PSVersion.Major -clt 3) +{ + echo "The makefile requires PowerShell version 3 or higher." + echo "Please download and install the latest Windows Management Framework version from Microsoft." + WaitForInput +} + +if ($args.Length -eq 0) +{ + echo "Command list:" + echo "" + echo " all Builds the game, its development tools and the mod dlls." + echo " version Sets the version strings for all mods to the latest" + echo " version for the current Git branch." + echo " clean Removes all built and copied files." + echo " from the mods and the engine directories." + echo " test Tests the mod's MiniYAML for errors." + echo " check Checks .cs files for StyleCop violations." + echo " check-scripts Checks .lua files for syntax errors." + echo " docs Generates the trait and Lua API documentation." + echo "" + $command = (Read-Host "Enter command").Split(' ', 2) +} +else +{ + $command = $args +} + +# Set the working directory for our IO methods +$templateDir = $pwd.Path +[System.IO.Directory]::SetCurrentDirectory($templateDir) + +# Load the environment variables from the config file +# and get the mod ID from the local environment variable +ParseConfigFile "mod.config" + +if (Test-Path "user.config") +{ + ParseConfigFile "user.config" +} + +$modID = $env:MOD_ID + +$env:MOD_SEARCH_PATHS = (Get-Item -Path ".\" -Verbose).FullName + "\mods,./mods" + +# Run the same command on the engine's make file +if ($command -eq "all" -or $command -eq "clean") +{ + $versionFile = $env:ENGINE_DIRECTORY + "/VERSION" + $currentEngine = "" + if (Test-Path $versionFile) + { + $reader = [System.IO.File]::OpenText($versionFile) + $currentEngine = $reader.ReadLine() + $reader.Close() + } + + if ($currentEngine -ne "" -and $currentEngine -eq $env:ENGINE_VERSION) + { + cd $env:ENGINE_DIRECTORY + Invoke-Expression ".\make.cmd $command" + echo "" + cd $templateDir + } + elseif ($env:AUTOMATIC_ENGINE_MANAGEMENT -ne "True") + { + echo "Automatic engine management is disabled." + echo "Please manually update the engine to version $env:ENGINE_VERSION." + WaitForInput + } + else + { + echo "OpenRA engine version $env:ENGINE_VERSION is required." + + if (Test-Path $env:ENGINE_DIRECTORY) + { + if ($currentEngine -ne "") + { + echo "Deleting engine version $currentEngine." + } + else + { + echo "Deleting existing engine (unknown version)." + } + + rm $env:ENGINE_DIRECTORY -r + } + + echo "Downloading engine..." + + if (Test-Path $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) + { + rm $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -r + } + + $url = $env:AUTOMATIC_ENGINE_SOURCE + $url = $url.Replace("$", "").Replace("{ENGINE_VERSION}", $env:ENGINE_VERSION) + + mkdir $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY > $null + $dlPath = Join-Path $pwd (Split-Path -leaf $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) + $dlPath = Join-Path $dlPath (Split-Path -leaf $env:AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME) + + $client = new-object System.Net.WebClient + [Net.ServicePointManager]::SecurityProtocol = 'Tls12' + $client.DownloadFile($url, $dlPath) + + Add-Type -assembly "system.io.compression.filesystem" + [io.compression.zipfile]::ExtractToDirectory($dlPath, $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) + rm $dlPath + + $extractedDir = Get-ChildItem $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -Recurse | ?{ $_.PSIsContainer } | Select-Object -First 1 + Move-Item $extractedDir.FullName -Destination $templateDir + Rename-Item $extractedDir.Name (Split-Path -leaf $env:ENGINE_DIRECTORY) + + rm $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -r + + cd $env:ENGINE_DIRECTORY + Invoke-Expression ".\make.cmd version $env:ENGINE_VERSION" + Invoke-Expression ".\make.cmd $command" + echo "" + cd $templateDir + } +} + +$utilityPath = $env:ENGINE_DIRECTORY + "/OpenRA.Utility.exe" +$styleCheckPath = $env:ENGINE_DIRECTORY + "/OpenRA.StyleCheck.exe" + +$execute = $command +if ($command.Length -gt 1) +{ + $execute = $command[0] +} + +switch ($execute) +{ + "all" { All-Command } + "version" { Version-Command } + "clean" { Clean-Command } + "test" { Test-Command } + "check" { Check-Command } + "check-scripts" { Check-Scripts-Command } + "docs" { Docs-Command } + Default { echo ("Invalid command '{0}'" -f $command) } +} + +# In case the script was called without any parameters we keep the window open +if ($args.Length -eq 0) +{ + WaitForInput +} diff --git a/mod.config b/mod.config index 5f5d546da..ff53fddac 100644 --- a/mod.config +++ b/mod.config @@ -30,7 +30,7 @@ PACKAGING_FAQ_URL="http://wiki.openra.net/FAQ" PACKAGING_AUTHORS="The Red Alert 2 Mod authors" -PACKAGING_OSX_LAUNCHER_TAG="osx-launcher-20200209" +PACKAGING_OSX_LAUNCHER_TAG="osx-launcher-20200316" # The macOS disk image icon positions, matched to the background artwork PACKAGING_OSX_DMG_MOD_ICON_POSITION="190, 210" diff --git a/packaging/artwork/macos-background-2x.png b/packaging/artwork/macos-background-2x.png new file mode 100644 index 000000000..f4050f207 Binary files /dev/null and b/packaging/artwork/macos-background-2x.png differ diff --git a/packaging/artwork/macos-background.png b/packaging/artwork/macos-background.png new file mode 100644 index 000000000..d9b0b21b8 Binary files /dev/null and b/packaging/artwork/macos-background.png differ diff --git a/packaging/linux/include/Eluant.dll.config b/packaging/linux/include/Eluant.dll.config deleted file mode 100644 index 561d8e90d..000000000 --- a/packaging/linux/include/Eluant.dll.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packaging/linux/include/OpenAL-CS.dll.config b/packaging/linux/include/OpenAL-CS.dll.config deleted file mode 100644 index 43cedc79c..000000000 --- a/packaging/linux/include/OpenAL-CS.dll.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packaging/linux/include/SDL2-CS.dll.config b/packaging/linux/include/SDL2-CS.dll.config deleted file mode 100644 index a2aa92848..000000000 --- a/packaging/linux/include/SDL2-CS.dll.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packaging/windows/buildpackage.nsi b/packaging/windows/buildpackage.nsi index 1b8176785..e8dd8b161 100644 --- a/packaging/windows/buildpackage.nsi +++ b/packaging/windows/buildpackage.nsi @@ -1,4 +1,4 @@ -; Copyright 2007-2020 OpenRA developers (see AUTHORS) +; Copyright 2007-2021 OpenRA developers (see AUTHORS) ; This file is part of OpenRA. ; ; OpenRA is free software: you can redistribute it and/or modify @@ -14,6 +14,7 @@ ; You should have received a copy of the GNU General Public License ; along with OpenRA. If not, see . + !include "MUI2.nsh" !include "FileFunc.nsh" !include "WordFunc.nsh" @@ -85,7 +86,7 @@ Section "Game" GAME File "${SRCDIR}\SDL2-CS.dll" File "${SRCDIR}\OpenAL-CS.dll" File "${SRCDIR}\global mix database.dat" - File "${SRCDIR}\MaxMind.Db.dll" + File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP" File "${SRCDIR}\eluant.dll" File "${SRCDIR}\rix0rrr.BeaconLib.dll" File "${DEPSDIR}\soft_oal.dll" @@ -179,8 +180,7 @@ Function ${UN}Clean Delete $INSTDIR\COPYING Delete $INSTDIR\${MOD_ID}.ico Delete "$INSTDIR\global mix database.dat" - Delete $INSTDIR\MaxMind.Db.dll - Delete $INSTDIR\KopiLua.dll + Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP Delete $INSTDIR\soft_oal.dll Delete $INSTDIR\SDL2.dll Delete $INSTDIR\lua51.dll diff --git a/utility.cmd b/utility.cmd index 7259a1b99..0a9eee325 100644 --- a/utility.cmd +++ b/utility.cmd @@ -1,47 +1,47 @@ -@echo off -setlocal EnableDelayedExpansion - -FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) -if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) -set MOD_SEARCH_PATHS=%~dp0mods,./mods - -if "!MOD_ID!" == "" goto badconfig -if "!ENGINE_VERSION!" == "" goto badconfig -if "!ENGINE_DIRECTORY!" == "" goto badconfig - -title OpenRA.Utility.exe %MOD_ID% - -set TEMPLATE_DIR=%CD% -if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine ->nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine -cd %ENGINE_DIRECTORY% - -:loop -echo. -echo ---------------------------------------- -echo. -echo Enter a utility command or --exit to exit. -echo Press enter to view a list of valid utility commands. -echo. - -set /P command=Please enter a command: OpenRA.Utility.exe %MOD_ID% -if /I "%command%" EQU "--exit" (cd %TEMPLATE_DIR% & exit /b) -echo. -echo ---------------------------------------- -echo. -echo OpenRA.Utility.exe %MOD_ID% %command% -call OpenRA.Utility.exe %MOD_ID% %command% -goto loop - -:noengine -echo Required engine files not found. -echo Run `make all` in the mod directory to fetch and build the required files, then try again. -pause -exit /b - -:badconfig -echo Required mod.config variables are missing. -echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are -echo defined in your mod.config (or user.config) and try again. -pause +@echo off +setlocal EnableDelayedExpansion + +FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) +if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) +set MOD_SEARCH_PATHS=%~dp0mods,./mods + +if "!MOD_ID!" == "" goto badconfig +if "!ENGINE_VERSION!" == "" goto badconfig +if "!ENGINE_DIRECTORY!" == "" goto badconfig + +title OpenRA.Utility.exe %MOD_ID% + +set TEMPLATE_DIR=%CD% +if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine +>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine +cd %ENGINE_DIRECTORY% + +:loop +echo. +echo ---------------------------------------- +echo. +echo Enter a utility command or --exit to exit. +echo Press enter to view a list of valid utility commands. +echo. + +set /P command=Please enter a command: OpenRA.Utility.exe %MOD_ID% +if /I "%command%" EQU "--exit" (cd %TEMPLATE_DIR% & exit /b) +echo. +echo ---------------------------------------- +echo. +echo OpenRA.Utility.exe %MOD_ID% %command% +call OpenRA.Utility.exe %MOD_ID% %command% +goto loop + +:noengine +echo Required engine files not found. +echo Run `make all` in the mod directory to fetch and build the required files, then try again. +pause +exit /b + +:badconfig +echo Required mod.config variables are missing. +echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are +echo defined in your mod.config (or user.config) and try again. +pause exit /b \ No newline at end of file