mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2024-08-29 21:46:05 +02:00
![Ted John](/assets/img/avatar_default.png)
We get repeated reports of people saying the game is incorrectly reported as a virus. It is becoming more inconvenient for players and even myself, because when we attempt to download a build, it is immediately deleted by scanners (including the default for Windows: Windows Defender). One scanner is not too much of an issue, but the game is flagged by almost half of available scanners as reported by VirusTotal. So why is it being flagged? Windows has a very annoying concept, the subsystem for a binary. The console subsystem allows stdin / stdout as you would expect, just like posix. Unfortunately if a user runs a console subsystem binary from the desktop or explorer, the game will be opened under conhost and thus you get a console showing alongside the game window. This is not a good user experience for most players. To resolve this, you can use the windows subsystem, but this will detach stdin and stdout immediately on launch. There are hacks that can be done in code to allocate a new console but I found this to not work very well with stdin or other terminal emulators. My solution to the problem was to have two binaries: openrct2.exe and openrct2.com. Both are executable but openrct2.exe is windows subsystem, openrct2.com is console subsystem. The desktop shortcut opens openrct2.exe with no console window showing. Typing openrct2 on the command line will execute openrct2.com (as .com has higher PATH precedence than .exe by default) with working stdin and stdout. In order to reduce the size, I have the entire game inside openrct2.dll and then supply two tiny wrapper EXEs that simply route main(...) into the DLL. These wrapper EXEs are the problem, they are very small and do nothing but call into a DLL, this must match virus signatures too closely and their size probably reduces the data available for the scanner to analyse. So as I can not find any other way of achieving my goal of a cli and gui version of OpenRCT2, this changes the build to publish openrct2 as a single executable (rather than a DLL + wrapper EXE), and then duplicate the entire ~10MB exe again and flip the subsystem flag. The installer and zip size won't be affected as this extra size will be completely compressed out, but when unpacked will lead to an extra ~10MB on disc. But I think it is a fair compromise. VirusTotal now reports all artefacts as safe, for now anyway.
24 lines
626 B
Bash
Executable file
24 lines
626 B
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
# Create a Windows symbols archive for OpenRCT2
|
|
basedir="$(readlink -f `dirname $0`/..)"
|
|
cd $basedir/bin
|
|
|
|
destination=../artifacts/openrct2-symbols-$CONFIGURATION-$PLATFORM.zip
|
|
|
|
# Check 7z is available
|
|
if ! [ -x "$(command -v 7z)" ]; then
|
|
echo -e >&2 "\033[0;7z not found\033[0m"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "\033[0;36mCreating symbols archive for OpenRCT2...\033[0m"
|
|
if [[ -f $destination ]]; then
|
|
rm $destination
|
|
fi
|
|
7z a $destination openrct2.exe openrct2.com openrct2-win.pdb
|
|
|
|
destination=$(cygpath -w $(readlink -f $destination))
|
|
printf '\033[0;32m%s\033[0m\n' "${destination} created successfully"
|