summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SGame.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/SGame.cs')
-rw-r--r--src/SMAPI/Framework/SGame.cs25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index b2d92ce8..2a30b595 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -19,6 +19,7 @@ using StardewModdingAPI.Framework.Input;
using StardewModdingAPI.Framework.Networking;
using StardewModdingAPI.Framework.PerformanceMonitoring;
using StardewModdingAPI.Framework.Reflection;
+using StardewModdingAPI.Framework.Rendering;
using StardewModdingAPI.Framework.StateTracking.Comparers;
using StardewModdingAPI.Framework.StateTracking.Snapshots;
using StardewModdingAPI.Framework.Utilities;
@@ -193,6 +194,13 @@ namespace StardewModdingAPI.Framework
Game1.locations = new ObservableCollection<GameLocation>();
}
+ /// <summary>Load content when the game is launched.</summary>
+ protected override void LoadContent()
+ {
+ base.LoadContent();
+ Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, this.GraphicsDevice);
+ }
+
/// <summary>Initialize just before the game's first update tick.</summary>
private void InitializeAfterGameStarted()
{
@@ -252,12 +260,12 @@ namespace StardewModdingAPI.Framework
// update data
LoadStage oldStage = Context.LoadStage;
Context.LoadStage = newStage;
+ this.Monitor.VerboseLog($"Context: load stage changed to {newStage}");
if (newStage == LoadStage.None)
{
this.Monitor.Log("Context: returned to title", LogLevel.Trace);
- this.Multiplayer.CleanupOnMultiplayerExit();
+ this.OnReturnedToTitle();
}
- this.Monitor.VerboseLog($"Context: load stage changed to {newStage}");
// raise events
this.Events.LoadStageChanged.Raise(new LoadStageChangedEventArgs(oldStage, newStage));
@@ -283,6 +291,15 @@ namespace StardewModdingAPI.Framework
}
}
+ /// <summary>Perform cleanup when the game returns to the title screen.</summary>
+ private void OnReturnedToTitle()
+ {
+ this.Multiplayer.CleanupOnMultiplayerExit();
+
+ if (!(Game1.mapDisplayDevice is SDisplayDevice))
+ Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, this.GraphicsDevice);
+ }
+
/// <summary>Constructor a content manager to read XNB files.</summary>
/// <param name="serviceProvider">The service provider to use to locate services.</param>
/// <param name="rootDirectory">The root directory to search for content.</param>
@@ -636,7 +653,7 @@ namespace StardewModdingAPI.Framework
}
// raise input button events
- foreach (var pair in inputState.ActiveButtons)
+ foreach (var pair in inputState.LastButtonStates)
{
SButton button = pair.Key;
SButtonState status = pair.Value;
@@ -807,7 +824,7 @@ namespace StardewModdingAPI.Framework
events.OneSecondUpdateTicking.RaiseEmpty();
try
{
- this.Input.UpdateSuppression();
+ this.Input.ApplyOverrides(); // if mods added any new overrides since the update, process them now
SGame.TicksElapsed++;
base.Update(gameTime);
}