@@ -319,6 +319,17 @@ public void RunInteractively()
319319 this . Game . Run ( ) ;
320320 this . Dispose ( isError : false ) ;
321321 }
322+ catch ( NoSuitableGraphicsDeviceException ex )
323+ {
324+ string ? graphicsCardName = this . TryGetGraphicsDeviceName ( ) ;
325+ string suggestedFix = Constants . TargetPlatform == GamePlatform . Windows
326+ ? "You can usually fix this by running SMAPI on your dedicated graphics card. See instructions here:"
327+ : "See common fixes here:" ;
328+
329+ this . Monitor . Log ( $ "Your graphics card{ ( graphicsCardName != null ? $ " ({ graphicsCardName } )" : "" ) } isn't compatible with Stardew Valley. { suggestedFix } https://smapi.io/troubleshoot/no-suitable-gpu\n \n Technical details:\n { ex . GetLogSummary ( ) } ", LogLevel . Error ) ;
330+ this . LogManager . PressAnyKeyToExit ( ) ;
331+ this . Dispose ( isError : true ) ;
332+ }
322333 catch ( Exception ex )
323334 {
324335 this . LogManager . LogFatalLaunchError ( ex ) ;
@@ -525,7 +536,7 @@ private void OnInstanceContentLoaded()
525536
526537 // log GPU info
527538#if SMAPI_FOR_WINDOWS
528- this . Monitor . Log ( $ "Running on GPU: { Game1 . game1 . GraphicsDevice ? . Adapter ? . Description ?? "<unknown>" } ") ;
539+ this . Monitor . Log ( $ "Running on GPU: { this . TryGetGraphicsDeviceName ( ) ?? "<unknown>" } ") ;
529540#endif
530541 }
531542
@@ -2440,6 +2451,23 @@ private IDictionary<string, IDictionary<string, string>> ReadTranslationFiles(st
24402451 }
24412452 }
24422453
2454+ /// <summary>Get the display name for the current graphics card, if available.</summary>
2455+ private string ? TryGetGraphicsDeviceName ( )
2456+ {
2457+ #if SMAPI_FOR_WINDOWS
2458+ try
2459+ {
2460+ return Game1 . game1 . GraphicsDevice ? . Adapter ? . Description ;
2461+ }
2462+ catch
2463+ {
2464+ // return null if unavailable
2465+ }
2466+ #endif
2467+
2468+ return null ;
2469+ }
2470+
24432471 /// <summary>Get a file lookup for the given directory.</summary>
24442472 /// <param name="rootDirectory">The root path to scan.</param>
24452473 private IFileLookup GetFileLookup ( string rootDirectory )
0 commit comments