diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-25 13:29:08 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-25 13:29:08 -0400 |
commit | 05369f2b317c8e32ff4dec3ffe7aaf06d38d1c32 (patch) | |
tree | dc7030827bad1c5fa954ff4c115c61128d7cca90 | |
parent | 0134f0b28d355766a17b1c9da89b8173f978d195 (diff) | |
download | SMAPI-05369f2b317c8e32ff4dec3ffe7aaf06d38d1c32.tar.gz SMAPI-05369f2b317c8e32ff4dec3ffe7aaf06d38d1c32.tar.bz2 SMAPI-05369f2b317c8e32ff4dec3ffe7aaf06d38d1c32.zip |
add friendly error when game can't load audio (#472)
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI/Program.cs | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 6842c941..86475d6e 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -3,6 +3,7 @@ * For players: * Added support for Stardew Valley 1.3+; no longer compatible with earlier versions. * Added warning for mods which don't have update checks configured. + * Added friendly error when game can't start audio. * Fixed detection of GOG install path in rare cases. * Fixed SMAPI update checks not showing newer beta versions when using a beta version. * Fixed console color scheme on Mac or PowerShell, and added override option to `StardewModdingAPI.config.json`. diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index f1152d82..eda85866 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -259,6 +259,12 @@ namespace StardewModdingAPI StardewValley.Program.releaseBuild = true; // game's debug logic interferes with SMAPI opening the game window this.GameInstance.Run(); } + catch (InvalidOperationException ex) when (ex.Source == "Microsoft.Xna.Framework.Xact" && ex.StackTrace.Contains("Microsoft.Xna.Framework.Audio.AudioEngine..ctor")) + { + this.Monitor.Log("The game couldn't load audio. Do you have speakers or headphones plugged in?", LogLevel.Error); + this.Monitor.Log($"Technical details: {ex.GetLogSummary()}", LogLevel.Trace); + this.PressAnyKeyToExit(); + } catch (Exception ex) { this.Monitor.Log($"The game failed unexpectedly: {ex.GetLogSummary()}", LogLevel.Error); |