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:
47
OpenRA.PostProcess/Program.cs
Normal file
47
OpenRA.PostProcess/Program.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
#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;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.PostProcess
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var assembly = args.First();
|
||||
var flags = args.Skip(1).ToArray();
|
||||
|
||||
Console.WriteLine("Post-processing {0}", assembly);
|
||||
var data = File.ReadAllBytes(assembly);
|
||||
var peOffset = BitConverter.ToInt32(data, 0x3c);
|
||||
|
||||
foreach (var flag in flags)
|
||||
{
|
||||
if (flag == "-LAA")
|
||||
{
|
||||
// Set /LARGEADDRESSAWARE Flag (Application can handle large (>2GB) addresses)
|
||||
Console.WriteLine(" - Enabling /LARGEADDRESSAWARE");
|
||||
data[peOffset + 4 + 18] |= 0x20;
|
||||
}
|
||||
else
|
||||
Console.WriteLine("error: Unknown flag '{0}'", flag);
|
||||
}
|
||||
|
||||
if (flags.Length == 0)
|
||||
Console.WriteLine("error: No flags were specified");
|
||||
|
||||
File.WriteAllBytes(args[0], data);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user