summaryrefslogtreecommitdiff
path: root/src/SMAPI/Constants.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-08-12 21:26:01 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-11-28 00:01:40 -0500
commit6efaa651cb2b026b7bace55ffeba9d7c5a3d0567 (patch)
tree88af46f59302a1f9f11b64fb5284156d543f32b4 /src/SMAPI/Constants.cs
parentc8c6b3897cd080ef3261f5642d31d8a51971981b (diff)
downloadSMAPI-6efaa651cb2b026b7bace55ffeba9d7c5a3d0567.tar.gz
SMAPI-6efaa651cb2b026b7bace55ffeba9d7c5a3d0567.tar.bz2
SMAPI-6efaa651cb2b026b7bace55ffeba9d7c5a3d0567.zip
drop support for XNA Framework
Stardew Valley 1.5.5 migrates to MonoGame on all platforms.
Diffstat (limited to 'src/SMAPI/Constants.cs')
-rw-r--r--src/SMAPI/Constants.cs82
1 files changed, 24 insertions, 58 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs
index 4d6a2a0b..72456ae4 100644
--- a/src/SMAPI/Constants.cs
+++ b/src/SMAPI/Constants.cs
@@ -40,12 +40,7 @@ namespace StardewModdingAPI
internal static GamePlatform Platform { get; } = (GamePlatform)Enum.Parse(typeof(GamePlatform), LowLevelEnvironmentUtility.DetectPlatform());
/// <summary>The game framework running the game.</summary>
- internal static GameFramework GameFramework { get; } =
-#if SMAPI_FOR_XNA
- GameFramework.Xna;
-#else
- GameFramework.MonoGame;
-#endif
+ internal static GameFramework GameFramework { get; } = GameFramework.MonoGame;
/// <summary>The game's assembly name.</summary>
internal static string GameAssemblyName => EarlyConstants.Platform == GamePlatform.Windows ? "Stardew Valley" : "StardewValley";
@@ -260,61 +255,32 @@ namespace StardewModdingAPI
removeAssemblyReferences.Add("StardewModdingAPI.Toolkit.CoreInterfaces");
targetAssemblies.Add(typeof(StardewModdingAPI.IManifest).Assembly);
- // get changes for platform
- if (Constants.Platform != Platform.Windows)
+ // XNA Framework before Stardew Valley 1.5.5
+ removeAssemblyReferences.AddRange(new[]
{
- removeAssemblyReferences.AddRange(new[]
- {
- "Netcode",
- "Stardew Valley"
- });
- targetAssemblies.Add(
- typeof(StardewValley.Game1).Assembly // note: includes Netcode types on Linux/macOS
- );
- }
- else
- {
- removeAssemblyReferences.Add(
- "StardewValley"
- );
- targetAssemblies.AddRange(new[]
- {
- typeof(Netcode.NetBool).Assembly,
- typeof(StardewValley.Game1).Assembly
- });
- }
+ "Microsoft.Xna.Framework",
+ "Microsoft.Xna.Framework.Game",
+ "Microsoft.Xna.Framework.Graphics",
+ "Microsoft.Xna.Framework.Xact"
+ });
+ targetAssemblies.Add(
+ typeof(Microsoft.Xna.Framework.Vector2).Assembly
+ );
- // get changes for game framework
- switch (framework)
- {
- case GameFramework.MonoGame:
- removeAssemblyReferences.AddRange(new[]
- {
- "Microsoft.Xna.Framework",
- "Microsoft.Xna.Framework.Game",
- "Microsoft.Xna.Framework.Graphics",
- "Microsoft.Xna.Framework.Xact"
- });
- targetAssemblies.Add(
- typeof(Microsoft.Xna.Framework.Vector2).Assembly
- );
- break;
-
- case GameFramework.Xna:
- removeAssemblyReferences.Add(
- "MonoGame.Framework"
- );
- targetAssemblies.AddRange(new[]
- {
- typeof(Microsoft.Xna.Framework.Vector2).Assembly,
- typeof(Microsoft.Xna.Framework.Game).Assembly,
- typeof(Microsoft.Xna.Framework.Graphics.SpriteBatch).Assembly
- });
- break;
+ // `Netcode.dll` merged into the game assembly in Stardew Valley 1.5.5
+ removeAssemblyReferences.Add(
+ "Netcode"
+ );
- default:
- throw new InvalidOperationException($"Unknown game framework '{framework}'.");
- }
+ // Stardew Valley reference
+ removeAssemblyReferences.Add(
+ Constants.Platform == Platform.Windows
+ ? "StardewValley"
+ : "Stardew Valley"
+ );
+ targetAssemblies.Add(
+ typeof(StardewValley.Game1).Assembly
+ );
return new PlatformAssemblyMap(targetPlatform, removeAssemblyReferences.ToArray(), targetAssemblies.ToArray());
}