diff --git a/ExampleMod.sln b/ExampleMod.sln index 53ed299..c624100 100644 --- a/ExampleMod.sln +++ b/ExampleMod.sln @@ -1,36 +1,36 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Example", "OpenRA.Mods.Example\OpenRA.Mods.Example.csproj", "{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Game", "engine\OpenRA.Game\OpenRA.Game.csproj", "{0DFB103F-2962-400F-8C6D-E2C28CCBA633}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Common", "engine\OpenRA.Mods.Common\OpenRA.Mods.Common.csproj", "{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Release-x86|Any CPU = Release-x86|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.Build.0 = Release|Any CPU - {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU - {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.Build.0 = Release|Any CPU - {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.Build.0 = Release|Any CPU - {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.ActiveCfg = Release-x86|Any CPU - {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.Build.0 = Release-x86|Any CPU - {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.Build.0 = Release|Any CPU - {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU - {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Example", "OpenRA.Mods.Example\OpenRA.Mods.Example.csproj", "{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Game", "engine\OpenRA.Game\OpenRA.Game.csproj", "{0DFB103F-2962-400F-8C6D-E2C28CCBA633}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Common", "engine\OpenRA.Mods.Common\OpenRA.Mods.Common.csproj", "{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Release-x86|Any CPU = Release-x86|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.Build.0 = Release|Any CPU + {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU + {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.Build.0 = Release|Any CPU + {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.Build.0 = Release|Any CPU + {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.ActiveCfg = Release-x86|Any CPU + {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.Build.0 = Release-x86|Any CPU + {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.Build.0 = Release|Any CPU + {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU + {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/OpenRA.Mods.Example/OpenRA.Mods.Example.csproj b/OpenRA.Mods.Example/OpenRA.Mods.Example.csproj index a788688..d5d87f9 100644 --- a/OpenRA.Mods.Example/OpenRA.Mods.Example.csproj +++ b/OpenRA.Mods.Example/OpenRA.Mods.Example.csproj @@ -1,40 +1,40 @@ - - - net472 - true - true - 7.3 - true - true - ../engine/bin - false - AnyCPU - false - ../engine/OpenRA.ruleset - - - - - - - DEBUG;TRACE - false - - - - False - - - False - - - - - - - - - - - - + + + net472 + true + true + 7.3 + true + true + ../engine/bin + false + AnyCPU + false + ../engine/OpenRA.ruleset + + + + + + + DEBUG;TRACE + false + + + + False + + + False + + + + + + + + + + + + diff --git a/launch-dedicated.cmd b/launch-dedicated.cmd index 0434cf9..c78a427 100644 --- a/launch-dedicated.cmd +++ b/launch-dedicated.cmd @@ -1,50 +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 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%\bin\OpenRA.exe goto noengine ->nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine -cd %ENGINE_DIRECTORY% - -:loop -bin\OpenRA.Server.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." 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 +:: 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%\bin\OpenRA.exe goto noengine +>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine +cd %ENGINE_DIRECTORY% + +:loop +bin\OpenRA.Server.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." 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/packaging/windows/buildpackage.nsi b/packaging/windows/buildpackage.nsi index 6b7a8c2..fa5f6c7 100644 --- a/packaging/windows/buildpackage.nsi +++ b/packaging/windows/buildpackage.nsi @@ -1,235 +1,235 @@ -; Copyright 2007-2021 OpenRA developers (see AUTHORS) -; This file is part of OpenRA. -; -; OpenRA is free software: you can redistribute it and/or modify -; it 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. -; -; OpenRA is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; 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" - -Name "${PACKAGING_DISPLAY_NAME}" -OutFile "${OUTFILE}" - -ManifestDPIAware true - -Unicode True - -Function .onInit - !ifndef USE_PROGRAMFILES32 - SetRegView 64 - !endif - ReadRegStr $INSTDIR HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir" - StrCmp $INSTDIR "" unset done - unset: - !ifndef USE_PROGRAMFILES32 - StrCpy $INSTDIR "$PROGRAMFILES64\${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" - !else - StrCpy $INSTDIR "$PROGRAMFILES32\${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" - !endif - done: -FunctionEnd - -SetCompressor lzma -RequestExecutionLevel admin - -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "${PACKAGING_WINDOWS_LICENSE_FILE}" -!insertmacro MUI_PAGE_DIRECTORY - -!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" -!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" -!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" -!define MUI_STARTMENUPAGE_DEFAULTFOLDER "OpenRA" - -Var StartMenuFolder -!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder - -!insertmacro MUI_PAGE_COMPONENTS -!insertmacro MUI_PAGE_INSTFILES - -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_UNPAGE_FINISH - -!insertmacro MUI_LANGUAGE "English" - -;*************************** -;Section Definitions -;*************************** -Section "-Reg" Reg - - ; Installation directory - WriteRegStr HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir" $INSTDIR - - ; Join server URL Scheme - WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "" "URL:Join OpenRA server" - WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "URL Protocol" "" - WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0" - WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe Launch.URI=%1" - - !ifdef USE_DISCORDID - WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "" "URL:Run game ${USE_DISCORDID} protocol" - WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "URL Protocol" "" - WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0" - WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" - !endif - -SectionEnd - -Section "Game" GAME - SectionIn RO - - SetOutPath "$INSTDIR" - File "${SRCDIR}\*.exe" - File "${SRCDIR}\*.exe.config" - File "${SRCDIR}\*.dll" - File "${SRCDIR}\*.ico" - File "${SRCDIR}\VERSION" - File "${SRCDIR}\AUTHORS" - File "${SRCDIR}\COPYING" - File "${SRCDIR}\global mix database.dat" - File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP" - File /r "${SRCDIR}\mods" - - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - CreateDirectory "$SMPROGRAMS\$StartMenuFolder" - CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk" "$OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" \ - "$OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" "" - !insertmacro MUI_STARTMENU_WRITE_END - - SetOutPath "$INSTDIR\lua" - File "${SRCDIR}\lua\*.lua" - - SetOutPath "$INSTDIR\glsl" - File "${SRCDIR}\glsl\*.frag" - File "${SRCDIR}\glsl\*.vert" - - ; Estimated install size for the control panel properties - ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 - IntFmt $0 "0x%08X" $0 - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "EstimatedSize" "$0" - - SetShellVarContext all - CreateDirectory "$APPDATA\OpenRA\ModMetadata" - nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --register-mod "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" system' - nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --clear-invalid-mod-registrations system' - SetShellVarContext current - -SectionEnd - -Section "Desktop Shortcut" DESKTOPSHORTCUT - SetOutPath "$INSTDIR" - CreateShortCut "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" \ - "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" "" -SectionEnd - -;*************************** -;Dependency Sections -;*************************** -Section "-DotNet" DotNet - ClearErrors - ; https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed - ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release" - IfErrors error 0 - IntCmp $0 461808 done error done - error: - MessageBox MB_OK ".NET Framework v4.7.2 or later is required to run OpenRA." - Abort - done: -SectionEnd - -;*************************** -;Uninstaller Sections -;*************************** -Section "-Uninstaller" - WriteUninstaller $INSTDIR\uninstaller.exe - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayName" "${PACKAGING_DISPLAY_NAME}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "UninstallString" "$INSTDIR\uninstaller.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallLocation" "$INSTDIR" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\${MOD_ID}.ico" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "Publisher" "${PACKAGING_AUTHORS}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "URLInfoAbout" "${PACKAGING_WEBSITE_URL}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayVersion" "${TAG}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoModify" "1" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoRepair" "1" -SectionEnd - -!macro Clean UN -Function ${UN}Clean - nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --unregister-mod system' - - RMDir /r $INSTDIR\mods - RMDir /r $INSTDIR\maps - RMDir /r $INSTDIR\glsl - RMDir /r $INSTDIR\lua - Delete $INSTDIR\*.exe - Delete $INSTDIR\*.exe.config - Delete $INSTDIR\*.dll - Delete $INSTDIR\*.ico - Delete $INSTDIR\VERSION - Delete $INSTDIR\AUTHORS - Delete $INSTDIR\COPYING - Delete "$INSTDIR\global mix database.dat" - Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP - RMDir /r $INSTDIR\Support - - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" - DeleteRegKey HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" - - !ifdef USE_DISCORDID - DeleteRegKey HKLM "Software\Classes\discord-${DISCORD_APP_ID}" - !endif - - Delete $INSTDIR\uninstaller.exe - RMDir $INSTDIR - - !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder - - ; Clean up start menu: Delete all our icons, and the OpenRA folder - ; *only* if we were the only installed version - Delete "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk" - RMDir "$SMPROGRAMS\$StartMenuFolder" - - Delete "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk" - DeleteRegKey HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" -FunctionEnd -!macroend - -!insertmacro Clean "" -!insertmacro Clean "un." - -Section "Uninstall" - Call un.Clean -SectionEnd - -;*************************** -;Section Descriptions -;*************************** -LangString DESC_GAME ${LANG_ENGLISH} "${PACKAGING_DISPLAY_NAME} game files." -LangString DESC_DESKTOPSHORTCUT ${LANG_ENGLISH} "Place shortcut on the Desktop." - -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${GAME} $(DESC_GAME) - !insertmacro MUI_DESCRIPTION_TEXT ${DESKTOPSHORTCUT} $(DESC_DESKTOPSHORTCUT) -!insertmacro MUI_FUNCTION_DESCRIPTION_END - -;*************************** -;Callbacks -;*************************** - -Function .onInstFailed - Call Clean -FunctionEnd +; Copyright 2007-2021 OpenRA developers (see AUTHORS) +; This file is part of OpenRA. +; +; OpenRA is free software: you can redistribute it and/or modify +; it 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. +; +; OpenRA is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; 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" + +Name "${PACKAGING_DISPLAY_NAME}" +OutFile "${OUTFILE}" + +ManifestDPIAware true + +Unicode True + +Function .onInit + !ifndef USE_PROGRAMFILES32 + SetRegView 64 + !endif + ReadRegStr $INSTDIR HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir" + StrCmp $INSTDIR "" unset done + unset: + !ifndef USE_PROGRAMFILES32 + StrCpy $INSTDIR "$PROGRAMFILES64\${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" + !else + StrCpy $INSTDIR "$PROGRAMFILES32\${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" + !endif + done: +FunctionEnd + +SetCompressor lzma +RequestExecutionLevel admin + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "${PACKAGING_WINDOWS_LICENSE_FILE}" +!insertmacro MUI_PAGE_DIRECTORY + +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "OpenRA" + +Var StartMenuFolder +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder + +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_INSTFILES + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +!insertmacro MUI_LANGUAGE "English" + +;*************************** +;Section Definitions +;*************************** +Section "-Reg" Reg + + ; Installation directory + WriteRegStr HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir" $INSTDIR + + ; Join server URL Scheme + WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "" "URL:Join OpenRA server" + WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "URL Protocol" "" + WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0" + WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe Launch.URI=%1" + + !ifdef USE_DISCORDID + WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "" "URL:Run game ${USE_DISCORDID} protocol" + WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "URL Protocol" "" + WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0" + WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" + !endif + +SectionEnd + +Section "Game" GAME + SectionIn RO + + SetOutPath "$INSTDIR" + File "${SRCDIR}\*.exe" + File "${SRCDIR}\*.exe.config" + File "${SRCDIR}\*.dll" + File "${SRCDIR}\*.ico" + File "${SRCDIR}\VERSION" + File "${SRCDIR}\AUTHORS" + File "${SRCDIR}\COPYING" + File "${SRCDIR}\global mix database.dat" + File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP" + File /r "${SRCDIR}\mods" + + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory "$SMPROGRAMS\$StartMenuFolder" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk" "$OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" \ + "$OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" "" + !insertmacro MUI_STARTMENU_WRITE_END + + SetOutPath "$INSTDIR\lua" + File "${SRCDIR}\lua\*.lua" + + SetOutPath "$INSTDIR\glsl" + File "${SRCDIR}\glsl\*.frag" + File "${SRCDIR}\glsl\*.vert" + + ; Estimated install size for the control panel properties + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "EstimatedSize" "$0" + + SetShellVarContext all + CreateDirectory "$APPDATA\OpenRA\ModMetadata" + nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --register-mod "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" system' + nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --clear-invalid-mod-registrations system' + SetShellVarContext current + +SectionEnd + +Section "Desktop Shortcut" DESKTOPSHORTCUT + SetOutPath "$INSTDIR" + CreateShortCut "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" \ + "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" "" +SectionEnd + +;*************************** +;Dependency Sections +;*************************** +Section "-DotNet" DotNet + ClearErrors + ; https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed + ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release" + IfErrors error 0 + IntCmp $0 461808 done error done + error: + MessageBox MB_OK ".NET Framework v4.7.2 or later is required to run OpenRA." + Abort + done: +SectionEnd + +;*************************** +;Uninstaller Sections +;*************************** +Section "-Uninstaller" + WriteUninstaller $INSTDIR\uninstaller.exe + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayName" "${PACKAGING_DISPLAY_NAME}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "UninstallString" "$INSTDIR\uninstaller.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\${MOD_ID}.ico" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "Publisher" "${PACKAGING_AUTHORS}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "URLInfoAbout" "${PACKAGING_WEBSITE_URL}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayVersion" "${TAG}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoModify" "1" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoRepair" "1" +SectionEnd + +!macro Clean UN +Function ${UN}Clean + nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --unregister-mod system' + + RMDir /r $INSTDIR\mods + RMDir /r $INSTDIR\maps + RMDir /r $INSTDIR\glsl + RMDir /r $INSTDIR\lua + Delete $INSTDIR\*.exe + Delete $INSTDIR\*.exe.config + Delete $INSTDIR\*.dll + Delete $INSTDIR\*.ico + Delete $INSTDIR\VERSION + Delete $INSTDIR\AUTHORS + Delete $INSTDIR\COPYING + Delete "$INSTDIR\global mix database.dat" + Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP + RMDir /r $INSTDIR\Support + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" + DeleteRegKey HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" + + !ifdef USE_DISCORDID + DeleteRegKey HKLM "Software\Classes\discord-${DISCORD_APP_ID}" + !endif + + Delete $INSTDIR\uninstaller.exe + RMDir $INSTDIR + + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder + + ; Clean up start menu: Delete all our icons, and the OpenRA folder + ; *only* if we were the only installed version + Delete "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk" + RMDir "$SMPROGRAMS\$StartMenuFolder" + + Delete "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk" + DeleteRegKey HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" +FunctionEnd +!macroend + +!insertmacro Clean "" +!insertmacro Clean "un." + +Section "Uninstall" + Call un.Clean +SectionEnd + +;*************************** +;Section Descriptions +;*************************** +LangString DESC_GAME ${LANG_ENGLISH} "${PACKAGING_DISPLAY_NAME} game files." +LangString DESC_DESKTOPSHORTCUT ${LANG_ENGLISH} "Place shortcut on the Desktop." + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${GAME} $(DESC_GAME) + !insertmacro MUI_DESCRIPTION_TEXT ${DESKTOPSHORTCUT} $(DESC_DESKTOPSHORTCUT) +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +;*************************** +;Callbacks +;*************************** + +Function .onInstFailed + Call Clean +FunctionEnd