Files
UnrealEngineUWP/Engine/Source/Runtime/Linux/LinuxCommonStartup/Private/LinuxCommonStartup.cpp
Matthew Griffin 6c75b4032c Merging //UE4/Release-4.11 to //UE4/Main (up to CL#2835147)
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2817214 on 2016/01/06 by mason.seay
	Adjusted Walkable Slope Override for mesh

	#jira UE-24473

Change 2817384 on 2016/01/06 by Michael.Schoell
	Crash fix when selecting a variable node for a variable that is not owned by a Blueprint.

	#jira UE-24958 - Crash when getting the sequence player in level blueprint

Change 2817438 on 2016/01/06 by Max.Chen

	Sequencer: Add option to specify position of material name from the movie scene capture interface. For example, MovieCapture_{material}_{width}x{height}.{frame} will create files like this: MovieCapture_FinalImage_1920x1080.0010.exr

	#rb Andrew.Rodham
	#jira UE-24926

Change 2817459 on 2016/01/06 by Marc.Audy

	 PR #1679: Move MinRespawnDelay to virtual method AController::GetMinRespawnDelay() (Contributed by bozaro)
	#jira UE-22309

Change 2817472 on 2016/01/06 by Ben.Marsh

	Always run UHT in unattended mode from UBT; we don't want it opening any dialogs. Match3 is currently missing a plugin, and it's causing builds to time out.

Change 2817473 on 2016/01/06 by Marc.Audy

	 PR #1644: Improve "SpawnActor failed because the spawned actor IsPendingKill" error message (Contributed by slonopotamus)
	#jira UE-21911

Change 2817533 on 2016/01/06 by Lauren.Ridge

	Fixing Match3 not compiling in Debug (removed two checks on TileLibrary)

	#jira UE-25004

Change 2817625 on 2016/01/06 by Taizyd.Korambayil

	#jira UE-19659 Reimported Template Animations with Proper Skeletons

Change 2817647 on 2016/01/06 by Lukasz.Furman

	replaced ensure during initialization of blackboard based behavior tree task with log warning
	#ue4
	#jira UE-24448
	#rb Mieszko.Zielinski

Change 2817648 on 2016/01/06 by Lukasz.Furman

	fixed broken rendering component of navmesh actor after delete-undo operation
	#ue4
	#jira UE-24446
	#rb Mieszko.Zielinski

Change 2817688 on 2016/01/06 by Taizyd.Korambayil

	#jira UE-22347 Fixed Message Warnings on Startup

Change 2817815 on 2016/01/06 by Jamie.Dale

	Multiple fixes when editing right-to-left text

	- Text is now shaped over the entire line to allow rich-text and selected text to be shaped correctly across block boundaries.
	- Text layout highlights are now able to correctly handle bi-directional and right-to-left text.
	- Text picking can now handle bi-directional and right-to-left text.
	- Text picking can now pick the individual characters that make up a ligature glyph.
	- The caret now draws on the logical (rather than visual) side of the glyph (to handle right-to-left text).
	- Glyph clusters (multiple glyphs produced from a single character) are now treated as a single logical glyph.
	- Optimized some of the FShapedGlyphSequence to allow an early out once they've found and processed the start and end glyphs.

	#jira UE-25013

Change 2817828 on 2016/01/06 by Nick.Darnell

	Editor - Fixing the OpenLauncher call to be take a structure to allow us to customize it more, and to properly handle the silent command the way we're planning to handle it in the launcher.

	#jira UE-24563

Change 2818052 on 2016/01/06 by Nick.Darnell

	Editor - Adding another application check for the launcher to catch the current app name on mac.

	#jira UE-24563

Change 2818149 on 2016/01/06 by Taizyd.Korambayil

	#jira UE-19097 Adjusted FirstPerson Pawn, so that Camera doesnt clip the Arm Mesh

Change 2818360 on 2016/01/06 by Chris.Babcock

	Fix reading from ini sections not cached after build system changes for 4.11
	#jira UE-25027
	#ue4
	#android

Change 2818369 on 2016/01/06 by Ryan.Vance

	#jira UE-24976
	Adding tessellation support to instanced stereo

Change 2818999 on 2016/01/07 by Robert.Manuszewski

	UHT will no longer try to load game-only plugins.

	#jira UE-25032

	- Changed module type RuntimeNoProgram to RuntimeAndProgram so that bu default Runtime plugin modules won't be loaded by programs
	- Added better error message when UHT's PreInit fails

Change 2819064 on 2016/01/07 by Richard.Hinckley

	#jira UE-24694
	Fixing array usage in 4.11 stream.

Change 2819067 on 2016/01/07 by Ori.Cohen

	When editor tries to spawn a physics asset we automatically load the needed skeletal mesh

	#rb Matt.K
	#JIRA UE-24165
2016-01-22 08:13:18 -05:00

249 lines
6.9 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "LinuxCommonStartup.h"
#include "ExceptionHandling.h"
#include "LinuxPlatformCrashContext.h"
#include "ModuleManager.h"
#include "EngineVersion.h"
#include <locale.h>
#include <sys/resource.h>
static FString GSavedCommandLine;
extern int32 GuardedMain( const TCHAR* CmdLine );
extern void LaunchStaticShutdownAfterError();
// FIXME: handle expose it someplace else?
extern int32 DLLIMPORT ReportCrash(const FLinuxCrashContext& Context);
extern void DLLIMPORT GenerateCrashInfoAndLaunchReporter(const FLinuxCrashContext& Context);
/**
* Game-specific crash reporter
*/
void CommonLinuxCrashHandler(const FGenericCrashContext& GenericContext)
{
// at this point we should already be using malloc crash handler (see PlatformCrashHandler)
const FLinuxCrashContext& Context = static_cast< const FLinuxCrashContext& >( GenericContext );
printf("CommonLinuxCrashHandler: Signal=%d\n", Context.Signal);
ReportCrash(Context);
if (GLog)
{
GLog->Flush();
}
if (GWarn)
{
GWarn->Flush();
}
if (GError)
{
GError->Flush();
GError->HandleError();
}
return GenerateCrashInfoAndLaunchReporter(Context);
}
/**
* Sets (soft) limit on a specific resource
*
* @param Resource - one of RLIMIT_* values
* @param DesiredLimit - desired value
* @param bIncreaseOnly - avoid changing the limit if current value is sufficient
*/
bool SetResourceLimit(int Resource, rlim_t DesiredLimit, bool bIncreaseOnly)
{
rlimit Limit;
if (getrlimit(Resource, &Limit) != 0)
{
fprintf(stderr, "getrlimit() failed with error %d (%s)\n", errno, strerror(errno));
return false;
}
if (bIncreaseOnly && (Limit.rlim_cur == RLIM_INFINITY || Limit.rlim_cur >= DesiredLimit))
{
if (!UE_BUILD_SHIPPING)
{
printf("- Existing per-process limit (soft=%lu, hard=%lu) is enough for us (need only %lu)\n", Limit.rlim_cur, Limit.rlim_max, DesiredLimit);
}
return true;
}
Limit.rlim_cur = DesiredLimit;
if (setrlimit(Resource, &Limit) != 0)
{
fprintf(stderr, "setrlimit() failed with error %d (%s)\n", errno, strerror(errno));
if (errno == EINVAL)
{
if (DesiredLimit == RLIM_INFINITY)
{
fprintf(stderr, "- Max per-process value allowed is %lu (we wanted infinity).\n", Limit.rlim_max);
}
else
{
fprintf(stderr, "- Max per-process value allowed is %lu (we wanted %lu).\n", Limit.rlim_max, DesiredLimit);
}
}
return false;
}
return true;
}
/**
* Expects GSavedCommandLine to be set up. Increases limit on
* - number of open files to be no less than desired (if specified on command line, otherwise left alone)
* - size of core file, so core gets dumped and we can debug crashed builds (unless overridden with -nocore)
*
*/
static bool IncreasePerProcessLimits()
{
// honor the parameter if given, but don't change limits if not
int32 FileHandlesToReserve = -1;
if (FParse::Value(*GSavedCommandLine, TEXT("numopenfiles="), FileHandlesToReserve) && FileHandlesToReserve > 0)
{
if (!UE_BUILD_SHIPPING)
{
printf("Increasing per-process limit of open file handles to %d\n", FileHandlesToReserve);
}
if (!SetResourceLimit(RLIMIT_NOFILE, FileHandlesToReserve, true))
{
fprintf(stderr, "Could not adjust number of file handles, consider changing \"nofile\" in /etc/security/limits.conf and relogin.\nerror(%d): %s\n", errno, strerror(errno));
return false;
}
}
// core dump policy:
// - Shipping and Test disable by default (unless -core is passed)
// - The rest set it to infinity unless -nocore is passed
// (in all scenarios user wish as expressed with -core or -nocore takes priority)
bool bDisableCore = (UE_BUILD_SHIPPING != 0 || UE_BUILD_TEST != 0);
if (FParse::Param(*GSavedCommandLine, TEXT("nocore")))
{
bDisableCore = true;
}
if (FParse::Param(*GSavedCommandLine, TEXT("core")))
{
bDisableCore = false;
}
if (bDisableCore)
{
printf("Disabling core dumps.\n");
if (!SetResourceLimit(RLIMIT_CORE, 0, false))
{
fprintf(stderr, "Could not set core file size to 0, error(%d): %s\n", errno, strerror(errno));
return false;
}
}
else
{
printf("Increasing per-process limit of core file size to infinity.\n");
if (!SetResourceLimit(RLIMIT_CORE, RLIM_INFINITY, true))
{
fprintf(stderr, "Could not adjust core file size, consider changing \"core\" in /etc/security/limits.conf and relogin.\nerror(%d): %s\n", errno, strerror(errno));
fprintf(stderr, "Alternatively, pass -nocore if you are unable or unwilling to do that.\n");
return false;
}
}
return true;
}
int CommonLinuxMain(int argc, char *argv[], int (*RealMain)(const TCHAR * CommandLine))
{
FPlatformMisc::SetGracefulTerminationHandler();
if (UE_BUILD_SHIPPING)
{
// only printed in shipping
printf("%s %d %d %d %d\n", StringCast<ANSICHAR>(*FEngineVersion::Current().ToString()).Get(), GEngineMinNetVersion, GEngineNegotiationVersion, GPackageFileUE4Version, GPackageFileLicenseeUE4Version);
}
int ErrorLevel = 0;
if (setenv("LC_NUMERIC", "en_US", 1) != 0)
{
int ErrNo = errno;
fprintf(stderr, "Unable to setenv(LC_NUMERIC): errno=%d (%s)", ErrNo, strerror(ErrNo));
}
setlocale(LC_CTYPE, "");
for (int32 Option = 1; Option < argc; Option++)
{
GSavedCommandLine += TEXT(" ");
// we need to quote stuff that has spaces in it because something somewhere is removing quotation marks before they arrive here
FString Temp = UTF8_TO_TCHAR(argv[Option]);
if (Temp.Contains(TEXT(" ")))
{
if(Temp.StartsWith(TEXT("-")))
{
Temp = Temp.Replace(TEXT("="), TEXT("=\""));
}
else
{
Temp = TEXT("\"") + Temp;
}
Temp += TEXT("\"");
}
GSavedCommandLine += Temp; // note: technically it depends on locale
}
if (!UE_BUILD_SHIPPING)
{
GAlwaysReportCrash = true; // set by default and reverse the behavior
if ( FParse::Param( *GSavedCommandLine,TEXT("nocrashreports") ) || FParse::Param( *GSavedCommandLine,TEXT("no-crashreports") ) )
{
GAlwaysReportCrash = false;
}
}
if (!IncreasePerProcessLimits())
{
fprintf(stderr, "Could not set desired per-process limits, consider changing system limits.\n");
ErrorLevel = 1;
}
else
{
#if UE_BUILD_DEBUG
if( true && !GAlwaysReportCrash )
#else
if( FPlatformMisc::IsDebuggerPresent() && !GAlwaysReportCrash )
#endif
{
// Don't use exception handling when a debugger is attached to exactly trap the crash. This does NOT check
// whether we are the first instance or not!
ErrorLevel = RealMain( *GSavedCommandLine );
}
else
{
FPlatformMisc::SetCrashHandler(CommonLinuxCrashHandler);
GIsGuarded = 1;
// Run the guarded code.
ErrorLevel = RealMain( *GSavedCommandLine );
GIsGuarded = 0;
}
}
if (ErrorLevel)
{
printf("Exiting abnormally (error code: %d)\n", ErrorLevel);
}
return ErrorLevel;
}
class FLinuxCommonStartupModule : public IModuleInterface
{
/** IModuleInterface implementation */
virtual void StartupModule() override {};
virtual void ShutdownModule() override {};
};
IMPLEMENT_MODULE(FLinuxCommonStartupModule, LinuxCommonStartup);