diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-07-04 14:19:58 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-07-04 14:19:58 -0400 |
commit | 186ab4cca7c1b3ae67a68bf6a3a3b1e7cdcb7687 (patch) | |
tree | e6989fb6f0da187a13de3d91ee8d857976420876 /src | |
parent | ea264fb6a190321be39c8094ee4e2afff870304e (diff) | |
download | SMAPI-186ab4cca7c1b3ae67a68bf6a3a3b1e7cdcb7687.tar.gz SMAPI-186ab4cca7c1b3ae67a68bf6a3a3b1e7cdcb7687.tar.bz2 SMAPI-186ab4cca7c1b3ae67a68bf6a3a3b1e7cdcb7687.zip |
fix game freeze if the window loses focus while loading
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI/Framework/SGame.cs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index def0943c..240e9a97 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -223,17 +223,15 @@ namespace StardewModdingAPI.Framework return; } - // Load saves synchronously to avoid issues due to mod events triggering + // Run loaders synchronously to avoid issues due to mod events triggering // concurrently with game code. - if (Game1.gameMode == Game1.loadingMode) + if (Game1.currentLoader != null) { - this.Monitor.Log("Running game loader...", LogLevel.Trace); - while (Game1.gameMode == Game1.loadingMode) - { - base.Update(gameTime); - this.Events.Specialised_UnvalidatedUpdateTick.Raise(); - } - this.Monitor.Log("Game loader OK.", LogLevel.Trace); + this.Monitor.Log("Game loader synchronising...", LogLevel.Trace); + while (Game1.currentLoader?.MoveNext() == true) + continue; + Game1.currentLoader = null; + this.Monitor.Log("Game loader done.", LogLevel.Trace); } // While a background task is in progress, the game may make changes to the game |