Faction Test 100.4.0.0

This commit is contained in:
Markus Isberg
2022-11-14 18:28:28 +02:00
parent 87426b68b2
commit c772b61fc1
412 changed files with 16984 additions and 5530 deletions
@@ -112,10 +112,23 @@ namespace Barotrauma
}
StringBuilder sb = new StringBuilder();
sb.AppendLine("Barotrauma Client crash report (generated on " + DateTime.Now + ")");
sb.AppendLine("\n");
sb.AppendLine();
sb.AppendLine("Barotrauma seems to have crashed. Sorry for the inconvenience! ");
sb.AppendLine("\n");
sb.AppendLine();
string dxgiErrorHelpText =
#if WINDOWS
GetDXGIErrorHelpText(game, exception);
#else
string.Empty;
#endif
if (!string.IsNullOrEmpty(dxgiErrorHelpText))
{
sb.AppendLine(dxgiErrorHelpText);
sb.AppendLine();
}
try
{
@@ -135,7 +148,7 @@ namespace Barotrauma
XDocument newDoc = new XDocument(newElement);
newDoc.Save(GameSettings.PlayerConfigPath);
sb.AppendLine("To prevent further startup errors, installed mods will be disabled the next time you launch the game.");
sb.AppendLine("\n");
sb.AppendLine();
}
}
}
@@ -148,7 +161,7 @@ namespace Barotrauma
{
sb.AppendLine(exeHash.StringRepresentation);
}
sb.AppendLine("\n");
sb.AppendLine();
sb.AppendLine("Game version " + GameMain.Version +
" (" + AssemblyInfo.BuildString + ", branch " + AssemblyInfo.GitBranch + ", revision " + AssemblyInfo.GitRevision + ")");
sb.AppendLine($"Graphics mode: {GameSettings.CurrentConfig.Graphics.Width}x{GameSettings.CurrentConfig.Graphics.Height} ({GameSettings.CurrentConfig.Graphics.DisplayMode})");
@@ -171,7 +184,7 @@ namespace Barotrauma
sb.AppendLine("Client (" + (GameMain.Client.GameStarted ? "Round had started)" : "Round hadn't been started)"));
}
sb.AppendLine("\n");
sb.AppendLine();
sb.AppendLine("System info:");
sb.AppendLine(" Operating system: " + System.Environment.OSVersion + (System.Environment.Is64BitOperatingSystem ? " 64 bit" : " x86"));
@@ -201,13 +214,14 @@ namespace Barotrauma
}
}
sb.AppendLine("\n");
sb.AppendLine("Exception: " + exception.Message + " (" + exception.GetType().ToString() + ")");
sb.AppendLine();
sb.AppendLine($"Exception: {exception.Message} ({exception.GetType()})");
#if WINDOWS
if (exception is SharpDXException sharpDxException && ((uint)sharpDxException.HResult) == 0x887A0005)
{
var dxDevice = (SharpDX.Direct3D11.Device)game.GraphicsDevice.Handle;
sb.AppendLine("Device removed reason: " + dxDevice.DeviceRemovedReason.ToString());
var descriptor = ResultDescriptor.Find(dxDevice.DeviceRemovedReason)?.ApiCode ?? "UNKNOWN";
sb.AppendLine($"Device removed reason: {descriptor} ({dxDevice.DeviceRemovedReason})");
}
#endif
if (exception.TargetSite != null)
@@ -219,7 +233,7 @@ namespace Barotrauma
{
sb.AppendLine("Stack trace: ");
sb.AppendLine(exception.StackTrace.CleanupStackTrace());
sb.AppendLine("\n");
sb.AppendLine();
}
if (exception.InnerException != null)
@@ -260,18 +274,43 @@ namespace Barotrauma
if (GameSettings.CurrentConfig.SaveDebugConsoleLogs
|| GameSettings.CurrentConfig.VerboseLogging) { DebugConsole.SaveLogs(); }
string msg = string.Empty;
if (GameAnalyticsManager.SendUserStatistics)
{
CrashMessageBox("A crash report (\"" + filePath + "\") was saved in the root folder of the game and sent to the developers.", filePath);
msg = "A crash report (\"" + filePath + "\") was saved in the root folder of the game and sent to the developers.";
}
else
{
CrashMessageBox("A crash report (\"" + filePath + "\") was saved in the root folder of the game. The error was not sent to the developers because user statistics have been disabled, but" +
" if you'd like to help fix this bug, you may post it on Barotrauma's GitHub issue tracker: https://github.com/Regalis11/Barotrauma/issues/", filePath);
msg = "A crash report (\"" + filePath + "\") was saved in the root folder of the game. The error was not sent to the developers because user statistics have been disabled, but" +
" if you'd like to help fix this bug, you may post it on Barotrauma's GitHub issue tracker: https://github.com/Regalis11/Barotrauma/issues/";
}
if (string.IsNullOrEmpty(dxgiErrorHelpText))
{
msg += "\n\n" + dxgiErrorHelpText;
}
CrashMessageBox(msg, filePath);
}
#if WINDOWS
private static string GetDXGIErrorHelpText(GameMain game, Exception exception)
{
string text = string.Empty;
if (exception is SharpDXException sharpDxException && ((uint)sharpDxException.HResult) == 0x887A0005)
{
var dxDevice = (SharpDX.Direct3D11.Device)game.GraphicsDevice.Handle;
var descriptor = ResultDescriptor.Find(dxDevice.DeviceRemovedReason)?.ApiCode ?? "UNKNOWN";
text +=
$"The crash was caused by the DirectX error {descriptor} ({dxDevice.DeviceRemovedReason}). " +
"This is a common DirectX error that can be related to various different issues, such as outdated drivers, RAM problems or an overclocked or otherwise overstressed GPU. " +
"There are several potential ways to fix the issue: ensuring your graphics drivers and DirectX installation are up-to-date, disabling overclocking and adjusting various GPU-specific settings. " +
$"You may also be able to find potential solutions to the problem by using the error code {descriptor} ({dxDevice.DeviceRemovedReason}) and your GPU manufacturer as search terms.";
}
return text;
}
#endif
private static IntPtr nvApi64Dll = IntPtr.Zero;
private static void EnableNvOptimus()
{
@@ -287,11 +326,11 @@ namespace Barotrauma
private static void FreeNvOptimus()
{
#warning TODO: determine if we can do this safely
#warning TODO: determine if we can do this safely
//NativeLibrary.Free(nvApi64Dll);
}
}
#endif
}