diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-08-25 21:54:00 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-08-25 21:54:00 -0400 |
commit | 211f89821e34bb55a6266384d9bac68ec0c64744 (patch) | |
tree | aa0d9915b01aad436ed6b1a2028602c048666457 /src/SMAPI/Constants.cs | |
parent | 80d3dd1f786f7e5846f9adb7f7a4d82e5b9b92fd (diff) | |
parent | 31ac964a8b19623b0472931403a33d51db6fb271 (diff) | |
download | SMAPI-211f89821e34bb55a6266384d9bac68ec0c64744.tar.gz SMAPI-211f89821e34bb55a6266384d9bac68ec0c64744.tar.bz2 SMAPI-211f89821e34bb55a6266384d9bac68ec0c64744.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Constants.cs')
-rw-r--r-- | src/SMAPI/Constants.cs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 6cbdeb8e..cce267ba 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using Mono.Cecil; using StardewModdingAPI.Enums; using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.ModLoading; @@ -61,7 +62,7 @@ namespace StardewModdingAPI internal static int? LogScreenId { get; set; } /// <summary>SMAPI's current raw semantic version.</summary> - internal static string RawApiVersion = "3.12.2"; + internal static string RawApiVersion = "3.12.3"; } /// <summary>Contains SMAPI's constants and assumptions.</summary> @@ -229,6 +230,32 @@ namespace StardewModdingAPI } } + /// <summary>Configure the Mono.Cecil assembly resolver.</summary> + /// <param name="resolver">The assembly resolver.</param> + internal static void ConfigureAssemblyResolver(AssemblyDefinitionResolver resolver) + { + // add search paths + resolver.AddSearchDirectory(Constants.ExecutionPath); + resolver.AddSearchDirectory(Constants.InternalFilesPath); + + // add SMAPI explicitly + // Normally this would be handled automatically by the search paths, but for some reason there's a specific + // case involving unofficial 64-bit Stardew Valley when launched through Steam (for some players only) + // where Mono.Cecil can't resolve references to SMAPI. + resolver.Add(AssemblyDefinition.ReadAssembly(typeof(SGame).Assembly.Location)); + + // make sure game assembly names can be resolved + // The game assembly can have one of three names depending how the mod was compiled: + // - 'StardewValley': assembly name on Linux/macOS; + // - 'Stardew Valley': assembly name on Windows; + // - 'Netcode': an assembly that's separate on Windows only. + resolver.Add(AssemblyDefinition.ReadAssembly(typeof(Game1).Assembly.Location), "StardewValley", "Stardew Valley" +#if !SMAPI_FOR_WINDOWS + , "Netcode" +#endif + ); + } + /// <summary>Get metadata for mapping assemblies to the current platform.</summary> /// <param name="targetPlatform">The target game platform.</param> /// <param name="framework">The game framework running the game.</param> |