Add support for dotnet core for Windows

This commit is contained in:
teinarss
2020-08-26 22:00:34 +02:00
committed by abcdefg30
parent fef7a018f2
commit 5e74e58b22
37 changed files with 557 additions and 113 deletions

View File

@@ -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}"

View File

@@ -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"

View File

@@ -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))