2f107db...5202af9

This commit is contained in:
Joonas Rikkonen
2019-03-18 21:42:26 +02:00
parent 58c92888b7
commit 044fd3344b
395 changed files with 27417 additions and 19754 deletions
+17 -13
View File
@@ -30,10 +30,13 @@ namespace Barotrauma
static void Main()
{
GameMain game = null;
#if !DEBUG
try
{
#endif
game = new GameMain();
game.GraphicsDevice.PresentationParameters.IsFullScreen = false;
//game.GraphicsDevice.PresentationParameters.IsFullScreen = false;
#if !DEBUG
}
catch (Exception e)
{
@@ -41,7 +44,8 @@ namespace Barotrauma
CrashDump(null, "crashreport.log", e);
return;
}
#endif
#if DEBUG
game.Run();
#else
@@ -55,7 +59,7 @@ namespace Barotrauma
attemptRestart = false;
}
catch (Exception e)
{
{
if (restartAttempts < 5 && CheckException(game, e))
{
attemptRestart = true;
@@ -71,14 +75,18 @@ namespace Barotrauma
} while (attemptRestart);
#endif
#if !DEBUG
try
{
#endif
game.Dispose();
#if !DEBUG
}
catch (Exception e)
{
CrashDump(null, "crashreport.log", e);
}
#endif
}
private static bool CheckException(GameMain game, Exception e)
@@ -112,13 +120,13 @@ namespace Barotrauma
{
DebugConsole.NewMessage("Failed to set fullscreen mode, switching configuration to borderless windowed.", Microsoft.Xna.Framework.Color.Red);
GameMain.Config.WindowMode = WindowMode.BorderlessWindowed;
GameMain.Config.Save();
GameMain.Config.SaveNewPlayerConfig();
}
return false;
default:
DebugConsole.NewMessage("Failed to resolve the DXGI_ERROR_NOT_CURRENTLY_AVAILABLE exception. Give up and let it crash :(", Microsoft.Xna.Framework.Color.Red);
return false;
}
case 0x80070057: //E_INVALIDARG/Invalid Arguments
DebugConsole.NewMessage("Invalid graphics settings, attempting to fix...", Microsoft.Xna.Framework.Color.Red);
@@ -138,8 +146,8 @@ namespace Barotrauma
}
#endif
return false;
return false;
}
public static void CrashMessageBox(string message)
@@ -185,11 +193,7 @@ namespace Barotrauma
sb.AppendLine("Loaded submarine: " + ((Submarine.MainSub == null) ? "None" : Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash + ")"));
sb.AppendLine("Selected screen: " + (Screen.Selected == null ? "None" : Screen.Selected.ToString()));
if (GameMain.Server != null)
{
sb.AppendLine("Server (" + (GameMain.Server.GameStarted ? "Round had started)" : "Round hadn't been started)"));
}
else if (GameMain.Client != null)
if (GameMain.Client != null)
{
sb.AppendLine("Client (" + (GameMain.Client.GameStarted ? "Round had started)" : "Round hadn't been started)"));
}
@@ -197,7 +201,7 @@ namespace Barotrauma
sb.AppendLine("\n");
sb.AppendLine("System info:");
sb.AppendLine(" Operating system: " + System.Environment.OSVersion + (System.Environment.Is64BitOperatingSystem ? " 64 bit" : " x86"));
if (game == null)
{
sb.AppendLine(" Game not initialized");