Merge pull request #12966 from pchote/windows-launcher
Reorganize Windows game launcher to support per-mod launchers.
This commit is contained in:
42
Makefile
42
Makefile
@@ -3,9 +3,6 @@
|
|||||||
# to compile, run:
|
# to compile, run:
|
||||||
# make [DEBUG=false]
|
# make [DEBUG=false]
|
||||||
#
|
#
|
||||||
# to compile with development tools, run:
|
|
||||||
# make all [DEBUG=false]
|
|
||||||
#
|
|
||||||
# to check unit tests (requires NUnit version >= 2.6), run:
|
# to check unit tests (requires NUnit version >= 2.6), run:
|
||||||
# make nunit [NUNIT_CONSOLE=<path-to/nunit[2]-console>] [NUNIT_LIBS_PATH=<path-to-libs-dir>] [NUNIT_LIBS=<nunit-libs>]
|
# make nunit [NUNIT_CONSOLE=<path-to/nunit[2]-console>] [NUNIT_LIBS_PATH=<path-to-libs-dir>] [NUNIT_LIBS=<nunit-libs>]
|
||||||
# Use NUNIT_CONSOLE if nunit[3|2]-console was not downloaded by `make dependencies` nor is it in bin search paths
|
# Use NUNIT_CONSOLE if nunit[3|2]-console was not downloaded by `make dependencies` nor is it in bin search paths
|
||||||
@@ -23,9 +20,6 @@
|
|||||||
# to install, run:
|
# to install, run:
|
||||||
# make [prefix=/foo] [bindir=/bar/bin] install
|
# make [prefix=/foo] [bindir=/bar/bin] install
|
||||||
#
|
#
|
||||||
# to install with development tools, run:
|
|
||||||
# make [prefix=/foo] [bindir=/bar/bin] install-all
|
|
||||||
#
|
|
||||||
# to install Linux startup scripts, desktop files and icons:
|
# to install Linux startup scripts, desktop files and icons:
|
||||||
# make install-linux-shortcuts [DEBUG=false]
|
# make install-linux-shortcuts [DEBUG=false]
|
||||||
#
|
#
|
||||||
@@ -88,7 +82,6 @@ INSTALL_DATA = $(INSTALL) -m644
|
|||||||
|
|
||||||
# program targets
|
# program targets
|
||||||
CORE = pdefault game utility server
|
CORE = pdefault game utility server
|
||||||
TOOLS = gamemonitor
|
|
||||||
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
|
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
@@ -109,7 +102,6 @@ game_SRCS := $(shell find OpenRA.Game/ -iname '*.cs')
|
|||||||
game_TARGET = OpenRA.Game.exe
|
game_TARGET = OpenRA.Game.exe
|
||||||
game_KIND = winexe
|
game_KIND = winexe
|
||||||
game_LIBS = $(COMMON_LIBS) $(game_DEPS) thirdparty/download/SharpFont.dll thirdparty/download/Open.Nat.dll
|
game_LIBS = $(COMMON_LIBS) $(game_DEPS) thirdparty/download/SharpFont.dll thirdparty/download/Open.Nat.dll
|
||||||
game_FLAGS = -win32icon:OpenRA.Game/OpenRA.ico
|
|
||||||
PROGRAMS += game
|
PROGRAMS += game
|
||||||
game: $(game_TARGET)
|
game: $(game_TARGET)
|
||||||
|
|
||||||
@@ -181,9 +173,6 @@ check: utility mods
|
|||||||
@echo "Checking for code style violations in OpenRA.Platforms.Default..."
|
@echo "Checking for code style violations in OpenRA.Platforms.Default..."
|
||||||
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default
|
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default
|
||||||
@echo
|
@echo
|
||||||
@echo "Checking for code style violations in OpenRA.GameMonitor..."
|
|
||||||
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.GameMonitor
|
|
||||||
@echo
|
|
||||||
@echo "Checking for code style violations in OpenRA.Mods.Common..."
|
@echo "Checking for code style violations in OpenRA.Mods.Common..."
|
||||||
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Mods.Common
|
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Mods.Common
|
||||||
@echo
|
@echo
|
||||||
@@ -238,16 +227,6 @@ test: utility mods
|
|||||||
|
|
||||||
##### Launchers / Utilities #####
|
##### Launchers / Utilities #####
|
||||||
|
|
||||||
gamemonitor_SRCS := $(shell find OpenRA.GameMonitor/ -iname '*.cs')
|
|
||||||
gamemonitor_TARGET = OpenRA.exe
|
|
||||||
gamemonitor_KIND = winexe
|
|
||||||
gamemonitor_DEPS = $(game_TARGET)
|
|
||||||
gamemonitor_LIBS = $(COMMON_LIBS) $(gamemonitor_DEPS) System.Windows.Forms.dll
|
|
||||||
gamemonitor_FLAGS = -win32icon:OpenRA.Game/OpenRA.ico
|
|
||||||
PROGRAMS += gamemonitor
|
|
||||||
gamemonitor: $(gamemonitor_TARGET)
|
|
||||||
|
|
||||||
# Backend for the launcher apps - queries game/mod info and applies actions to an install
|
|
||||||
utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs')
|
utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs')
|
||||||
utility_TARGET = OpenRA.Utility.exe
|
utility_TARGET = OpenRA.Utility.exe
|
||||||
utility_KIND = exe
|
utility_KIND = exe
|
||||||
@@ -297,13 +276,11 @@ default: core
|
|||||||
|
|
||||||
core: dependencies game platforms mods utility server
|
core: dependencies game platforms mods utility server
|
||||||
|
|
||||||
tools: gamemonitor
|
package: all-dependencies core docs version
|
||||||
|
|
||||||
package: all-dependencies core tools docs version
|
|
||||||
|
|
||||||
mods: mod_common mod_cnc mod_d2k
|
mods: mod_common mod_cnc mod_d2k
|
||||||
|
|
||||||
all: dependencies core tools
|
all: dependencies core
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@-$(RM_F) *.exe *.dll *.dylib *.dll.config ./OpenRA*/*.dll ./OpenRA*/*.mdb *.mdb mods/**/*.dll mods/**/*.mdb *.resources
|
@-$(RM_F) *.exe *.dll *.dylib *.dll.config ./OpenRA*/*.dll ./OpenRA*/*.mdb *.mdb mods/**/*.dll mods/**/*.mdb *.resources
|
||||||
@@ -353,8 +330,6 @@ man-page: utility mods
|
|||||||
|
|
||||||
install: install-core
|
install: install-core
|
||||||
|
|
||||||
install-all: install-core install-tools
|
|
||||||
|
|
||||||
install-linux-shortcuts: install-linux-scripts install-linux-icons install-linux-desktop
|
install-linux-shortcuts: install-linux-scripts install-linux-icons install-linux-desktop
|
||||||
|
|
||||||
install-core: default
|
install-core: default
|
||||||
@@ -393,11 +368,6 @@ ifneq ($(UNAME_S),Darwin)
|
|||||||
@$(CP) *.sh "$(DATA_INSTALL_DIR)"
|
@$(CP) *.sh "$(DATA_INSTALL_DIR)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install-tools: tools
|
|
||||||
@-echo "Installing OpenRA tools to $(DATA_INSTALL_DIR)"
|
|
||||||
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)"
|
|
||||||
@$(INSTALL_PROGRAM) $(foreach prog,$(TOOLS),$($(prog)_TARGET)) "$(DATA_INSTALL_DIR)"
|
|
||||||
|
|
||||||
install-linux-icons:
|
install-linux-icons:
|
||||||
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/icons/"
|
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/icons/"
|
||||||
@$(CP_R) packaging/linux/hicolor "$(DESTDIR)$(datadir)/icons/"
|
@$(CP_R) packaging/linux/hicolor "$(DESTDIR)$(datadir)/icons/"
|
||||||
@@ -476,9 +446,6 @@ help:
|
|||||||
@echo 'to compile, run:'
|
@echo 'to compile, run:'
|
||||||
@echo ' make [DEBUG=false]'
|
@echo ' make [DEBUG=false]'
|
||||||
@echo
|
@echo
|
||||||
@echo 'to compile with development tools, run:'
|
|
||||||
@echo ' make all [DEBUG=false]'
|
|
||||||
@echo
|
|
||||||
@echo 'to check unit tests (requires NUnit version >= 2.6), run:'
|
@echo 'to check unit tests (requires NUnit version >= 2.6), run:'
|
||||||
@echo ' make nunit [NUNIT_CONSOLE=<path-to/nunit[3|2]-console>] [NUNIT_LIBS_PATH=<path-to-libs-dir>] [NUNIT_LIBS=<nunit-libs>]'
|
@echo ' make nunit [NUNIT_CONSOLE=<path-to/nunit[3|2]-console>] [NUNIT_LIBS_PATH=<path-to-libs-dir>] [NUNIT_LIBS=<nunit-libs>]'
|
||||||
@echo ' Use NUNIT_CONSOLE if nunit[3|2]-console was not downloaded by `make dependencies` nor is it in bin search paths'
|
@echo ' Use NUNIT_CONSOLE if nunit[3|2]-console was not downloaded by `make dependencies` nor is it in bin search paths'
|
||||||
@@ -494,9 +461,6 @@ help:
|
|||||||
@echo 'to install, run:'
|
@echo 'to install, run:'
|
||||||
@echo ' make [prefix=/foo] [bindir=/bar/bin] install'
|
@echo ' make [prefix=/foo] [bindir=/bar/bin] install'
|
||||||
@echo
|
@echo
|
||||||
@echo 'to install with development tools, run:'
|
|
||||||
@echo ' make [prefix=/foo] [bindir=/bar/bin] install-all'
|
|
||||||
@echo
|
|
||||||
@echo 'to install Linux startup scripts, desktop files and icons'
|
@echo 'to install Linux startup scripts, desktop files and icons'
|
||||||
@echo ' make install-linux-shortcuts [DEBUG=false]'
|
@echo ' make install-linux-shortcuts [DEBUG=false]'
|
||||||
@echo
|
@echo
|
||||||
@@ -515,4 +479,4 @@ help:
|
|||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
.PHONY: core tools package all mods clean distclean dependencies version $(PROGRAMS) nunit
|
.PHONY: core package all mods clean distclean dependencies version $(PROGRAMS) nunit
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
</UpgradeBackupLocation>
|
</UpgradeBackupLocation>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<ApplicationIcon>OpenRA.ico</ApplicationIcon>
|
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Disk</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
@@ -352,8 +351,5 @@
|
|||||||
<Install>false</Install>
|
<Install>false</Install>
|
||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="OpenRA.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 264 KiB |
@@ -1,155 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2017 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.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Media;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace OpenRA
|
|
||||||
{
|
|
||||||
class GameMonitor
|
|
||||||
{
|
|
||||||
static Process gameProcess;
|
|
||||||
|
|
||||||
[STAThread]
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
var launcherPath = Assembly.GetExecutingAssembly().Location;
|
|
||||||
var directory = Path.GetDirectoryName(launcherPath);
|
|
||||||
var enginePath = Path.Combine(directory, "OpenRA.Game.exe");
|
|
||||||
|
|
||||||
Directory.SetCurrentDirectory(directory);
|
|
||||||
|
|
||||||
var engineArgs = args
|
|
||||||
.Append("Engine.LaunchPath=" + launcherPath)
|
|
||||||
.Select(arg => "\"" + arg + "\"");
|
|
||||||
|
|
||||||
var psi = new ProcessStartInfo(enginePath, string.Join(" ", engineArgs));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
gameProcess = Process.Start(psi);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gameProcess == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gameProcess.EnableRaisingEvents = true;
|
|
||||||
gameProcess.Exited += GameProcessExited;
|
|
||||||
|
|
||||||
Application.Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ShowErrorDialog()
|
|
||||||
{
|
|
||||||
var form = new Form
|
|
||||||
{
|
|
||||||
Size = new Size(315, 140),
|
|
||||||
Text = "Fatal Error",
|
|
||||||
MinimizeBox = false,
|
|
||||||
MaximizeBox = false,
|
|
||||||
FormBorderStyle = FormBorderStyle.FixedDialog,
|
|
||||||
StartPosition = FormStartPosition.CenterScreen,
|
|
||||||
TopLevel = true,
|
|
||||||
Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
|
|
||||||
};
|
|
||||||
|
|
||||||
var notice = new Label
|
|
||||||
{
|
|
||||||
Location = new Point(10, 10),
|
|
||||||
AutoSize = true,
|
|
||||||
Text = "OpenRA has encountered a fatal error and must close.{0}Refer to the crash logs and FAQ for more information.".F(Environment.NewLine),
|
|
||||||
TextAlign = ContentAlignment.TopCenter
|
|
||||||
};
|
|
||||||
|
|
||||||
var viewLogs = new Button
|
|
||||||
{
|
|
||||||
Location = new Point(10, 80),
|
|
||||||
Size = new Size(75, 23),
|
|
||||||
Text = "View Logs"
|
|
||||||
};
|
|
||||||
|
|
||||||
var viewFaq = new Button
|
|
||||||
{
|
|
||||||
Location = new Point(90, 80),
|
|
||||||
Size = new Size(75, 23),
|
|
||||||
Text = "View FAQ"
|
|
||||||
};
|
|
||||||
|
|
||||||
var quit = new Button
|
|
||||||
{
|
|
||||||
Location = new Point(225, 80),
|
|
||||||
Size = new Size(75, 23),
|
|
||||||
Text = "Quit",
|
|
||||||
DialogResult = DialogResult.Cancel
|
|
||||||
};
|
|
||||||
|
|
||||||
form.Controls.Add(notice);
|
|
||||||
form.Controls.Add(viewLogs);
|
|
||||||
form.Controls.Add(viewFaq);
|
|
||||||
form.Controls.Add(quit);
|
|
||||||
|
|
||||||
viewLogs.Click += ViewLogsClicked;
|
|
||||||
viewFaq.Click += ViewFaqClicked;
|
|
||||||
form.FormClosed += FormClosed;
|
|
||||||
|
|
||||||
SystemSounds.Exclamation.Play();
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GameProcessExited(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (gameProcess.ExitCode != (int)RunStatus.Success)
|
|
||||||
ShowErrorDialog();
|
|
||||||
|
|
||||||
Exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ViewLogsClicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Process.Start(Platform.ResolvePath("^", "Logs"));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ViewFaqClicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Process.Start("http://wiki.openra.net/FAQ");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void FormClosed(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Exit()
|
|
||||||
{
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProjectGuid>{68295755-7902-4602-AC2C-9A8AC36D5EF7}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<RootNamespace>OpenRA</RootNamespace>
|
|
||||||
<AssemblyName>OpenRA</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<OutputPath>..\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>..\OpenRA.Game\OpenRA.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<OutputPath>..\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
|
||||||
<Project>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</Project>
|
|
||||||
<Name>OpenRA.Game</Name>
|
|
||||||
<Private>False</Private>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="GameMonitor.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
|
||||||
@@ -131,8 +131,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "System Lua scripts", "Syste
|
|||||||
lua\stacktraceplus.lua = lua\stacktraceplus.lua
|
lua\stacktraceplus.lua = lua\stacktraceplus.lua
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.GameMonitor", "OpenRA.GameMonitor\OpenRA.GameMonitor.csproj", "{68295755-7902-4602-AC2C-9A8AC36D5EF7}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Test", "OpenRA.Test\OpenRA.Test.csproj", "{6CB8E1B7-6B36-4D93-8633-7C573E194AC4}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Test", "OpenRA.Test\OpenRA.Test.csproj", "{6CB8E1B7-6B36-4D93-8633-7C573E194AC4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tiberian Sun Lua scripts", "Tiberian Sun Lua scripts", "{85159569-F5BD-458E-B5C0-EB16690C432B}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tiberian Sun Lua scripts", "Tiberian Sun Lua scripts", "{85159569-F5BD-458E-B5C0-EB16690C432B}"
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ after_test:
|
|||||||
- appveyor DownloadFile "https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md" -FileName Changelog.md
|
- appveyor DownloadFile "https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md" -FileName Changelog.md
|
||||||
- make docs
|
- make docs
|
||||||
- ps: dir *.md | % {gc $_ -Raw | .\ConvertFrom-Markdown.ps1 | Out-File -FilePath "$($_.Name.TrimEnd(".md")).html"}
|
- ps: dir *.md | % {gc $_ -Raw | .\ConvertFrom-Markdown.ps1 | Out-File -FilePath "$($_.Name.TrimEnd(".md")).html"}
|
||||||
- ps: cp OpenRA.Game/OpenRA.ico .
|
- ps: (Get-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs.in").replace('DISPLAY_NAME', 'OpenRA').replace('MOD_ID', '').replace('FAQ_URL', 'http://wiki.openra.net/FAQ') | Set-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs"
|
||||||
|
- ps: csc.exe /noconfig /platform:x86 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.exe" /out:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\OpenRA.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs
|
||||||
|
- ps: cp packaging\windows\OpenRA.ico .
|
||||||
- '"C:\Program Files (x86)\NSIS\makensis.exe" /DSRCDIR="%APPVEYOR_BUILD_FOLDER%" /DDEPSDIR="%APPVEYOR_BUILD_FOLDER%\thirdparty\download\windows" /V3 packaging/windows/OpenRA.nsi'
|
- '"C:\Program Files (x86)\NSIS\makensis.exe" /DSRCDIR="%APPVEYOR_BUILD_FOLDER%" /DDEPSDIR="%APPVEYOR_BUILD_FOLDER%\thirdparty\download\windows" /V3 packaging/windows/OpenRA.nsi'
|
||||||
- if defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_TAG_NAME%
|
- if defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_TAG_NAME%
|
||||||
- if not defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_COMMIT:~0,7%
|
- if not defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_COMMIT:~0,7%
|
||||||
|
|||||||
@@ -70,10 +70,7 @@ cp thirdparty/download/MaxMind.Db.dll packaging/built
|
|||||||
cp thirdparty/download/SmarIrc4net.dll packaging/built
|
cp thirdparty/download/SmarIrc4net.dll packaging/built
|
||||||
|
|
||||||
# Copy game icon for windows package
|
# Copy game icon for windows package
|
||||||
cp OpenRA.Game/OpenRA.ico packaging/built
|
cp packaging/windows/OpenRA.ico packaging/built
|
||||||
|
|
||||||
# Copy the Windows crash monitor
|
|
||||||
cp OpenRA.exe packaging/built
|
|
||||||
|
|
||||||
cd packaging
|
cd packaging
|
||||||
echo "Creating packages..."
|
echo "Creating packages..."
|
||||||
|
|||||||
BIN
packaging/windows/OpenRA.ico
Normal file
BIN
packaging/windows/OpenRA.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
232
packaging/windows/WindowsLauncher.cs.in
Normal file
232
packaging/windows/WindowsLauncher.cs.in
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2017 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.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Media;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace OpenRA
|
||||||
|
{
|
||||||
|
class WindowsLauncher
|
||||||
|
{
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern int SendMessage(IntPtr hwnd, uint message, uint wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport("shell32.dll")]
|
||||||
|
static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public extern static bool DestroyIcon(IntPtr handle);
|
||||||
|
|
||||||
|
struct SHFILEINFO
|
||||||
|
{
|
||||||
|
// Native type: HICON
|
||||||
|
public IntPtr hIcon;
|
||||||
|
|
||||||
|
public int iIcon;
|
||||||
|
public uint dwAttributes;
|
||||||
|
|
||||||
|
// Native type: TCHAR[MAX_PATH]
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
|
||||||
|
|
||||||
|
public string szDisplayName;
|
||||||
|
|
||||||
|
// Native type: TCHAR[80]
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
|
||||||
|
|
||||||
|
public string szTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Process gameProcess;
|
||||||
|
|
||||||
|
// Constants to be replaced by the wrapper / compilation script
|
||||||
|
const string ModID = "MOD_ID";
|
||||||
|
const string DisplayName = "DISPLAY_NAME";
|
||||||
|
const string FaqUrl = "FAQ_URL";
|
||||||
|
|
||||||
|
// References to the OpenRA.Game.exe icons for later cleanup
|
||||||
|
static IntPtr[] iconHandle = { IntPtr.Zero, IntPtr.Zero };
|
||||||
|
|
||||||
|
[STAThread]
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var launcherPath = Assembly.GetExecutingAssembly().Location;
|
||||||
|
var directory = Path.GetDirectoryName(launcherPath);
|
||||||
|
var enginePath = Path.Combine(directory, "OpenRA.Game.exe");
|
||||||
|
|
||||||
|
Directory.SetCurrentDirectory(directory);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(ModID))
|
||||||
|
args = args.Append("Game.Mod=" + ModID).ToArray();
|
||||||
|
|
||||||
|
var engineArgs = args
|
||||||
|
.Append("Engine.LaunchPath=" + launcherPath)
|
||||||
|
.Select(arg => "\"" + arg + "\"");
|
||||||
|
|
||||||
|
var psi = new ProcessStartInfo(enginePath, string.Join(" ", engineArgs));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
gameProcess = Process.Start(psi);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameProcess == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Platform.CurrentPlatform == PlatformType.Windows)
|
||||||
|
{
|
||||||
|
// Set the OpenRA.Game.exe icon to match the mod
|
||||||
|
// Icon.ExtractAssociatedIcon sets only the 32px icon,
|
||||||
|
// so we use native functions to set both 16 and 32px versions.
|
||||||
|
gameProcess.WaitForInputIdle();
|
||||||
|
SHFILEINFO sfi = new SHFILEINFO();
|
||||||
|
for (var i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
SHGetFileInfo(Assembly.GetExecutingAssembly().Location, 0, ref sfi, (uint)Marshal.SizeOf(sfi), (uint)(0x100 + i));
|
||||||
|
iconHandle[i] = sfi.hIcon;
|
||||||
|
SendMessage(gameProcess.MainWindowHandle, 0x80, (uint)(1 - i), sfi.hIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gameProcess.EnableRaisingEvents = true;
|
||||||
|
gameProcess.Exited += GameProcessExited;
|
||||||
|
|
||||||
|
Application.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ShowErrorDialog()
|
||||||
|
{
|
||||||
|
var headerLabel = new Label
|
||||||
|
{
|
||||||
|
Location = new Point(0, 10),
|
||||||
|
Height = 15,
|
||||||
|
Text = DisplayName + " has encountered a fatal error and must close.",
|
||||||
|
TextAlign = ContentAlignment.TopCenter
|
||||||
|
};
|
||||||
|
|
||||||
|
var docsLabel = new Label
|
||||||
|
{
|
||||||
|
Location = new Point(0, 25),
|
||||||
|
Height = 15,
|
||||||
|
Text = "Refer to the crash logs and FAQ for more information.",
|
||||||
|
TextAlign = ContentAlignment.TopCenter
|
||||||
|
};
|
||||||
|
|
||||||
|
int formWidth;
|
||||||
|
using (var g = headerLabel.CreateGraphics())
|
||||||
|
{
|
||||||
|
var headerWidth = (int)g.MeasureString(headerLabel.Text, headerLabel.Font).Width + 60;
|
||||||
|
var docsWidth = (int)g.MeasureString(docsLabel.Text, docsLabel.Font).Width + 60;
|
||||||
|
formWidth = Math.Max(headerWidth, docsWidth);
|
||||||
|
headerLabel.Width = formWidth;
|
||||||
|
docsLabel.Width = formWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
var form = new Form
|
||||||
|
{
|
||||||
|
Size = new Size(formWidth, 110),
|
||||||
|
Text = "Fatal Error",
|
||||||
|
MinimizeBox = false,
|
||||||
|
MaximizeBox = false,
|
||||||
|
FormBorderStyle = FormBorderStyle.FixedDialog,
|
||||||
|
StartPosition = FormStartPosition.CenterScreen,
|
||||||
|
TopLevel = true,
|
||||||
|
Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
|
||||||
|
};
|
||||||
|
|
||||||
|
var viewLogs = new Button
|
||||||
|
{
|
||||||
|
Location = new Point(10, 50),
|
||||||
|
Size = new Size(75, 23),
|
||||||
|
Text = "View Logs"
|
||||||
|
};
|
||||||
|
|
||||||
|
var viewFaq = new Button
|
||||||
|
{
|
||||||
|
Location = new Point(90, 50),
|
||||||
|
Size = new Size(75, 23),
|
||||||
|
Text = "View FAQ"
|
||||||
|
};
|
||||||
|
|
||||||
|
var quit = new Button
|
||||||
|
{
|
||||||
|
Location = new Point(formWidth - 90, 50),
|
||||||
|
Size = new Size(75, 23),
|
||||||
|
Text = "Quit",
|
||||||
|
DialogResult = DialogResult.Cancel
|
||||||
|
};
|
||||||
|
|
||||||
|
form.Controls.Add(headerLabel);
|
||||||
|
form.Controls.Add(docsLabel);
|
||||||
|
form.Controls.Add(viewLogs);
|
||||||
|
form.Controls.Add(viewFaq);
|
||||||
|
form.Controls.Add(quit);
|
||||||
|
|
||||||
|
viewLogs.Click += ViewLogsClicked;
|
||||||
|
viewFaq.Click += ViewFaqClicked;
|
||||||
|
form.FormClosed += FormClosed;
|
||||||
|
|
||||||
|
SystemSounds.Exclamation.Play();
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GameProcessExited(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (gameProcess.ExitCode != (int)RunStatus.Success)
|
||||||
|
ShowErrorDialog();
|
||||||
|
|
||||||
|
if (Platform.CurrentPlatform == PlatformType.Windows)
|
||||||
|
foreach (var handle in iconHandle)
|
||||||
|
if (handle != IntPtr.Zero)
|
||||||
|
DestroyIcon(handle);
|
||||||
|
|
||||||
|
Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ViewLogsClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(Platform.ResolvePath("^", "Logs"));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ViewFaqClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(FaqUrl);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FormClosed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Exit()
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,20 @@ BUILTDIR="$2"
|
|||||||
SRCDIR="$3"
|
SRCDIR="$3"
|
||||||
OUTPUTDIR="$4"
|
OUTPUTDIR="$4"
|
||||||
|
|
||||||
|
LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe"
|
||||||
|
FAQ_URL="http://wiki.openra.net/FAQ"
|
||||||
|
|
||||||
|
function makelauncher()
|
||||||
|
{
|
||||||
|
sed "s|DISPLAY_NAME|$2|" WindowsLauncher.cs.in | sed "s|MOD_ID|$3|" | sed "s|FAQ_URL|${FAQ_URL}|" > WindowsLauncher.cs
|
||||||
|
mcs -sdk:4.5 WindowsLauncher.cs -warn:4 -codepage:utf8 -warnaserror -out:"$1" -t:winexe ${LAUNCHER_LIBS} -win32icon:"$4"
|
||||||
|
rm WindowsLauncher.cs
|
||||||
|
mono ${SRCDIR}/fixheader.exe $1 > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Compiling Windows launcher"
|
||||||
|
makelauncher ${BUILTDIR}/OpenRA.exe "OpenRA" "" OpenRA.ico
|
||||||
|
|
||||||
if [ -x /usr/bin/makensis ]; then
|
if [ -x /usr/bin/makensis ]; then
|
||||||
echo "Building Windows setup.exe"
|
echo "Building Windows setup.exe"
|
||||||
makensis -V2 -DSRCDIR="$BUILTDIR" -DDEPSDIR="${SRCDIR}/thirdparty/download/windows" OpenRA.nsi
|
makensis -V2 -DSRCDIR="$BUILTDIR" -DDEPSDIR="${SRCDIR}/thirdparty/download/windows" OpenRA.nsi
|
||||||
|
|||||||
Reference in New Issue
Block a user