Unify Windows and mono build systems.
The Makefile behaviour is recreated using the new and significantly cleaner .NET Core csproj format. fixheader.exe is promoted to OpenRA.PostProcess.exe and now runs on all platforms.
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
#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
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace fixheader
|
||||
{
|
||||
class fixheader
|
||||
{
|
||||
static byte[] data;
|
||||
static int peOffset;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("fixheader {0}", args[0]);
|
||||
data = File.ReadAllBytes(args[0]);
|
||||
peOffset = BitConverter.ToInt32(data, 0x3c);
|
||||
var corHeaderRva = BitConverter.ToInt32(data, peOffset + 20 + 100 + 14 * 8);
|
||||
var corHeaderOffset = RvaToOffset(corHeaderRva);
|
||||
|
||||
data[corHeaderOffset + 16] |= 2;
|
||||
|
||||
// Set Flag "Application can handle large (>2GB) addresses (/LARGEADDRESSAWARE)"
|
||||
data[peOffset + 4 + 18] |= 0x20;
|
||||
|
||||
File.WriteAllBytes(args[0], data);
|
||||
}
|
||||
|
||||
static int RvaToOffset(int va)
|
||||
{
|
||||
var numSections = BitConverter.ToInt16(data, peOffset + 6);
|
||||
var numDataDirectories = BitConverter.ToInt32(data, peOffset + 24 + 92);
|
||||
var sectionTableStart = peOffset + 24 + 96 + 8 * numDataDirectories;
|
||||
|
||||
for (var i = 0; i < numSections; i++)
|
||||
{
|
||||
var virtualSize = BitConverter.ToInt32(data, sectionTableStart + 40 * i + 8);
|
||||
var virtualAddr = BitConverter.ToInt32(data, sectionTableStart + 40 * i + 12);
|
||||
var fileOffset = BitConverter.ToInt32(data, sectionTableStart + 40 * i + 20);
|
||||
|
||||
if (va >= virtualAddr && va < virtualAddr + virtualSize)
|
||||
return va - virtualAddr + fileOffset;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,9 +30,9 @@ fi
|
||||
function makelauncher()
|
||||
{
|
||||
sed "s|DISPLAY_NAME|$2|" WindowsLauncher.cs.in | sed "s|MOD_ID|$3|" | sed "s|FAQ_URL|${FAQ_URL}|" > WindowsLauncher.cs
|
||||
csc WindowsLauncher.cs -warn:4 -warnaserror -out:"$1" -t:winexe ${LAUNCHER_LIBS} -win32icon:"$4"
|
||||
csc WindowsLauncher.cs -warn:4 -warnaserror -platform:"x86" -out:"$1" -t:winexe ${LAUNCHER_LIBS} -win32icon:"$4"
|
||||
rm WindowsLauncher.cs
|
||||
mono "${SRCDIR}/fixheader.exe" "$1" > /dev/null
|
||||
mono "${SRCDIR}/OpenRA.PostProcess.exe" "$1" -LAA > /dev/null
|
||||
}
|
||||
|
||||
echo "Building core files"
|
||||
|
||||
Reference in New Issue
Block a user