diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index c4f90c16..e8be2d1b 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -30,7 +30,6 @@ using StardewModdingAPI.Framework.ModHelpers; using StardewModdingAPI.Framework.ModLoading; using StardewModdingAPI.Framework.Networking; using StardewModdingAPI.Framework.Reflection; -using StardewModdingAPI.Framework.Rendering; using StardewModdingAPI.Framework.Serialization; using StardewModdingAPI.Framework.StateTracking.Snapshots; using StardewModdingAPI.Framework.Utilities; @@ -47,7 +46,6 @@ using StardewValley.Menus; using StardewValley.Mods; using StardewValley.Objects; using StardewValley.SDKs; -using xTile.Display; using LanguageCode = StardewValley.LocalizedContentManager.LanguageCode; using MiniMonoModHotfix = MonoMod.Utils.MiniMonoModHotfix; using PathUtilities = StardewModdingAPI.Toolkit.Utilities.PathUtilities; @@ -132,9 +130,6 @@ internal class SCore : IDisposable /// Whether the game has initialized for any custom languages from Data/AdditionalLanguages. private bool AreCustomLanguagesInitialized; - /// Whether the player just returned to the title screen. - public bool JustReturnedToTitle { get; set; } - /// The last language set by the game. private (string Locale, LanguageCode Code) LastLanguage { get; set; } = ("", LanguageCode.en); @@ -492,9 +487,6 @@ internal class SCore : IDisposable /// Raised after an instance finishes loading its initial content. private void OnInstanceContentLoaded() { - // override map display device - Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice); - // log GPU info #if SMAPI_FOR_WINDOWS this.Monitor.Log($"Running on GPU: {Game1.game1.GraphicsDevice?.Adapter?.Description ?? ""}"); @@ -611,17 +603,6 @@ internal class SCore : IDisposable try { - /********* - ** Reapply overrides - *********/ - if (this.JustReturnedToTitle) - { - if (Game1.mapDisplayDevice is not SDisplayDevice) - Game1.mapDisplayDevice = this.GetMapDisplayDevice(); - - this.JustReturnedToTitle = false; - } - /********* ** Execute commands *********/ @@ -1179,7 +1160,6 @@ internal class SCore : IDisposable break; case LoadStage.None: - this.JustReturnedToTitle = true; this.UpdateWindowTitles(); break; @@ -2369,13 +2349,6 @@ internal class SCore : IDisposable : MinimalFileLookup.GetCachedFor(rootDirectory); } - /// Get the map display device which applies SMAPI features like tile rotation to loaded maps. - /// This is separate to let mods like PyTK wrap it with their own functionality. - private IDisplayDevice GetMapDisplayDevice() - { - return new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice); - } - /// Get the absolute path to the next available log file. private string GetLogPath() { diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 1bb0fdbc..9a405cad 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -2,11 +2,13 @@ using System; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using StardewModdingAPI.Enums; using StardewModdingAPI.Events; using StardewModdingAPI.Framework.Input; using StardewModdingAPI.Framework.Reflection; +using StardewModdingAPI.Framework.Rendering; using StardewModdingAPI.Framework.StateTracking.Snapshots; using StardewModdingAPI.Framework.Utilities; using StardewModdingAPI.Internal; @@ -15,6 +17,7 @@ using StardewValley; using StardewValley.Logging; using StardewValley.Menus; using StardewValley.Minigames; +using xTile.Display; namespace StardewModdingAPI.Framework; @@ -166,9 +169,7 @@ internal class SGame : Game1 /********* ** Protected methods *********/ - /// Construct a content manager to read game content files. - /// The service provider to use to locate services. - /// The root directory to search for content. + /// protected internal override LocalizedContentManager CreateContentManager(IServiceProvider serviceProvider, string rootDirectory) { if (SGame.CreateContentManagerImpl == null) @@ -177,6 +178,12 @@ internal class SGame : Game1 return SGame.CreateContentManagerImpl(serviceProvider, rootDirectory); } + /// + protected internal override IDisplayDevice CreateDisplayDevice(ContentManager content, GraphicsDevice graphicsDevice) + { + return new SDisplayDevice(content, graphicsDevice); + } + /// Initialize the instance when the game starts. protected override void Initialize() {