Add support for dotnet core for Windows
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
[[prereqs]]
|
||||
name = "net-4.7.2"
|
||||
|
||||
[[actions]]
|
||||
os = "windows"
|
||||
name = "Red Alert"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
# Makefile (install target for local installs and downstream packaging)
|
||||
# Linux AppImage packaging
|
||||
# macOS packaging
|
||||
# Windows packaging
|
||||
# Mod SDK Linux AppImage packaging
|
||||
# Mod SDK macOS packaging
|
||||
# Mod SDK Windows packaging
|
||||
@@ -33,26 +32,27 @@ install_assemblies_mono() {
|
||||
echo "Building assemblies"
|
||||
ORIG_PWD=$(pwd)
|
||||
cd "${SRC_PATH}" || exit 1
|
||||
msbuild -verbosity:m -nologo -t:Clean
|
||||
|
||||
rm -rf "${SRC_PATH}/OpenRA."*/obj
|
||||
rm -rf "${SRC_PATH:?}/bin"
|
||||
msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}"
|
||||
|
||||
msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}" -p:Mono=true -p:DefineConstants="MONO"
|
||||
if [ "${TARGETPLATFORM}" = "unix-generic" ]; then
|
||||
./configure-system-libraries.sh
|
||||
fi
|
||||
|
||||
./fetch-geoip.sh
|
||||
cd "${ORIG_PWD}" || exit 1
|
||||
|
||||
echo "Installing engine to ${DEST_PATH}"
|
||||
install -d "${DEST_PATH}"
|
||||
|
||||
# Core engine
|
||||
install -m755 "${SRC_PATH}/bin/OpenRA.Server.exe" "${DEST_PATH}"
|
||||
install -m755 "${SRC_PATH}/bin/OpenRA.Utility.exe" "${DEST_PATH}"
|
||||
install -m755 "${SRC_PATH}/bin/OpenRA.Server.dll" "${DEST_PATH}"
|
||||
install -m755 "${SRC_PATH}/bin/OpenRA.Utility.dll" "${DEST_PATH}"
|
||||
install -m644 "${SRC_PATH}/bin/OpenRA.Game.dll" "${DEST_PATH}"
|
||||
install -m644 "${SRC_PATH}/bin/OpenRA.Platforms.Default.dll" "${DEST_PATH}"
|
||||
if [ "${COPY_GENERIC_LAUNCHER}" = "True" ]; then
|
||||
install -m755 "${SRC_PATH}/bin/OpenRA.exe" "${DEST_PATH}"
|
||||
install -m755 "${SRC_PATH}/bin/OpenRA.dll" "${DEST_PATH}"
|
||||
fi
|
||||
|
||||
# Mod dlls
|
||||
@@ -97,6 +97,32 @@ install_assemblies_mono() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Compile and publish the core engine and specified mod assemblies to the target directory
|
||||
# Arguments:
|
||||
# SRC_PATH: Path to the root OpenRA directory
|
||||
# DEST_PATH: Path to the root of the install destination (will be created if necessary)
|
||||
# TARGETPLATFORM: Platform type (win-x86, win-x64, osx-x64, linux-x64, unix-generic)
|
||||
# COPY_GENERIC_LAUNCHER: If set to True the OpenRA.exe will also be copied (True, False)
|
||||
# COPY_CNC_DLL: If set to True the OpenRA.Mods.Cnc.dll will also be copied (True, False)
|
||||
# COPY_D2K_DLL: If set to True the OpenRA.Mods.D2k.dll will also be copied (True, False)
|
||||
# Used by:
|
||||
# Windows packaging
|
||||
install_assemblies() {
|
||||
SRC_PATH="${1}"
|
||||
DEST_PATH="${2}"
|
||||
TARGETPLATFORM="${3}"
|
||||
COPY_GENERIC_LAUNCHER="${4}"
|
||||
COPY_CNC_DLL="${5}"
|
||||
COPY_D2K_DLL="${6}"
|
||||
|
||||
ORIG_PWD=$(pwd)
|
||||
cd "${SRC_PATH}" || exit 1
|
||||
|
||||
dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -p:CopyGenericLauncher="${COPY_GENERIC_LAUNCHER}" -p:CopyCncDll="${COPY_CNC_DLL}" -p:CopyD2kDll="${COPY_D2K_DLL}" -r "${TARGETPLATFORM}" -o "${DEST_PATH}"
|
||||
|
||||
cd "${ORIG_PWD}" || exit 1
|
||||
}
|
||||
|
||||
# Copy the core engine and specified mod data to the target directory
|
||||
# Arguments:
|
||||
# SRC_PATH: Path to the root OpenRA directory
|
||||
@@ -115,6 +141,8 @@ install_data() {
|
||||
DEST_PATH="${2}"
|
||||
shift 2
|
||||
|
||||
"${SRC_PATH}"/fetch-geoip.sh
|
||||
|
||||
echo "Installing engine files to ${DEST_PATH}"
|
||||
for FILE in VERSION AUTHORS COPYING IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP "global mix database.dat"; do
|
||||
install -m644 "${SRC_PATH}/${FILE}" "${DEST_PATH}"
|
||||
@@ -160,20 +188,15 @@ install_windows_launcher()
|
||||
MOD_ID="${4}"
|
||||
LAUNCHER_NAME="${5}"
|
||||
MOD_NAME="${6}"
|
||||
ICON_PATH="${7}"
|
||||
FAQ_URL="${8}"
|
||||
FAQ_URL="${7}"
|
||||
|
||||
msbuild -verbosity:m -nologo -t:Clean "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj"
|
||||
rm -rf "${SRC_PATH:?}/bin"
|
||||
msbuild -t:Build "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}" -p:LauncherName="${LAUNCHER_NAME}" -p:LauncherIcon="${ICON_PATH}" -p:ModID="${MOD_ID}" -p:DisplayName="${MOD_NAME}" -p:FaqUrl="${FAQ_URL}"
|
||||
install -m755 "${SRC_PATH}/bin/${LAUNCHER_NAME}.exe" "${DEST_PATH}"
|
||||
install -m644 "${SRC_PATH}/bin/${LAUNCHER_NAME}.exe.config" "${DEST_PATH}"
|
||||
rm -rf "${SRC_PATH}/OpenRA.WindowsLauncher/obj"
|
||||
dotnet publish "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -c Release -r "${TARGETPLATFORM}" -p:LauncherName="${LAUNCHER_NAME}" -p:TargetPlatform="${TARGETPLATFORM}" -p:ModID="${MOD_ID}" -p:DisplayName="${MOD_NAME}" -p:FaqUrl="${FAQ_URL}" -o "${DEST_PATH}"
|
||||
|
||||
# Enable the full 4GB address space for the 32 bit game executable
|
||||
# The server and utility do not use enough memory to need this
|
||||
if [ "${TARGETPLATFORM}" = "win-x86" ]; then
|
||||
python3 "${SRC_PATH}/packaging/windows/MakeLAA.py" "${DEST_PATH}/${LAUNCHER_NAME}.exe"
|
||||
fi
|
||||
# NET 5 is unable to customize the application host for windows when compiling from Linux,
|
||||
# so we must patch the properties we need in the PE header.
|
||||
# Setting the application icon requires an external tool, so is left to the calling code
|
||||
python3 "${SRC_PATH}/packaging/windows/fixlauncher.py" "${DEST_PATH}/${LAUNCHER_NAME}.exe"
|
||||
}
|
||||
|
||||
# Write a version string to the engine VERSION file
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
# OpenRA packaging script for Linux (AppImage)
|
||||
set -e
|
||||
|
||||
command -v make >/dev/null 2>&1 || { echo >&2 "Linux packaging requires make."; exit 1; }
|
||||
command -v tar >/dev/null 2>&1 || { echo >&2 "Linux packaging requires tar."; exit 1; }
|
||||
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Linux packaging requires curl or wget."; exit 1; }
|
||||
|
||||
DEPENDENCIES_TAG="20200328"
|
||||
DEPENDENCIES_TAG="20201222"
|
||||
|
||||
if [ $# -eq "0" ]; then
|
||||
echo "Usage: $(basename "$0") version [outputdir]"
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
HERE="$(dirname "$(readlink -f "${0}")")"
|
||||
cd "${HERE}/../lib/openra" || exit 1
|
||||
|
||||
mono --debug OpenRA.Server.exe Game.Mod="{MODID}" "$@"
|
||||
mono --debug OpenRA.Server.dll Game.Mod="{MODID}" "$@"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
cd "{GAME_INSTALL_DIR}"
|
||||
|
||||
mono {DEBUG} OpenRA.Server.exe Game.Mod={MODID} "$@"
|
||||
mono {DEBUG} OpenRA.Server.dll Game.Mod={MODID} "$@"
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
# OpenRA.Utility relies on keeping the original working directory, so don't change directory
|
||||
HERE="$(dirname "$(readlink -f "${0}")")"
|
||||
mono --debug "${HERE}/../lib/openra/OpenRA.Utility.exe" {MODID} "$@"
|
||||
mono --debug "${HERE}/../lib/openra/OpenRA.Utility.dll" {MODID} "$@"
|
||||
|
||||
@@ -35,7 +35,7 @@ fi
|
||||
|
||||
# Run the game
|
||||
export SDL_VIDEO_X11_WMCLASS="openra-{MODID}-{TAG}"
|
||||
mono --debug OpenRA.exe Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" Engine.LaunchWrapper="${HERE}/restore-environment.sh" "${JOIN_SERVER}" "$@"
|
||||
mono --debug OpenRA.dll 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
|
||||
|
||||
@@ -9,7 +9,7 @@ if [ "${1#${PROTOCOL_PREFIX}}" != "${1}" ]; then
|
||||
fi
|
||||
|
||||
# Run the game
|
||||
mono {DEBUG} OpenRA.exe Game.Mod={MODID} Engine.LaunchPath="{BIN_DIR}/openra-{MODID}" "${JOIN_SERVER}" "$@"
|
||||
mono {DEBUG} OpenRA.dll Game.Mod={MODID} Engine.LaunchPath="{BIN_DIR}/openra-{MODID}" "${JOIN_SERVER}" "$@"
|
||||
|
||||
# Show a crash dialog if something went wrong
|
||||
if [ $? != 0 ] && [ $? != 1 ]; then
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
set -e
|
||||
|
||||
MONO_TAG="osx-launcher-20200830"
|
||||
MONO_TAG="osx-launcher-20201222"
|
||||
|
||||
if [ $# -ne "2" ]; then
|
||||
echo "Usage: $(basename "$0") tag outputdir"
|
||||
|
||||
@@ -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.exe";
|
||||
NSString *gameName = @"OpenRA.dll";
|
||||
NSString *modId = nil;
|
||||
|
||||
NSDictionary *plist = [[NSBundle mainBundle] infoDictionary];
|
||||
|
||||
@@ -131,7 +131,7 @@ NSTask *gameTask;
|
||||
launched = YES;
|
||||
|
||||
// Default values - can be overriden by setting certain keys Info.plist
|
||||
NSString *gameName = @"OpenRA.exe";
|
||||
NSString *gameName = @"OpenRA.dll";
|
||||
NSString *modId = nil;
|
||||
|
||||
NSDictionary *plist = [[NSBundle mainBundle] infoDictionary];
|
||||
|
||||
@@ -129,14 +129,16 @@ Section "Game" GAME
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
File "${SRCDIR}\*.exe"
|
||||
File "${SRCDIR}\*.exe.config"
|
||||
File "${SRCDIR}\*.dll.config"
|
||||
File "${SRCDIR}\*.dll"
|
||||
File "${SRCDIR}\*.ico"
|
||||
File "${SRCDIR}\*.deps.json"
|
||||
File "${SRCDIR}\*.runtimeconfig.json"
|
||||
File "${SRCDIR}\global mix database.dat"
|
||||
File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP"
|
||||
File "${SRCDIR}\VERSION"
|
||||
File "${SRCDIR}\AUTHORS"
|
||||
File "${SRCDIR}\COPYING"
|
||||
File "${SRCDIR}\global mix database.dat"
|
||||
File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP"
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
@@ -162,6 +164,7 @@ Section "Game" GAME
|
||||
|
||||
SetShellVarContext all
|
||||
CreateDirectory "$APPDATA\OpenRA\ModMetadata"
|
||||
SetOutPath "$INSTDIR"
|
||||
nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ra --register-mod "$INSTDIR\RedAlert.exe" system'
|
||||
nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ra --clear-invalid-mod-registrations system'
|
||||
nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" cnc --register-mod "$INSTDIR\TiberianDawn.exe" system'
|
||||
@@ -182,21 +185,6 @@ Section "Desktop Shortcut" DESKTOPSHORTCUT
|
||||
"$INSTDIR\Dune2000.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
|
||||
;***************************
|
||||
@@ -225,14 +213,17 @@ Function ${UN}Clean
|
||||
RMDir /r $INSTDIR\glsl
|
||||
RMDir /r $INSTDIR\lua
|
||||
Delete $INSTDIR\*.exe
|
||||
Delete $INSTDIR\*.exe.config
|
||||
Delete $INSTDIR\*.dll
|
||||
Delete $INSTDIR\*.ico
|
||||
Delete $INSTDIR\*.dll.config
|
||||
Delete $INSTDIR\*.deps.json
|
||||
Delete $INSTDIR\*.runtimeconfig.json
|
||||
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\OpenRA${SUFFIX}"
|
||||
|
||||
@@ -32,6 +32,12 @@ elif [[ ${TAG} == playtest* ]]; then
|
||||
SUFFIX=" (playtest)"
|
||||
fi
|
||||
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -s -L -O https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe || exit 3
|
||||
else
|
||||
wget -cq https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe || exit 3
|
||||
fi
|
||||
|
||||
function makelauncher()
|
||||
{
|
||||
LAUNCHER_NAME="${1}"
|
||||
@@ -40,7 +46,9 @@ function makelauncher()
|
||||
PLATFORM="${4}"
|
||||
|
||||
convert "${ARTWORK_DIR}/${MOD_ID}_16x16.png" "${ARTWORK_DIR}/${MOD_ID}_24x24.png" "${ARTWORK_DIR}/${MOD_ID}_32x32.png" "${ARTWORK_DIR}/${MOD_ID}_48x48.png" "${ARTWORK_DIR}/${MOD_ID}_256x256.png" "${BUILTDIR}/${MOD_ID}.ico"
|
||||
install_windows_launcher "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${LAUNCHER_NAME}" "${DISPLAY_NAME}" "${BUILTDIR}/${MOD_ID}.ico" "${FAQ_URL}"
|
||||
install_windows_launcher "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${LAUNCHER_NAME}" "${DISPLAY_NAME}" "${FAQ_URL}"
|
||||
|
||||
wine64 rcedit-x64.exe "${BUILTDIR}/${LAUNCHER_NAME}.exe" --set-icon "${BUILTDIR}/${MOD_ID}.ico"
|
||||
}
|
||||
|
||||
function build_platform()
|
||||
@@ -54,7 +62,7 @@ function build_platform()
|
||||
USE_PROGRAMFILES32=""
|
||||
fi
|
||||
|
||||
install_assemblies_mono "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "False" "True" "True"
|
||||
install_assemblies "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "False" "True" "True"
|
||||
install_data "${SRCDIR}" "${BUILTDIR}" "cnc" "d2k" "ra"
|
||||
set_engine_version "${TAG}" "${BUILTDIR}"
|
||||
set_mod_version "${TAG}" "${BUILTDIR}/mods/cnc/mod.yaml" "${BUILTDIR}/mods/d2k/mod.yaml" "${BUILTDIR}/mods/ra/mod.yaml" "${BUILTDIR}/mods/modcontent/mod.yaml"
|
||||
|
||||
@@ -9,11 +9,21 @@ import struct
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(sys.argv[1] + ': Enabling /LARGEADDRESSAWARE')
|
||||
print('Patching ' + sys.argv[1] + ':')
|
||||
with open(sys.argv[1], 'r+b') as assembly:
|
||||
assembly.seek(0x3c)
|
||||
peOffset = struct.unpack('i', assembly.read(4))[0]
|
||||
peOffset = struct.unpack('H', assembly.read(2))[0]
|
||||
|
||||
assembly.seek(peOffset)
|
||||
peSignature = struct.unpack('I', assembly.read(4))[0]
|
||||
if peSignature != 0x4550:
|
||||
print(" ERROR: Invalid PE signature")
|
||||
|
||||
print(' - Setting /LARGEADDRESSAWARE')
|
||||
assembly.seek(peOffset + 4 + 18)
|
||||
flags = struct.unpack('B', assembly.read(1))[0] | 0x20
|
||||
assembly.seek(peOffset + 4 + 18)
|
||||
assembly.write(struct.pack('B', flags))
|
||||
print(' - Setting /subsystem:windows')
|
||||
assembly.seek(peOffset + 0x5C)
|
||||
assembly.write(struct.pack("H", 0x02))
|
||||
Reference in New Issue
Block a user